|
@@ -408,18 +408,18 @@ func authExternalHandler(server *Server, client *Client, mechanism string, value
|
408
|
408
|
// AWAY [<message>]
|
409
|
409
|
func awayHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *ResponseBuffer) bool {
|
410
|
410
|
var isAway bool
|
411
|
|
- var text string
|
|
411
|
+ var awayMessage string
|
412
|
412
|
if len(msg.Params) > 0 {
|
413
|
413
|
isAway = true
|
414
|
|
- text = msg.Params[0]
|
|
414
|
+ awayMessage = msg.Params[0]
|
415
|
415
|
awayLen := server.Limits().AwayLen
|
416
|
|
- if len(text) > awayLen {
|
417
|
|
- text = text[:awayLen]
|
|
416
|
+ if len(awayMessage) > awayLen {
|
|
417
|
+ awayMessage = awayMessage[:awayLen]
|
418
|
418
|
}
|
419
|
419
|
}
|
420
|
420
|
|
421
|
421
|
client.SetMode(modes.Away, isAway)
|
422
|
|
- client.awayMessage = text
|
|
422
|
+ client.SetAwayMessage(awayMessage)
|
423
|
423
|
|
424
|
424
|
var op modes.ModeOp
|
425
|
425
|
if isAway {
|
|
@@ -439,7 +439,7 @@ func awayHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Resp
|
439
|
439
|
// dispatch away-notify
|
440
|
440
|
for friend := range client.Friends(caps.AwayNotify) {
|
441
|
441
|
if isAway {
|
442
|
|
- friend.SendFromClient("", client, nil, "AWAY", client.awayMessage)
|
|
442
|
+ friend.SendFromClient("", client, nil, "AWAY", awayMessage)
|
443
|
443
|
} else {
|
444
|
444
|
friend.SendFromClient("", client, nil, "AWAY")
|
445
|
445
|
}
|
|
@@ -1777,6 +1777,7 @@ func monitorClearHandler(server *Server, client *Client, msg ircmsg.IrcMessage,
|
1777
|
1777
|
|
1778
|
1778
|
// MONITOR L
|
1779
|
1779
|
func monitorListHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *ResponseBuffer) bool {
|
|
1780
|
+ nick := client.Nick()
|
1780
|
1781
|
monitorList := server.monitorManager.List(client)
|
1781
|
1782
|
|
1782
|
1783
|
var nickList []string
|
|
@@ -1790,10 +1791,10 @@ func monitorListHandler(server *Server, client *Client, msg ircmsg.IrcMessage, r
|
1790
|
1791
|
}
|
1791
|
1792
|
|
1792
|
1793
|
for _, line := range utils.ArgsToStrings(maxLastArgLength, nickList, ",") {
|
1793
|
|
- rb.Add(nil, server.name, RPL_MONLIST, client.Nick(), line)
|
|
1794
|
+ rb.Add(nil, server.name, RPL_MONLIST, nick, line)
|
1794
|
1795
|
}
|
1795
|
1796
|
|
1796
|
|
- rb.Add(nil, server.name, RPL_ENDOFMONLIST, "End of MONITOR list")
|
|
1797
|
+ rb.Add(nil, server.name, RPL_ENDOFMONLIST, nick, "End of MONITOR list")
|
1797
|
1798
|
|
1798
|
1799
|
return false
|
1799
|
1800
|
}
|
|
@@ -2089,6 +2090,7 @@ func privmsgHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *R
|
2089
|
2090
|
// split privmsg
|
2090
|
2091
|
splitMsg := utils.MakeSplitMessage(message, !client.capabilities.Has(caps.MaxLine))
|
2091
|
2092
|
|
|
2093
|
+ cnick := client.Nick()
|
2092
|
2094
|
for i, targetString := range targets {
|
2093
|
2095
|
// max of four targets per privmsg
|
2094
|
2096
|
if i > maxTargets-1 {
|
|
@@ -2106,7 +2108,7 @@ func privmsgHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *R
|
2106
|
2108
|
if err == nil {
|
2107
|
2109
|
channel := server.channels.Get(target)
|
2108
|
2110
|
if channel == nil {
|
2109
|
|
- rb.Add(nil, server.name, ERR_NOSUCHCHANNEL, client.nick, targetString, client.t("No such channel"))
|
|
2111
|
+ rb.Add(nil, server.name, ERR_NOSUCHCHANNEL, cnick, targetString, client.t("No such channel"))
|
2110
|
2112
|
continue
|
2111
|
2113
|
}
|
2112
|
2114
|
if !channel.CanSpeak(client) {
|
|
@@ -2124,7 +2126,7 @@ func privmsgHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *R
|
2124
|
2126
|
user := server.clients.Get(target)
|
2125
|
2127
|
if err != nil || user == nil {
|
2126
|
2128
|
if len(target) > 0 {
|
2127
|
|
- client.Send(nil, server.name, ERR_NOSUCHNICK, client.nick, target, "No such nick")
|
|
2129
|
+ client.Send(nil, server.name, ERR_NOSUCHNICK, cnick, target, "No such nick")
|
2128
|
2130
|
}
|
2129
|
2131
|
continue
|
2130
|
2132
|
}
|
|
@@ -2144,7 +2146,7 @@ func privmsgHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *R
|
2144
|
2146
|
}
|
2145
|
2147
|
if user.HasMode(modes.Away) {
|
2146
|
2148
|
//TODO(dan): possibly implement cooldown of away notifications to users
|
2147
|
|
- rb.Add(nil, server.name, RPL_AWAY, user.nick, user.awayMessage)
|
|
2149
|
+ rb.Add(nil, server.name, RPL_AWAY, cnick, user.Nick(), user.AwayMessage())
|
2148
|
2150
|
}
|
2149
|
2151
|
|
2150
|
2152
|
user.history.Add(history.Item{
|
|
@@ -2343,6 +2345,7 @@ func tagmsgHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Re
|
2343
|
2345
|
|
2344
|
2346
|
targets := strings.Split(msg.Params[0], ",")
|
2345
|
2347
|
|
|
2348
|
+ cnick := client.Nick()
|
2346
|
2349
|
for i, targetString := range targets {
|
2347
|
2350
|
// max of four targets per privmsg
|
2348
|
2351
|
if i > maxTargets-1 {
|
|
@@ -2360,7 +2363,7 @@ func tagmsgHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Re
|
2360
|
2363
|
if err == nil {
|
2361
|
2364
|
channel := server.channels.Get(target)
|
2362
|
2365
|
if channel == nil {
|
2363
|
|
- rb.Add(nil, server.name, ERR_NOSUCHCHANNEL, client.nick, targetString, client.t("No such channel"))
|
|
2366
|
+ rb.Add(nil, server.name, ERR_NOSUCHCHANNEL, cnick, targetString, client.t("No such channel"))
|
2364
|
2367
|
continue
|
2365
|
2368
|
}
|
2366
|
2369
|
if !channel.CanSpeak(client) {
|
|
@@ -2375,7 +2378,7 @@ func tagmsgHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Re
|
2375
|
2378
|
user := server.clients.Get(target)
|
2376
|
2379
|
if err != nil || user == nil {
|
2377
|
2380
|
if len(target) > 0 {
|
2378
|
|
- client.Send(nil, server.name, ERR_NOSUCHNICK, client.nick, target, client.t("No such nick"))
|
|
2381
|
+ client.Send(nil, server.name, ERR_NOSUCHNICK, cnick, target, client.t("No such nick"))
|
2379
|
2382
|
}
|
2380
|
2383
|
continue
|
2381
|
2384
|
}
|
|
@@ -2391,7 +2394,7 @@ func tagmsgHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Re
|
2391
|
2394
|
}
|
2392
|
2395
|
if user.HasMode(modes.Away) {
|
2393
|
2396
|
//TODO(dan): possibly implement cooldown of away notifications to users
|
2394
|
|
- rb.Add(nil, server.name, RPL_AWAY, user.nick, user.awayMessage)
|
|
2397
|
+ rb.Add(nil, server.name, RPL_AWAY, cnick, user.Nick(), user.AwayMessage())
|
2395
|
2398
|
}
|
2396
|
2399
|
}
|
2397
|
2400
|
}
|