Kaynağa Gözat

Handle GroupChatUser + User in processNotificationArg

pull/297/head
Greg Holmes 9 yıl önce
ebeveyn
işleme
df7046f37c

+ 15
- 3
src/com/dmdirc/Channel.java Dosyayı Görüntüle

@@ -449,7 +449,14 @@ public class Channel extends MessageTarget implements GroupChat {
449 449
 
450 450
     @Override
451 451
     protected boolean processNotificationArg(final Object arg, final List<Object> args) {
452
-        if (arg instanceof ClientInfo) {
452
+        if (arg instanceof User) {
453
+            final User clientInfo = (User) arg;
454
+            args.add(clientInfo.getNickname());
455
+            args.add(clientInfo.getUsername());
456
+            args.add(clientInfo.getHostname());
457
+
458
+            return true;
459
+        } else if (arg instanceof ClientInfo) {
453 460
             // Format ClientInfos
454 461
 
455 462
             final ClientInfo clientInfo = (ClientInfo) arg;
@@ -458,10 +465,15 @@ public class Channel extends MessageTarget implements GroupChat {
458 465
             args.add(clientInfo.getHostname());
459 466
 
460 467
             return true;
461
-        } else if (arg instanceof ChannelClientInfo) {
462
-            // Format ChannelClientInfos
468
+        } else if (arg instanceof GroupChatUser) {
469
+            final GroupChatUser clientInfo = (GroupChatUser) arg;
463 470
 
471
+            args.addAll(Arrays.asList(getDetails(clientInfo)));
472
+
473
+            return true;
474
+        } else if (arg instanceof ChannelClientInfo) {
464 475
             final GroupChatUser clientInfo = getUserFromClient((ChannelClientInfo) arg);
476
+
465 477
             args.addAll(Arrays.asList(getDetails(clientInfo)));
466 478
 
467 479
             return true;

+ 8
- 3
src/com/dmdirc/Query.java Dosyayı Görüntüle

@@ -127,7 +127,13 @@ public class Query extends MessageTarget implements PrivateActionListener,
127 127
 
128 128
     @Override
129 129
     protected boolean processNotificationArg(final Object arg, final List<Object> args) {
130
-        if (arg instanceof ClientInfo) {
130
+        if (arg instanceof User) {
131
+            final User clientInfo = (User) arg;
132
+            args.add(clientInfo.getNickname());
133
+            args.add(clientInfo.getUsername());
134
+            args.add(clientInfo.getHostname());
135
+            return true;
136
+        } else if (arg instanceof ClientInfo) {
131 137
             final ClientInfo clientInfo = (ClientInfo) arg;
132 138
             args.add(clientInfo.getNickname());
133 139
             args.add(clientInfo.getUsername());
@@ -151,7 +157,6 @@ public class Query extends MessageTarget implements PrivateActionListener,
151 157
             return;
152 158
         }
153 159
 
154
-        final ClientInfo client = server.getParser().get().getLocalClient();
155 160
         final int maxLineLength = server.getParser().get().getMaxLength("PRIVMSG", getHost());
156 161
 
157 162
         if (maxLineLength >= action.length() + 2) {
@@ -160,7 +165,7 @@ public class Query extends MessageTarget implements PrivateActionListener,
160 165
             final String format = EventUtils.postDisplayable(getEventBus(),
161 166
                     new QuerySelfActionEvent(this, server.getLocalUser(), action),
162 167
                     "querySelfAction");
163
-            doNotification(format, client, action);
168
+            doNotification(format, server.getLocalUser(), action);
164 169
         } else {
165 170
             addLine("actionTooLong", action.length());
166 171
         }

+ 7
- 1
src/com/dmdirc/Server.java Dosyayı Görüntüle

@@ -936,7 +936,13 @@ public class Server extends FrameContainer implements Connection {
936 936
 
937 937
     @Override
938 938
     protected boolean processNotificationArg(final Object arg, final List<Object> args) {
939
-        if (arg instanceof ClientInfo) {
939
+        if (arg instanceof User) {
940
+            final User clientInfo = (User) arg;
941
+            args.add(clientInfo.getNickname());
942
+            args.add(clientInfo.getUsername());
943
+            args.add(clientInfo.getHostname());
944
+            return true;
945
+        } else if (arg instanceof ClientInfo) {
940 946
             final ClientInfo clientInfo = (ClientInfo) arg;
941 947
             args.add(clientInfo.getNickname());
942 948
             args.add(clientInfo.getUsername());

Loading…
İptal
Kaydet