Parcourir la source

Further irccookie work

Auto-rejoin if kicked
Don't spam snippet tests
master
Chris Smith il y a 15 ans
Parent
révision
232eaed105
1 fichiers modifiés avec 12 ajouts et 2 suppressions
  1. 12
    2
      src/com/md87/charliebravo/InputHandler.java

+ 12
- 2
src/com/md87/charliebravo/InputHandler.java Voir le fichier

@@ -9,6 +9,7 @@ import com.dmdirc.parser.irc.ChannelClientInfo;
9 9
 import com.dmdirc.parser.irc.ChannelInfo;
10 10
 import com.dmdirc.parser.irc.ClientInfo;
11 11
 import com.dmdirc.parser.irc.IRCParser;
12
+import com.dmdirc.parser.irc.callbacks.interfaces.IChannelKick;
12 13
 import com.dmdirc.parser.irc.callbacks.interfaces.IChannelMessage;
13 14
 import com.dmdirc.parser.irc.callbacks.interfaces.IPrivateCTCP;
14 15
 import com.dmdirc.parser.irc.callbacks.interfaces.IPrivateMessage;
@@ -42,7 +43,7 @@ import net.miginfocom.Base64;
42 43
  *
43 44
  * @author chris
44 45
  */
45
-public class InputHandler implements IChannelMessage, IPrivateMessage, IPrivateCTCP {
46
+public class InputHandler implements IChannelMessage, IPrivateMessage, IPrivateCTCP, IChannelKick {
46 47
 
47 48
     protected IRCParser parser;
48 49
 
@@ -99,6 +100,7 @@ public class InputHandler implements IChannelMessage, IPrivateMessage, IPrivateC
99 100
         parser.getCallbackManager().addCallback("OnChannelMessage", this);
100 101
         parser.getCallbackManager().addCallback("OnPrivateMessage", this);
101 102
         parser.getCallbackManager().addCallback("OnPrivateCTCP", this);
103
+        parser.getCallbackManager().addCallback("OnChannelKick", this);
102 104
     }
103 105
 
104 106
     public void onChannelMessage(final IRCParser tParser, final ChannelInfo cChannel,
@@ -120,7 +122,6 @@ public class InputHandler implements IChannelMessage, IPrivateMessage, IPrivateC
120 122
 
121 123
         for (Map.Entry<String, String> snippet : config.getConfigfile()
122 124
                 .getKeyDomain("snippets").entrySet()) {
123
-            System.out.println("Snippet test: " + snippet.getKey());
124 125
             if (sMessage.matches(snippet.getKey())) {
125 126
                 if (!snippets.containsKey(cChannel.getName())) {
126 127
                     snippets.put(cChannel.getName(), new RollingList<String>(10));
@@ -183,6 +184,7 @@ public class InputHandler implements IChannelMessage, IPrivateMessage, IPrivateC
183 184
 
184 185
                 if (idp.equals(info)) {
185 186
                     client.getMap().put("OpenID", idp);
187
+                    parser.sendNotice(client.getNickname(), "You are now authenticated as " + idp);
186 188
                 }
187 189
             }
188 190
         }
@@ -288,6 +290,14 @@ public class InputHandler implements IChannelMessage, IPrivateMessage, IPrivateC
288 290
         }
289 291
     }
290 292
 
293
+    public void onChannelKick(IRCParser tParser, ChannelInfo cChannel,
294
+            ChannelClientInfo cKickedClient, ChannelClientInfo cKickedByClient,
295
+            String sReason, String sKickedByHost) {
296
+        if (cKickedClient.getClient().equals(parser.getMyself())) {
297
+            tParser.joinChannel(cChannel.getName());
298
+        }
299
+    }
300
+
291 301
     protected static class LevelErrorFollowup implements Followup {
292 302
 
293 303
         private final String source;

Chargement…
Annuler
Enregistrer