|
@@ -51,10 +51,6 @@ import com.dmdirc.interfaces.User;
|
51
|
51
|
import com.dmdirc.interfaces.config.AggregateConfigProvider;
|
52
|
52
|
import com.dmdirc.interfaces.config.ConfigChangeListener;
|
53
|
53
|
import com.dmdirc.logger.ErrorLevel;
|
54
|
|
-import com.dmdirc.parser.interfaces.ChannelClientInfo;
|
55
|
|
-import com.dmdirc.parser.interfaces.ChannelInfo;
|
56
|
|
-import com.dmdirc.parser.interfaces.ClientInfo;
|
57
|
|
-import com.dmdirc.parser.interfaces.Parser;
|
58
|
54
|
import com.dmdirc.plugins.PluginDomain;
|
59
|
55
|
import com.dmdirc.ui.WindowManager;
|
60
|
56
|
import com.dmdirc.ui.messages.BackBufferFactory;
|
|
@@ -270,45 +266,43 @@ public class LoggingManager implements ConfigChangeListener {
|
270
|
266
|
@Handler
|
271
|
267
|
public void handleChannelGotTopic(final ChannelGottopicEvent event) {
|
272
|
268
|
final String filename = locator.getLogFile(event.getChannel().getChannelInfo());
|
273
|
|
- final ChannelInfo channel = event.getChannel().getChannelInfo();
|
274
|
269
|
final DateFormat timeFormat = new SimpleDateFormat("HH:mm:ss");
|
275
|
270
|
final DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
|
276
|
271
|
|
277
|
|
- appendLine(filename, "*** Topic is: %s", channel.getTopic());
|
278
|
|
- appendLine(filename, "*** Set at: %s on %s by %s", timeFormat.format(1000 * channel.
|
279
|
|
- getTopicTime()), dateFormat.format(1000 * channel.getTopicTime()), channel.
|
280
|
|
- getTopicSetter());
|
|
272
|
+ appendLine(filename, "*** Topic is: %s", event.getTopic().getTopic());
|
|
273
|
+ appendLine(filename, "*** Set at: %s on %s by %s",
|
|
274
|
+ timeFormat.format(1000 * event.getTopic().getTime()),
|
|
275
|
+ dateFormat.format(1000 * event.getTopic().getTime()),
|
|
276
|
+ event.getTopic().getClient()
|
|
277
|
+ .map(GroupChatUser::getNickname).orElse("Unknown"));
|
281
|
278
|
}
|
282
|
279
|
|
283
|
280
|
@Handler
|
284
|
281
|
public void handleChannelTopicChange(final ChannelTopicChangeEvent event) {
|
285
|
282
|
final String filename = locator.getLogFile(event.getChannel().getChannelInfo());
|
286
|
|
- final GroupChatUser channelClient = event.getTopic().getClient();
|
287
|
283
|
appendLine(filename, "*** %s Changed the topic to: %s",
|
288
|
|
- getDisplayName(channelClient), event.getTopic());
|
|
284
|
+ event.getTopic().getClient().map(this::getDisplayName).orElse(""), event.getTopic());
|
289
|
285
|
}
|
290
|
286
|
|
291
|
287
|
@Handler
|
292
|
288
|
public void handleChannelJoin(final ChannelJoinEvent event) {
|
293
|
289
|
final String filename = locator.getLogFile(event.getChannel().getChannelInfo());
|
294
|
|
- final ChannelClientInfo channelClient = event.getClient();
|
295
|
|
- final ClientInfo client = channelClient.getClient();
|
296
|
|
- appendLine(filename, "*** %s (%s) joined the channel",
|
297
|
|
- getDisplayName(channelClient), client.toString());
|
|
290
|
+ final GroupChatUser channelClient = event.getClient();
|
|
291
|
+ appendLine(filename, "*** %s (%s) joined the channel", getDisplayName(channelClient),
|
|
292
|
+ channelClient.getNickname());
|
298
|
293
|
}
|
299
|
294
|
|
300
|
295
|
@Handler
|
301
|
296
|
public void handleChannelPart(final ChannelPartEvent event) {
|
302
|
297
|
final String filename = locator.getLogFile(event.getChannel().getChannelInfo());
|
303
|
298
|
final String message = event.getMessage();
|
304
|
|
- final ChannelClientInfo channelClient = event.getClient();
|
305
|
|
- final ClientInfo client = channelClient.getClient();
|
|
299
|
+ final GroupChatUser channelClient = event.getClient();
|
306
|
300
|
if (message.isEmpty()) {
|
307
|
|
- appendLine(filename, "*** %s (%s) left the channel",
|
308
|
|
- getDisplayName(channelClient), client.toString());
|
|
301
|
+ appendLine(filename, "*** %s (%s) left the channel", getDisplayName(channelClient),
|
|
302
|
+ channelClient.getNickname());
|
309
|
303
|
} else {
|
310
|
304
|
appendLine(filename, "*** %s (%s) left the channel (%s)",
|
311
|
|
- getDisplayName(channelClient), client.toString(), message);
|
|
305
|
+ getDisplayName(channelClient), channelClient.getNickname(), message);
|
312
|
306
|
}
|
313
|
307
|
}
|
314
|
308
|
|
|
@@ -316,21 +310,20 @@ public class LoggingManager implements ConfigChangeListener {
|
316
|
310
|
public void handleChannelQuit(final ChannelQuitEvent event) {
|
317
|
311
|
final String filename = locator.getLogFile(event.getChannel().getChannelInfo());
|
318
|
312
|
final String reason = event.getMessage();
|
319
|
|
- final ChannelClientInfo channelClient = event.getClient();
|
320
|
|
- final ClientInfo client = channelClient.getClient();
|
|
313
|
+ final GroupChatUser channelClient = event.getClient();
|
321
|
314
|
if (reason.isEmpty()) {
|
322
|
315
|
appendLine(filename, "*** %s (%s) Quit IRC",
|
323
|
|
- getDisplayName(channelClient), client.toString());
|
|
316
|
+ getDisplayName(channelClient), channelClient.getNickname());
|
324
|
317
|
} else {
|
325
|
318
|
appendLine(filename, "*** %s (%s) Quit IRC (%s)",
|
326
|
|
- getDisplayName(channelClient), client.toString(), reason);
|
|
319
|
+ getDisplayName(channelClient), channelClient.getNickname(), reason);
|
327
|
320
|
}
|
328
|
321
|
}
|
329
|
322
|
|
330
|
323
|
@Handler
|
331
|
324
|
public void handleChannelKick(final ChannelKickEvent event) {
|
332
|
|
- final ChannelClientInfo victim = event.getVictim();
|
333
|
|
- final ChannelClientInfo perpetrator = event.getClient();
|
|
325
|
+ final GroupChatUser victim = event.getVictim();
|
|
326
|
+ final GroupChatUser perpetrator = event.getClient();
|
334
|
327
|
final String reason = event.getReason();
|
335
|
328
|
final String filename = locator.getLogFile(event.getChannel().getChannelInfo());
|
336
|
329
|
|
|
@@ -353,7 +346,7 @@ public class LoggingManager implements ConfigChangeListener {
|
353
|
346
|
@Handler
|
354
|
347
|
public void handleModeChange(final ChannelModechangeEvent event) {
|
355
|
348
|
final String filename = locator.getLogFile(event.getChannel().getChannelInfo());
|
356
|
|
- if (event.getClient().getClient().getNickname().isEmpty()) {
|
|
349
|
+ if (event.getClient().getNickname().isEmpty()) {
|
357
|
350
|
appendLine(filename, "*** Channel modes are: %s", event.getModes());
|
358
|
351
|
} else {
|
359
|
352
|
appendLine(filename, "*** %s set modes: %s",
|
|
@@ -538,17 +531,6 @@ public class LoggingManager implements ConfigChangeListener {
|
538
|
531
|
return false;
|
539
|
532
|
}
|
540
|
533
|
|
541
|
|
- /**
|
542
|
|
- * Get name to display for channelClient (Taking into account the channelmodeprefix setting).
|
543
|
|
- *
|
544
|
|
- * @param channelClient The client to get the display name for
|
545
|
|
- *
|
546
|
|
- * @return name to display
|
547
|
|
- */
|
548
|
|
- protected String getDisplayName(final ChannelClientInfo channelClient) {
|
549
|
|
- return getDisplayName(channelClient, "");
|
550
|
|
- }
|
551
|
|
-
|
552
|
534
|
/**
|
553
|
535
|
* Get name to display for channelClient (Taking into account the channelmodeprefix setting).
|
554
|
536
|
*
|
|
@@ -560,26 +542,6 @@ public class LoggingManager implements ConfigChangeListener {
|
560
|
542
|
return getDisplayName(channelClient, "");
|
561
|
543
|
}
|
562
|
544
|
|
563
|
|
- /**
|
564
|
|
- * Get name to display for channelClient (Taking into account the channelmodeprefix setting).
|
565
|
|
- *
|
566
|
|
- * @param channelClient The client to get the display name for
|
567
|
|
- * @param overrideNick Nickname to display instead of real nickname
|
568
|
|
- *
|
569
|
|
- * @return name to display
|
570
|
|
- */
|
571
|
|
- protected String getDisplayName(final ChannelClientInfo channelClient, final String overrideNick) {
|
572
|
|
- if (channelClient == null) {
|
573
|
|
- return overrideNick.isEmpty() ? "Unknown Client" : overrideNick;
|
574
|
|
- } else if (overrideNick.isEmpty()) {
|
575
|
|
- return channelmodeprefix ? channelClient.toString() : channelClient.getClient().
|
576
|
|
- getNickname();
|
577
|
|
- } else {
|
578
|
|
- return channelmodeprefix ? channelClient.getImportantModePrefix() + overrideNick
|
579
|
|
- : overrideNick;
|
580
|
|
- }
|
581
|
|
- }
|
582
|
|
-
|
583
|
545
|
/**
|
584
|
546
|
* Get name to display for channelClient (Taking into account the channelmodeprefix setting).
|
585
|
547
|
*
|
|
@@ -612,8 +574,7 @@ public class LoggingManager implements ConfigChangeListener {
|
612
|
574
|
if (target instanceof Channel) {
|
613
|
575
|
descriptor = target.getName();
|
614
|
576
|
} else if (target instanceof Query) {
|
615
|
|
- final Parser parser = target.getConnection().get().getParser().get();
|
616
|
|
- descriptor = parser.getClient(((PrivateChat) target).getHost()).getNickname();
|
|
577
|
+ descriptor = ((PrivateChat) target).getNickname();
|
617
|
578
|
} else {
|
618
|
579
|
// Unknown component
|
619
|
580
|
return false;
|