|
@@ -952,7 +952,7 @@ func (channel *Channel) autoReplayHistory(client *Client, rb *ResponseBuffer, sk
|
952
|
952
|
}
|
953
|
953
|
}
|
954
|
954
|
if 0 < numItems {
|
955
|
|
- channel.replayHistoryItems(rb, items, true)
|
|
955
|
+ channel.replayHistoryItems(rb, items, false)
|
956
|
956
|
rb.Flush(true)
|
957
|
957
|
}
|
958
|
958
|
}
|
|
@@ -1035,7 +1035,7 @@ func (channel *Channel) Part(client *Client, message string, rb *ResponseBuffer)
|
1035
|
1035
|
client.server.logger.Debug("channels", fmt.Sprintf("%s left channel %s", details.nick, chname))
|
1036
|
1036
|
}
|
1037
|
1037
|
|
1038
|
|
-func (channel *Channel) replayHistoryItems(rb *ResponseBuffer, items []history.Item, autoreplay bool) {
|
|
1038
|
+func (channel *Channel) replayHistoryItems(rb *ResponseBuffer, items []history.Item, chathistoryCommand bool) {
|
1039
|
1039
|
// send an empty batch if necessary, as per the CHATHISTORY spec
|
1040
|
1040
|
chname := channel.Name()
|
1041
|
1041
|
client := rb.target
|
|
@@ -1043,13 +1043,15 @@ func (channel *Channel) replayHistoryItems(rb *ResponseBuffer, items []history.I
|
1043
|
1043
|
extendedJoin := rb.session.capabilities.Has(caps.ExtendedJoin)
|
1044
|
1044
|
var playJoinsAsPrivmsg bool
|
1045
|
1045
|
if !eventPlayback {
|
1046
|
|
- switch client.AccountSettings().ReplayJoins {
|
1047
|
|
- case ReplayJoinsCommandsOnly:
|
1048
|
|
- playJoinsAsPrivmsg = !autoreplay
|
1049
|
|
- case ReplayJoinsAlways:
|
|
1046
|
+ if chathistoryCommand {
|
1050
|
1047
|
playJoinsAsPrivmsg = true
|
1051
|
|
- case ReplayJoinsNever:
|
1052
|
|
- playJoinsAsPrivmsg = false
|
|
1048
|
+ } else {
|
|
1049
|
+ switch client.AccountSettings().ReplayJoins {
|
|
1050
|
+ case ReplayJoinsCommandsOnly:
|
|
1051
|
+ playJoinsAsPrivmsg = false
|
|
1052
|
+ case ReplayJoinsAlways:
|
|
1053
|
+ playJoinsAsPrivmsg = true
|
|
1054
|
+ }
|
1053
|
1055
|
}
|
1054
|
1056
|
}
|
1055
|
1057
|
|
|
@@ -1066,6 +1068,9 @@ func (channel *Channel) replayHistoryItems(rb *ResponseBuffer, items []history.I
|
1066
|
1068
|
case history.Tagmsg:
|
1067
|
1069
|
if eventPlayback {
|
1068
|
1070
|
rb.AddSplitMessageFromClient(item.Nick, item.AccountName, item.IsBot, item.Tags, "TAGMSG", chname, item.Message)
|
|
1071
|
+ } else if chathistoryCommand {
|
|
1072
|
+ // #1676, we have to send something here or else it breaks pagination
|
|
1073
|
+ rb.AddFromClient(item.Message.Time, history.HistservMungeMsgid(item.Message.Msgid), histservService.prefix, "*", false, nil, "PRIVMSG", chname, fmt.Sprintf(client.t("%s sent a TAGMSG"), nick))
|
1069
|
1074
|
}
|
1070
|
1075
|
case history.Join:
|
1071
|
1076
|
if eventPlayback {
|
|
@@ -1084,7 +1089,7 @@ func (channel *Channel) replayHistoryItems(rb *ResponseBuffer, items []history.I
|
1084
|
1089
|
} else {
|
1085
|
1090
|
message = fmt.Sprintf(client.t("%[1]s [account: %[2]s] joined the channel"), nick, item.AccountName)
|
1086
|
1091
|
}
|
1087
|
|
- rb.AddFromClient(item.Message.Time, utils.MungeSecretToken(item.Message.Msgid), histservService.prefix, "*", false, nil, "PRIVMSG", chname, message)
|
|
1092
|
+ rb.AddFromClient(item.Message.Time, history.HistservMungeMsgid(item.Message.Msgid), histservService.prefix, "*", false, nil, "PRIVMSG", chname, message)
|
1088
|
1093
|
}
|
1089
|
1094
|
case history.Part:
|
1090
|
1095
|
if eventPlayback {
|
|
@@ -1094,14 +1099,14 @@ func (channel *Channel) replayHistoryItems(rb *ResponseBuffer, items []history.I
|
1094
|
1099
|
continue // #474
|
1095
|
1100
|
}
|
1096
|
1101
|
message := fmt.Sprintf(client.t("%[1]s left the channel (%[2]s)"), nick, item.Message.Message)
|
1097
|
|
- rb.AddFromClient(item.Message.Time, utils.MungeSecretToken(item.Message.Msgid), histservService.prefix, "*", false, nil, "PRIVMSG", chname, message)
|
|
1102
|
+ rb.AddFromClient(item.Message.Time, history.HistservMungeMsgid(item.Message.Msgid), histservService.prefix, "*", false, nil, "PRIVMSG", chname, message)
|
1098
|
1103
|
}
|
1099
|
1104
|
case history.Kick:
|
1100
|
1105
|
if eventPlayback {
|
1101
|
1106
|
rb.AddFromClient(item.Message.Time, item.Message.Msgid, item.Nick, item.AccountName, item.IsBot, nil, "KICK", chname, item.Params[0], item.Message.Message)
|
1102
|
1107
|
} else {
|
1103
|
1108
|
message := fmt.Sprintf(client.t("%[1]s kicked %[2]s (%[3]s)"), nick, item.Params[0], item.Message.Message)
|
1104
|
|
- rb.AddFromClient(item.Message.Time, utils.MungeSecretToken(item.Message.Msgid), histservService.prefix, "*", false, nil, "PRIVMSG", chname, message)
|
|
1109
|
+ rb.AddFromClient(item.Message.Time, history.HistservMungeMsgid(item.Message.Msgid), histservService.prefix, "*", false, nil, "PRIVMSG", chname, message)
|
1105
|
1110
|
}
|
1106
|
1111
|
case history.Quit:
|
1107
|
1112
|
if eventPlayback {
|
|
@@ -1111,21 +1116,21 @@ func (channel *Channel) replayHistoryItems(rb *ResponseBuffer, items []history.I
|
1111
|
1116
|
continue // #474
|
1112
|
1117
|
}
|
1113
|
1118
|
message := fmt.Sprintf(client.t("%[1]s quit (%[2]s)"), nick, item.Message.Message)
|
1114
|
|
- rb.AddFromClient(item.Message.Time, utils.MungeSecretToken(item.Message.Msgid), histservService.prefix, "*", false, nil, "PRIVMSG", chname, message)
|
|
1119
|
+ rb.AddFromClient(item.Message.Time, history.HistservMungeMsgid(item.Message.Msgid), histservService.prefix, "*", false, nil, "PRIVMSG", chname, message)
|
1115
|
1120
|
}
|
1116
|
1121
|
case history.Nick:
|
1117
|
1122
|
if eventPlayback {
|
1118
|
1123
|
rb.AddFromClient(item.Message.Time, item.Message.Msgid, item.Nick, item.AccountName, item.IsBot, nil, "NICK", item.Params[0])
|
1119
|
1124
|
} else {
|
1120
|
1125
|
message := fmt.Sprintf(client.t("%[1]s changed nick to %[2]s"), nick, item.Params[0])
|
1121
|
|
- rb.AddFromClient(item.Message.Time, utils.MungeSecretToken(item.Message.Msgid), histservService.prefix, "*", false, nil, "PRIVMSG", chname, message)
|
|
1126
|
+ rb.AddFromClient(item.Message.Time, history.HistservMungeMsgid(item.Message.Msgid), histservService.prefix, "*", false, nil, "PRIVMSG", chname, message)
|
1122
|
1127
|
}
|
1123
|
1128
|
case history.Topic:
|
1124
|
1129
|
if eventPlayback {
|
1125
|
1130
|
rb.AddFromClient(item.Message.Time, item.Message.Msgid, item.Nick, item.AccountName, item.IsBot, nil, "TOPIC", chname, item.Message.Message)
|
1126
|
1131
|
} else {
|
1127
|
1132
|
message := fmt.Sprintf(client.t("%[1]s set the channel topic to: %[2]s"), nick, item.Message.Message)
|
1128
|
|
- rb.AddFromClient(item.Message.Time, utils.MungeSecretToken(item.Message.Msgid), histservService.prefix, "*", false, nil, "PRIVMSG", chname, message)
|
|
1133
|
+ rb.AddFromClient(item.Message.Time, history.HistservMungeMsgid(item.Message.Msgid), histservService.prefix, "*", false, nil, "PRIVMSG", chname, message)
|
1129
|
1134
|
}
|
1130
|
1135
|
case history.Mode:
|
1131
|
1136
|
params := make([]string, len(item.Message.Split)+1)
|
|
@@ -1137,7 +1142,7 @@ func (channel *Channel) replayHistoryItems(rb *ResponseBuffer, items []history.I
|
1137
|
1142
|
rb.AddFromClient(item.Message.Time, item.Message.Msgid, item.Nick, item.AccountName, item.IsBot, nil, "MODE", params...)
|
1138
|
1143
|
} else {
|
1139
|
1144
|
message := fmt.Sprintf(client.t("%[1]s set channel modes: %[2]s"), nick, strings.Join(params[1:], " "))
|
1140
|
|
- rb.AddFromClient(item.Message.Time, utils.MungeSecretToken(item.Message.Msgid), histservService.prefix, "*", false, nil, "PRIVMSG", chname, message)
|
|
1145
|
+ rb.AddFromClient(item.Message.Time, history.HistservMungeMsgid(item.Message.Msgid), histservService.prefix, "*", false, nil, "PRIVMSG", chname, message)
|
1141
|
1146
|
}
|
1142
|
1147
|
}
|
1143
|
1148
|
}
|