This commit is contained in:
Shivaram Lingamneni 2019-05-19 02:14:36 -04:00
parent 9930d9bfa2
commit 25974b6881
2 changed files with 17 additions and 4 deletions

View File

@ -600,7 +600,8 @@ func (client *Client) tryResumeChannels() {
func (client *Client) replayPrivmsgHistory(rb *ResponseBuffer, items []history.Item, complete bool) { func (client *Client) replayPrivmsgHistory(rb *ResponseBuffer, items []history.Item, complete bool) {
var batchID string var batchID string
nick := client.Nick() details := client.Details()
nick := details.nick
if 0 < len(items) { if 0 < len(items) {
batchID = rb.StartNestedHistoryBatch(nick) batchID = rb.StartNestedHistoryBatch(nick)
} }
@ -626,7 +627,14 @@ func (client *Client) replayPrivmsgHistory(rb *ResponseBuffer, items []history.I
if allowTags { if allowTags {
tags = item.Tags tags = item.Tags
} }
if item.Params[0] == "" {
// this message was sent *to* the client from another nick
rb.AddSplitMessageFromClient(item.Nick, item.AccountName, tags, command, nick, item.Message) rb.AddSplitMessageFromClient(item.Nick, item.AccountName, tags, command, nick, item.Message)
} else {
// this message was sent *from* the client to another nick; the target is item.Params[0]
// substitute the client's current nickmask in case they changed nick
rb.AddSplitMessageFromClient(details.nickMask, item.AccountName, tags, command, item.Params[0], item.Message)
}
} }
rb.EndNestedBatch(batchID) rb.EndNestedBatch(batchID)

View File

@ -2060,12 +2060,17 @@ func messageHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *R
rb.Add(nil, server.name, RPL_AWAY, cnick, tnick, user.AwayMessage()) rb.Add(nil, server.name, RPL_AWAY, cnick, tnick, user.AwayMessage())
} }
user.history.Add(history.Item{ item := history.Item{
Type: histType, Type: histType,
Message: splitMsg, Message: splitMsg,
Nick: nickMaskString, Nick: nickMaskString,
AccountName: accountName, AccountName: accountName,
}) }
// add to the target's history:
user.history.Add(item)
// add this to the client's history as well, recording the target:
item.Params[0] = tnick
client.history.Add(item)
} }
} }
return false return false