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

View File

@ -85,12 +85,14 @@ func performNickChange(server *Server, client *Client, target *Client, session *
return err return err
} }
isBot := !isSanick && client.HasMode(modes.Bot)
message := utils.MakeMessage("") message := utils.MakeMessage("")
histItem := history.Item{ histItem := history.Item{
Type: history.Nick, Type: history.Nick,
Nick: origNickMask, Nick: origNickMask,
AccountName: details.accountName, AccountName: details.accountName,
Message: message, Message: message,
IsBot: isBot,
} }
histItem.Params[0] = assignedNickname 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.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) 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) rb.AddFromClient(message.Time, message.Msgid, origNickMask, details.accountName, isBot, nil, "NICK", assignedNickname)
for session := range target.Friends() { for session := range target.Friends() {
if session != rb.session { if session != rb.session {