Browse code

ignore useless irc messages

devnewton authored on 02/09/2014 07:21:31
Showing 2 changed files
... ...
@@ -3,4 +3,5 @@
3 3
 /.settings/org.eclipse.m2e.core.prefs
4 4
 /.project
5 5
 /.settings/org.eclipse.jdt.core.prefs
6
-/replopbot.conf
7 6
\ No newline at end of file
7
+/replopbot.conf
8
+/target
... ...
@@ -17,7 +17,6 @@ import org.apache.commons.lang.ObjectUtils;
17 17
 import org.apache.commons.lang.StringUtils;
18 18
 import org.codehaus.jackson.map.DeserializationConfig;
19 19
 import org.codehaus.jackson.map.ObjectMapper;
20
-import org.codehaus.jackson.map.SerializationConfig;
21 20
 
22 21
 public class Replopbot {
23 22
 
... ...
@@ -73,6 +72,9 @@ public class Replopbot {
73 72
                 from(ircEndPoint).filter(new Predicate() {
74 73
 
75 74
                     public boolean matches(Exchange ex) {
75
+                        if(!"PRIVMSG".equals(ObjectUtils.toString(ex.getIn().getHeader(IrcConstants.IRC_MESSAGE_TYPE)))) {
76
+                            return false;
77
+                        }
76 78
                         String sender = ObjectUtils.toString(ex.getIn().getHeader(IrcConstants.IRC_USER_NICK));
77 79
                         if (StringUtils.equals(sender, "ChanServ")) {
78 80
                             return false;
... ...
@@ -80,6 +82,9 @@ public class Replopbot {
80 82
                         if (StringUtils.contains(sender, config.getNickname())) {
81 83
                             return false;
82 84
                         }
85
+                        if (StringUtils.contains(ObjectUtils.toString(ex.getIn().getHeader(IrcConstants.IRC_TARGET)), config.getNickname())) {
86
+                            return false;
87
+                        }
83 88
                         return true;
84 89
                     }
85 90
                 }).process(new Processor() {