mirror of
https://github.com/ergochat/ergo.git
synced 2024-11-13 07:29:30 +01:00
Fix some issues, add RPL_WHOISACCOUNT
This commit is contained in:
parent
ac99e82192
commit
0d5327de8a
@ -322,10 +322,17 @@ func (client *Client) TryResume() {
|
|||||||
timestamp := client.resumeDetails.Timestamp
|
timestamp := client.resumeDetails.Timestamp
|
||||||
var timestampString string
|
var timestampString string
|
||||||
if timestamp != nil {
|
if timestamp != nil {
|
||||||
timestampString := timestamp.UTC().Format("2006-01-02T15:04:05.999Z")
|
timestampString = timestamp.UTC().Format("2006-01-02T15:04:05.999Z")
|
||||||
}
|
}
|
||||||
|
|
||||||
oldClient := server.clients.Get(oldnick)
|
// can't use server.clients.Get since we hold server.clients' tier 1 mutex
|
||||||
|
casefoldedName, err := CasefoldName(oldnick)
|
||||||
|
if err != nil {
|
||||||
|
client.Send(nil, server.name, ERR_CANNOT_RESUME, oldnick, "Cannot resume connection, old client not found")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
oldClient := server.clients.byNick[casefoldedName]
|
||||||
if oldClient == nil {
|
if oldClient == nil {
|
||||||
client.Send(nil, server.name, ERR_CANNOT_RESUME, oldnick, "Cannot resume connection, old client not found")
|
client.Send(nil, server.name, ERR_CANNOT_RESUME, oldnick, "Cannot resume connection, old client not found")
|
||||||
return
|
return
|
||||||
|
@ -69,6 +69,7 @@ const (
|
|||||||
RPL_CHANNELMODEIS = "324"
|
RPL_CHANNELMODEIS = "324"
|
||||||
RPL_UNIQOPIS = "325"
|
RPL_UNIQOPIS = "325"
|
||||||
RPL_CHANNELCREATED = "329"
|
RPL_CHANNELCREATED = "329"
|
||||||
|
RPL_WHOISACCOUNT = "330"
|
||||||
RPL_NOTOPIC = "331"
|
RPL_NOTOPIC = "331"
|
||||||
RPL_TOPIC = "332"
|
RPL_TOPIC = "332"
|
||||||
RPL_TOPICTIME = "333"
|
RPL_TOPICTIME = "333"
|
||||||
|
@ -1002,6 +1002,10 @@ func (client *Client) getWhoisOf(target *Client) {
|
|||||||
if target.flags[TLS] {
|
if target.flags[TLS] {
|
||||||
client.Send(nil, client.server.name, RPL_WHOISSECURE, client.nick, target.nick, "is using a secure connection")
|
client.Send(nil, client.server.name, RPL_WHOISSECURE, client.nick, target.nick, "is using a secure connection")
|
||||||
}
|
}
|
||||||
|
accountName := target.AccountName()
|
||||||
|
if accountName != "" {
|
||||||
|
client.Send(nil, client.server.name, RPL_WHOISACCOUNT, client.nick, accountName, "is logged in as")
|
||||||
|
}
|
||||||
if target.flags[Bot] {
|
if target.flags[Bot] {
|
||||||
client.Send(nil, client.server.name, RPL_WHOISBOT, client.nick, target.nick, ircfmt.Unescape("is a $bBot$b on ")+client.server.networkName)
|
client.Send(nil, client.server.name, RPL_WHOISBOT, client.nick, target.nick, ircfmt.Unescape("is a $bBot$b on ")+client.server.networkName)
|
||||||
}
|
}
|
||||||
@ -2093,8 +2097,10 @@ func resumeHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
|
|||||||
|
|
||||||
var timestamp *time.Time
|
var timestamp *time.Time
|
||||||
if 1 < len(msg.Params) {
|
if 1 < len(msg.Params) {
|
||||||
timestamp, err = time.Parse("2006-01-02T15:04:05.999Z", msg.Params[1])
|
ts, err := time.Parse("2006-01-02T15:04:05.999Z", msg.Params[1])
|
||||||
if err != nil {
|
if err == nil {
|
||||||
|
timestamp = &ts
|
||||||
|
} else {
|
||||||
client.Send(nil, server.name, ERR_CANNOT_RESUME, oldnick, "Timestamp is not in 2006-01-02T15:04:05.999Z format, ignoring it")
|
client.Send(nil, server.name, ERR_CANNOT_RESUME, oldnick, "Timestamp is not in 2006-01-02T15:04:05.999Z format, ignoring it")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2104,7 +2110,7 @@ func resumeHandler(server *Server, client *Client, msg ircmsg.IrcMessage) bool {
|
|||||||
Timestamp: timestamp,
|
Timestamp: timestamp,
|
||||||
}
|
}
|
||||||
|
|
||||||
return true
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// USERHOST <nickname> [<nickname> <nickname> ...]
|
// USERHOST <nickname> [<nickname> <nickname> ...]
|
||||||
|
Loading…
Reference in New Issue
Block a user