|
@@ -1070,6 +1070,25 @@ func (channel *Channel) replayHistoryItems(rb *ResponseBuffer, items []history.I
|
1070
|
1070
|
message := fmt.Sprintf(client.t("%[1]s changed nick to %[2]s"), nick, item.Params[0])
|
1071
|
1071
|
rb.AddFromClient(item.Message.Time, utils.MungeSecretToken(item.Message.Msgid), histServMask, "*", nil, "PRIVMSG", chname, message)
|
1072
|
1072
|
}
|
|
1073
|
+ case history.Topic:
|
|
1074
|
+ if eventPlayback {
|
|
1075
|
+ rb.AddFromClient(item.Message.Time, item.Message.Msgid, item.Nick, item.AccountName, nil, "TOPIC", chname, item.Message.Message)
|
|
1076
|
+ } else {
|
|
1077
|
+ message := fmt.Sprintf(client.t("%[1]s set the channel topic to: %[2]s"), nick, item.Message.Message)
|
|
1078
|
+ rb.AddFromClient(item.Message.Time, utils.MungeSecretToken(item.Message.Msgid), histServMask, "*", nil, "PRIVMSG", chname, message)
|
|
1079
|
+ }
|
|
1080
|
+ case history.Mode:
|
|
1081
|
+ params := make([]string, len(item.Message.Split)+1)
|
|
1082
|
+ params[0] = chname
|
|
1083
|
+ for i, pair := range item.Message.Split {
|
|
1084
|
+ params[i+1] = pair.Message
|
|
1085
|
+ }
|
|
1086
|
+ if eventPlayback {
|
|
1087
|
+ rb.AddFromClient(item.Message.Time, item.Message.Msgid, item.Nick, item.AccountName, nil, "MODE", params...)
|
|
1088
|
+ } else {
|
|
1089
|
+ message := fmt.Sprintf(client.t("%[1]s set channel modes: %[2]s"), nick, strings.Join(params[1:], " "))
|
|
1090
|
+ rb.AddFromClient(item.Message.Time, utils.MungeSecretToken(item.Message.Msgid), histServMask, "*", nil, "PRIVMSG", chname, message)
|
|
1091
|
+ }
|
1073
|
1092
|
}
|
1074
|
1093
|
}
|
1075
|
1094
|
}
|
|
@@ -1119,22 +1138,30 @@ func (channel *Channel) SetTopic(client *Client, topic string, rb *ResponseBuffe
|
1119
|
1138
|
}
|
1120
|
1139
|
|
1121
|
1140
|
channel.stateMutex.Lock()
|
|
1141
|
+ chname := channel.name
|
1122
|
1142
|
channel.topic = topic
|
1123
|
1143
|
channel.topicSetBy = client.nickMaskString
|
1124
|
1144
|
channel.topicSetTime = time.Now().UTC()
|
1125
|
1145
|
channel.stateMutex.Unlock()
|
1126
|
1146
|
|
1127
|
|
- prefix := client.NickMaskString()
|
|
1147
|
+ details := client.Details()
|
|
1148
|
+ message := utils.MakeMessage(topic)
|
|
1149
|
+ rb.AddFromClient(message.Time, message.Msgid, details.nickMask, details.accountName, nil, "TOPIC", chname, topic)
|
1128
|
1150
|
for _, member := range channel.Members() {
|
1129
|
1151
|
for _, session := range member.Sessions() {
|
1130
|
|
- if session == rb.session {
|
1131
|
|
- rb.Add(nil, prefix, "TOPIC", channel.name, topic)
|
1132
|
|
- } else {
|
1133
|
|
- session.Send(nil, prefix, "TOPIC", channel.name, topic)
|
|
1152
|
+ if session != rb.session {
|
|
1153
|
+ session.sendFromClientInternal(false, message.Time, message.Msgid, details.nickMask, details.accountName, nil, "TOPIC", chname, topic)
|
1134
|
1154
|
}
|
1135
|
1155
|
}
|
1136
|
1156
|
}
|
1137
|
1157
|
|
|
1158
|
+ channel.AddHistoryItem(history.Item{
|
|
1159
|
+ Type: history.Topic,
|
|
1160
|
+ Nick: details.nickMask,
|
|
1161
|
+ AccountName: details.accountName,
|
|
1162
|
+ Message: message,
|
|
1163
|
+ })
|
|
1164
|
+
|
1138
|
1165
|
channel.MarkDirty(IncludeTopic)
|
1139
|
1166
|
}
|
1140
|
1167
|
|