mirror of
https://github.com/ergochat/ergo.git
synced 2024-12-22 10:42:52 +01:00
fix #1198
This commit is contained in:
parent
a99c893f9b
commit
93530ae397
@ -767,6 +767,7 @@ func (channel *Channel) Join(client *Client, key string, isSajoin bool, rb *Resp
|
||||
modestr = fmt.Sprintf("+%v", givenMode)
|
||||
}
|
||||
|
||||
isAway, awayMessage := client.Away()
|
||||
for _, member := range channel.Members() {
|
||||
for _, session := range member.Sessions() {
|
||||
if session == rb.session {
|
||||
@ -783,6 +784,9 @@ func (channel *Channel) Join(client *Client, key string, isSajoin bool, rb *Resp
|
||||
if givenMode != 0 {
|
||||
session.Send(nil, client.server.name, "MODE", chname, modestr, details.nick)
|
||||
}
|
||||
if isAway && session.capabilities.Has(caps.AwayNotify) {
|
||||
session.sendFromClientInternal(false, time.Time{}, "", details.nickMask, details.account, nil, "AWAY", awayMessage)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1458,8 +1462,8 @@ func (channel *Channel) Invite(invitee *Client, inviter *Client, rb *ResponseBuf
|
||||
tnick := invitee.Nick()
|
||||
rb.Add(nil, inviter.server.name, RPL_INVITING, cnick, tnick, chname)
|
||||
invitee.Send(nil, inviter.NickMaskString(), "INVITE", tnick, chname)
|
||||
if invitee.Away() {
|
||||
rb.Add(nil, inviter.server.name, RPL_AWAY, cnick, tnick, invitee.AwayMessage())
|
||||
if away, awayMessage := invitee.Away(); away {
|
||||
rb.Add(nil, inviter.server.name, RPL_AWAY, cnick, tnick, awayMessage)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -185,9 +185,9 @@ func (client *Client) Hostname() string {
|
||||
return client.hostname
|
||||
}
|
||||
|
||||
func (client *Client) Away() (result bool) {
|
||||
func (client *Client) Away() (result bool, message string) {
|
||||
client.stateMutex.Lock()
|
||||
result = client.away
|
||||
result, message = client.away, client.awayMessage
|
||||
client.stateMutex.Unlock()
|
||||
return
|
||||
}
|
||||
|
@ -2122,9 +2122,11 @@ func dispatchMessageToTarget(client *Client, tags map[string]string, histType hi
|
||||
rb.AddSplitMessageFromClient(nickMaskString, accountName, tagsToSend, command, tnick, message)
|
||||
}
|
||||
}
|
||||
if histType != history.Notice && user.Away() {
|
||||
if histType != history.Notice {
|
||||
//TODO(dan): possibly implement cooldown of away notifications to users
|
||||
rb.Add(nil, server.name, RPL_AWAY, client.Nick(), tnick, user.AwayMessage())
|
||||
if away, awayMessage := user.Away(); away {
|
||||
rb.Add(nil, server.name, RPL_AWAY, client.Nick(), tnick, awayMessage)
|
||||
}
|
||||
}
|
||||
|
||||
config := server.Config()
|
||||
@ -2742,7 +2744,7 @@ func userhostHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *
|
||||
if target.HasMode(modes.Operator) {
|
||||
isOper = "*"
|
||||
}
|
||||
if target.Away() {
|
||||
if away, _ := target.Away(); away {
|
||||
isAway = "-"
|
||||
} else {
|
||||
isAway = "+"
|
||||
@ -2893,7 +2895,7 @@ func (client *Client) rplWhoReply(channel *Channel, target *Client, rb *Response
|
||||
}
|
||||
if fields.Has('f') { // "flags" (away + oper state + channel status prefix + bot)
|
||||
var flags strings.Builder
|
||||
if target.Away() {
|
||||
if away, _ := target.Away(); away {
|
||||
flags.WriteRune('G') // Gone
|
||||
} else {
|
||||
flags.WriteRune('H') // Here
|
||||
|
@ -110,9 +110,9 @@ func sendRoleplayMessage(server *Server, client *Client, source string, targetSt
|
||||
for _, session := range user.Sessions() {
|
||||
session.sendSplitMsgFromClientInternal(false, source, "", nil, "PRIVMSG", tnick, splitMessage)
|
||||
}
|
||||
if user.Away() {
|
||||
if away, awayMessage := user.Away(); away {
|
||||
//TODO(dan): possibly implement cooldown of away notifications to users
|
||||
rb.Add(nil, server.name, RPL_AWAY, cnick, tnick, user.AwayMessage())
|
||||
rb.Add(nil, server.name, RPL_AWAY, cnick, tnick, awayMessage)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -436,8 +436,8 @@ func (client *Client) getWhoisOf(target *Client, rb *ResponseBuffer) {
|
||||
}
|
||||
}
|
||||
rb.Add(nil, client.server.name, RPL_WHOISIDLE, cnick, tnick, strconv.FormatUint(target.IdleSeconds(), 10), strconv.FormatInt(target.SignonTime(), 10), client.t("seconds idle, signon time"))
|
||||
if target.Away() {
|
||||
rb.Add(nil, client.server.name, RPL_AWAY, cnick, tnick, target.AwayMessage())
|
||||
if away, awayMessage := target.Away(); away {
|
||||
rb.Add(nil, client.server.name, RPL_AWAY, cnick, tnick, awayMessage)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user