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
 
22
 
23
 package com.dmdirc.addons.awaycolours;
23
 package com.dmdirc.addons.awaycolours;
24
 
24
 
25
-import com.dmdirc.ChannelClientProperty;
26
 import com.dmdirc.ClientModule.GlobalConfig;
25
 import com.dmdirc.ClientModule.GlobalConfig;
27
 import com.dmdirc.DMDircMBassador;
26
 import com.dmdirc.DMDircMBassador;
28
 import com.dmdirc.config.ConfigBinder;
27
 import com.dmdirc.config.ConfigBinder;
29
 import com.dmdirc.config.ConfigBinding;
28
 import com.dmdirc.config.ConfigBinding;
30
 import com.dmdirc.events.ChannelUserAwayEvent;
29
 import com.dmdirc.events.ChannelUserAwayEvent;
31
 import com.dmdirc.events.ChannelUserBackEvent;
30
 import com.dmdirc.events.ChannelUserBackEvent;
31
+import com.dmdirc.events.DisplayProperty;
32
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
32
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
33
 import com.dmdirc.plugins.PluginDomain;
33
 import com.dmdirc.plugins.PluginDomain;
34
 import com.dmdirc.ui.messages.ColourManager;
34
 import com.dmdirc.ui.messages.ColourManager;
87
 
87
 
88
     @Handler
88
     @Handler
89
     public void handleAwayEvent(final ChannelUserAwayEvent event) {
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
         if (nicklist || text) {
91
         if (nicklist || text) {
97
             event.getChannel().refreshClients();
92
             event.getChannel().refreshClients();
98
         }
93
         }
100
 
95
 
101
     @Handler
96
     @Handler
102
     public void handleBackEvent(final ChannelUserBackEvent event) {
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
         if (nicklist || text) {
99
         if (nicklist || text) {
110
             event.getChannel().refreshClients();
100
             event.getChannel().refreshClients();
111
         }
101
         }

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

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

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

45
 import com.dmdirc.events.QueryClosedEvent;
45
 import com.dmdirc.events.QueryClosedEvent;
46
 import com.dmdirc.events.QueryOpenedEvent;
46
 import com.dmdirc.events.QueryOpenedEvent;
47
 import com.dmdirc.events.UserErrorEvent;
47
 import com.dmdirc.events.UserErrorEvent;
48
+import com.dmdirc.interfaces.GroupChatUser;
48
 import com.dmdirc.interfaces.PrivateChat;
49
 import com.dmdirc.interfaces.PrivateChat;
49
 import com.dmdirc.interfaces.User;
50
 import com.dmdirc.interfaces.User;
50
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
51
 import com.dmdirc.interfaces.config.AggregateConfigProvider;
548
         return getDisplayName(channelClient, "");
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
      * Get name to display for channelClient (Taking into account the channelmodeprefix setting).
564
      * Get name to display for channelClient (Taking into account the channelmodeprefix setting).
553
      *
565
      *
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
      * Shows the history window for the specified target, if available.
603
      * Shows the history window for the specified target, if available.
573
      *
604
      *

Loading…
Cancel
Save