Browse Source

Fixups for GroupChatUser.

pull/215/head
Greg Holmes 9 years ago
parent
commit
f5782b8b41

+ 3
- 13
awaycolours/src/com/dmdirc/addons/awaycolours/AwayColoursManager.java View File

@@ -22,13 +22,13 @@
22 22
 
23 23
 package com.dmdirc.addons.awaycolours;
24 24
 
25
-import com.dmdirc.ChannelClientProperty;
26 25
 import com.dmdirc.ClientModule.GlobalConfig;
27 26
 import com.dmdirc.DMDircMBassador;
28 27
 import com.dmdirc.config.ConfigBinder;
29 28
 import com.dmdirc.config.ConfigBinding;
30 29
 import com.dmdirc.events.ChannelUserAwayEvent;
31 30
 import com.dmdirc.events.ChannelUserBackEvent;
31
+import com.dmdirc.events.DisplayProperty;
32 32
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
33 33
 import com.dmdirc.plugins.PluginDomain;
34 34
 import com.dmdirc.ui.messages.ColourManager;
@@ -87,12 +87,7 @@ public class AwayColoursManager {
87 87
 
88 88
     @Handler
89 89
     public void handleAwayEvent(final ChannelUserAwayEvent event) {
90
-        if (nicklist) {
91
-            event.getUser().getMap().put(ChannelClientProperty.NICKLIST_FOREGROUND, colour);
92
-        }
93
-        if (text) {
94
-            event.getUser().getMap().put(ChannelClientProperty.TEXT_FOREGROUND, colour);
95
-        }
90
+        event.getUser().setDisplayProperty(DisplayProperty.FOREGROUND_COLOUR, colour);
96 91
         if (nicklist || text) {
97 92
             event.getChannel().refreshClients();
98 93
         }
@@ -100,12 +95,7 @@ public class AwayColoursManager {
100 95
 
101 96
     @Handler
102 97
     public void handleBackEvent(final ChannelUserBackEvent event) {
103
-        if (nicklist) {
104
-            event.getUser().getMap().remove(ChannelClientProperty.NICKLIST_FOREGROUND);
105
-        }
106
-        if (text) {
107
-            event.getUser().getMap().remove(ChannelClientProperty.TEXT_FOREGROUND);
108
-        }
98
+        event.getUser().setDisplayProperty(DisplayProperty.FOREGROUND_COLOUR, colour);
109 99
         if (nicklist || text) {
110 100
             event.getChannel().refreshClients();
111 101
         }

+ 2
- 2
contactlist/src/com/dmdirc/addons/contactlist/ContactListListener.java View File

@@ -80,12 +80,12 @@ public class ContactListListener {
80 80
 
81 81
     @Handler
82 82
     public void handleUserAway(final ChannelUserAwayEvent event) {
83
-        clientAdded(event.getUser());
83
+        //clientAdded(event.getUser());
84 84
     }
85 85
 
86 86
     @Handler
87 87
     public void handleUserBack(final ChannelUserBackEvent event) {
88
-        clientAdded(event.getUser());
88
+        //clientAdded(event.getUser());
89 89
     }
90 90
 
91 91
     @Handler

+ 31
- 0
logging/src/com/dmdirc/addons/logging/LoggingManager.java View File

@@ -45,6 +45,7 @@ import com.dmdirc.events.ChannelTopicChangeEvent;
45 45
 import com.dmdirc.events.QueryClosedEvent;
46 46
 import com.dmdirc.events.QueryOpenedEvent;
47 47
 import com.dmdirc.events.UserErrorEvent;
48
+import com.dmdirc.interfaces.GroupChatUser;
48 49
 import com.dmdirc.interfaces.PrivateChat;
49 50
 import com.dmdirc.interfaces.User;
50 51
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
@@ -548,6 +549,17 @@ public class LoggingManager implements ConfigChangeListener {
548 549
         return getDisplayName(channelClient, "");
549 550
     }
550 551
 
552
+    /**
553
+     * Get name to display for channelClient (Taking into account the channelmodeprefix setting).
554
+     *
555
+     * @param channelClient The client to get the display name for
556
+     *
557
+     * @return name to display
558
+     */
559
+    protected String getDisplayName(final GroupChatUser channelClient) {
560
+        return getDisplayName(channelClient, "");
561
+    }
562
+
551 563
     /**
552 564
      * Get name to display for channelClient (Taking into account the channelmodeprefix setting).
553 565
      *
@@ -568,6 +580,25 @@ public class LoggingManager implements ConfigChangeListener {
568 580
         }
569 581
     }
570 582
 
583
+    /**
584
+     * Get name to display for channelClient (Taking into account the channelmodeprefix setting).
585
+     *
586
+     * @param channelClient The client to get the display name for
587
+     * @param overrideNick  Nickname to display instead of real nickname
588
+     *
589
+     * @return name to display
590
+     */
591
+    protected String getDisplayName(final GroupChatUser channelClient, final String overrideNick) {
592
+        if (channelClient == null) {
593
+            return overrideNick.isEmpty() ? "Unknown Client" : overrideNick;
594
+        } else if (overrideNick.isEmpty()) {
595
+            return channelmodeprefix ? channelClient.toString() : channelClient.getNickname();
596
+        } else {
597
+            return channelmodeprefix ? channelClient.getImportantMode() + overrideNick :
598
+                    overrideNick;
599
+        }
600
+    }
601
+
571 602
     /**
572 603
      * Shows the history window for the specified target, if available.
573 604
      *

Loading…
Cancel
Save