|
@@ -76,6 +76,7 @@ import com.google.common.base.Strings;
|
76
|
76
|
|
77
|
77
|
import java.util.Date;
|
78
|
78
|
import java.util.Optional;
|
|
79
|
+import java.util.stream.Collectors;
|
79
|
80
|
|
80
|
81
|
import javax.annotation.Nonnull;
|
81
|
82
|
|
|
@@ -148,7 +149,9 @@ public class ChannelEventHandler extends EventHandler implements
|
148
|
149
|
public void onChannelGotNames(final Parser parser, final Date date, final ChannelInfo channel) {
|
149
|
150
|
checkParser(parser);
|
150
|
151
|
|
151
|
|
- owner.setClients(channel.getChannelClients());
|
|
152
|
+ owner.setClients(channel.getChannelClients().stream()
|
|
153
|
+ .map(owner::getUserFromClient)
|
|
154
|
+ .collect(Collectors.toList()));
|
152
|
155
|
eventBus.publishAsync(new ChannelGotnamesEvent(owner));
|
153
|
156
|
}
|
154
|
157
|
|
|
@@ -192,9 +195,9 @@ public class ChannelEventHandler extends EventHandler implements
|
192
|
195
|
final Optional<Topic> currentTopic = owner.getCurrentTopic();
|
193
|
196
|
final boolean hasNewTopic = !Strings.isNullOrEmpty(channel.getTopic());
|
194
|
197
|
if (!isJoinTopic
|
195
|
|
- || (!currentTopic.isPresent() && hasNewTopic)
|
196
|
|
- || (currentTopic.isPresent() && !channel.getTopic().equals(
|
197
|
|
- owner.getCurrentTopic().get().getTopic()))) {
|
|
198
|
+ || !currentTopic.isPresent() && hasNewTopic
|
|
199
|
+ || currentTopic.isPresent() && !channel.getTopic().equals(
|
|
200
|
+ owner.getCurrentTopic().get().getTopic())) {
|
198
|
201
|
// Only add the topic if:
|
199
|
202
|
// - It's being set while we're in the channel (rather than discovered on join), or
|
200
|
203
|
// - We think the current topic is empty and are discovering a new one, or
|
|
@@ -211,7 +214,7 @@ public class ChannelEventHandler extends EventHandler implements
|
211
|
214
|
final ChannelJoinEvent event = new ChannelJoinEvent(owner, client);
|
212
|
215
|
final String format = EventUtils.postDisplayable(eventBus, event, "channelJoin");
|
213
|
216
|
owner.doNotification(date, format, client);
|
214
|
|
- owner.addClient(client);
|
|
217
|
+ owner.addClient(owner.getUserFromClient(client));
|
215
|
218
|
}
|
216
|
219
|
|
217
|
220
|
@Override
|
|
@@ -225,7 +228,7 @@ public class ChannelEventHandler extends EventHandler implements
|
225
|
228
|
+ (isMyself(client) ? "Self" : "") + "Part"
|
226
|
229
|
+ (reason.isEmpty() ? "" : "Reason"));
|
227
|
230
|
owner.doNotification(date, format, client, reason);
|
228
|
|
- owner.removeClient(client);
|
|
231
|
+ owner.removeClient(owner.getUserFromClient(client));
|
229
|
232
|
}
|
230
|
233
|
|
231
|
234
|
@Override
|
|
@@ -238,7 +241,7 @@ public class ChannelEventHandler extends EventHandler implements
|
238
|
241
|
final String format = EventUtils.postDisplayable(eventBus, event,
|
239
|
242
|
"channelKick" + (reason.isEmpty() ? "" : "Reason"));
|
240
|
243
|
owner.doNotification(date, format, client, kickedClient, reason);
|
241
|
|
- owner.removeClient(kickedClient);
|
|
244
|
+ owner.removeClient(owner.getUserFromClient(kickedClient));
|
242
|
245
|
}
|
243
|
246
|
|
244
|
247
|
@Override
|
|
@@ -250,7 +253,7 @@ public class ChannelEventHandler extends EventHandler implements
|
250
|
253
|
final String format = EventUtils.postDisplayable(eventBus, event,
|
251
|
254
|
"channelQuit" + (reason.isEmpty() ? "" : "Reason"));
|
252
|
255
|
owner.doNotification(date, format, client, reason);
|
253
|
|
- owner.removeClient(client);
|
|
256
|
+ owner.removeClient(owner.getUserFromClient(client));
|
254
|
257
|
}
|
255
|
258
|
|
256
|
259
|
@Override
|