3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-29 07:29:31 +01:00

ensure IsBot gets propagated into history

This commit is contained in:
Shivaram Lingamneni 2021-03-17 19:01:38 -04:00
parent 1efde964e1
commit 88b877fce4
2 changed files with 6 additions and 2 deletions

View File

@ -1288,6 +1288,7 @@ func (channel *Channel) SetTopic(client *Client, topic string, rb *ResponseBuffe
Nick: details.nickMask,
AccountName: details.accountName,
Message: message,
IsBot: isBot,
}, details.account)
channel.MarkDirty(IncludeTopic)
@ -1370,6 +1371,7 @@ func (channel *Channel) SendSplitMessage(command string, minPrefixMode modes.Mod
}
details := client.Details()
isBot := client.HasMode(modes.Bot)
chname := channel.Name()
if !client.server.Config().Server.Compatibility.allowTruncation {
@ -1402,7 +1404,7 @@ func (channel *Channel) SendSplitMessage(command string, minPrefixMode modes.Mod
rb.addEchoMessage(clientOnlyTags, details.nickMask, details.accountName, command, chname, message)
var cache MessageCache
cache.InitializeSplitMessage(channel.server, details.nickMask, details.accountName, client.HasMode(modes.Bot), clientOnlyTags, command, chname, message)
cache.InitializeSplitMessage(channel.server, details.nickMask, details.accountName, isBot, clientOnlyTags, command, chname, message)
for _, member := range channel.Members() {
if minPrefixMode != modes.Mode(0) && !channel.ClientIsAtLeast(member, minPrefixMode) {
// STATUSMSG or OpModerated
@ -1430,6 +1432,7 @@ func (channel *Channel) SendSplitMessage(command string, minPrefixMode modes.Mod
Nick: details.nickMask,
AccountName: details.accountName,
Tags: clientOnlyTags,
IsBot: isBot,
}, details.account)
}
}

View File

@ -85,12 +85,14 @@ func performNickChange(server *Server, client *Client, target *Client, session *
return err
}
isBot := !isSanick && client.HasMode(modes.Bot)
message := utils.MakeMessage("")
histItem := history.Item{
Type: history.Nick,
Nick: origNickMask,
AccountName: details.accountName,
Message: message,
IsBot: isBot,
}
histItem.Params[0] = assignedNickname
@ -102,7 +104,6 @@ func performNickChange(server *Server, client *Client, target *Client, session *
target.server.snomasks.Send(sno.LocalNicks, fmt.Sprintf(ircfmt.Unescape("Operator %s changed nickname of $%s$r to %s"), client.Nick(), details.nick, assignedNickname))
}
target.server.whoWas.Append(details.WhoWas)
isBot := !isSanick && client.HasMode(modes.Bot)
rb.AddFromClient(message.Time, message.Msgid, origNickMask, details.accountName, isBot, nil, "NICK", assignedNickname)
for session := range target.Friends() {
if session != rb.session {