|
@@ -1058,16 +1058,28 @@ func (client *Client) replayPrivmsgHistory(rb *ResponseBuffer, items []history.I
|
1058
|
1058
|
}
|
1059
|
1059
|
batchID = rb.StartNestedHistoryBatch(target)
|
1060
|
1060
|
|
|
1061
|
+ isSelfMessage := func(item *history.Item) bool {
|
|
1062
|
+ // XXX: Params[0] is the message target. if the source of this message is an in-memory
|
|
1063
|
+ // buffer, then it's "" for an incoming message and the recipient's nick for an outgoing
|
|
1064
|
+ // message. if the source of the message is mysql, then mysql only sees one copy of the
|
|
1065
|
+ // message, and it's the version with the recipient's nick filled in. so this is an
|
|
1066
|
+ // incoming message if Params[0] (the recipient's nick) equals the client's nick:
|
|
1067
|
+ return item.Params[0] != "" && item.Params[0] != nick
|
|
1068
|
+ }
|
|
1069
|
+
|
1061
|
1070
|
hasEventPlayback := rb.session.capabilities.Has(caps.EventPlayback)
|
1062
|
1071
|
hasTags := rb.session.capabilities.Has(caps.MessageTags)
|
1063
|
1072
|
for _, item := range items {
|
1064
|
1073
|
var command string
|
1065
|
1074
|
switch item.Type {
|
1066
|
1075
|
case history.Invite:
|
|
1076
|
+ if isSelfMessage(&item) {
|
|
1077
|
+ continue
|
|
1078
|
+ }
|
1067
|
1079
|
if hasEventPlayback {
|
1068
|
|
- rb.AddFromClient(item.Message.Time, item.Message.Msgid, item.Nick, item.AccountName, nil, "INVITE", item.Params[0])
|
|
1080
|
+ rb.AddFromClient(item.Message.Time, item.Message.Msgid, item.Nick, item.AccountName, nil, "INVITE", nick, item.Message.Message)
|
1069
|
1081
|
} else {
|
1070
|
|
- rb.AddFromClient(item.Message.Time, utils.MungeSecretToken(item.Message.Msgid), histservService.prefix, "*", nil, "PRIVMSG", fmt.Sprintf(client.t("%[1]s invited you to channel %[2]s"), stripMaskFromNick(item.Nick), item.Params[0]))
|
|
1082
|
+ rb.AddFromClient(item.Message.Time, utils.MungeSecretToken(item.Message.Msgid), histservService.prefix, "*", nil, "PRIVMSG", fmt.Sprintf(client.t("%[1]s invited you to channel %[2]s"), stripMaskFromNick(item.Nick), item.Message.Message))
|
1071
|
1083
|
}
|
1072
|
1084
|
continue
|
1073
|
1085
|
case history.Privmsg:
|
|
@@ -1087,12 +1099,7 @@ func (client *Client) replayPrivmsgHistory(rb *ResponseBuffer, items []history.I
|
1087
|
1099
|
if hasTags {
|
1088
|
1100
|
tags = item.Tags
|
1089
|
1101
|
}
|
1090
|
|
- // XXX: Params[0] is the message target. if the source of this message is an in-memory
|
1091
|
|
- // buffer, then it's "" for an incoming message and the recipient's nick for an outgoing
|
1092
|
|
- // message. if the source of the message is mysql, then mysql only sees one copy of the
|
1093
|
|
- // message, and it's the version with the recipient's nick filled in. so this is an
|
1094
|
|
- // incoming message if Params[0] (the recipient's nick) equals the client's nick:
|
1095
|
|
- if item.Params[0] == "" || item.Params[0] == nick {
|
|
1102
|
+ if !isSelfMessage(&item) {
|
1096
|
1103
|
rb.AddSplitMessageFromClient(item.Nick, item.AccountName, tags, command, nick, item.Message)
|
1097
|
1104
|
} else {
|
1098
|
1105
|
// this message was sent *from* the client to another nick; the target is item.Params[0]
|