Browse code

nicer prefix for tribune posts

devnewton authored on 02/09/2014 08:23:55
Showing 2 changed files
... ...
@@ -48,7 +48,7 @@ public class Replopbot {
48 48
                         Message in = ex.getIn();
49 49
                         String sender = ObjectUtils.toString(in.getHeader(XmppConstants.FROM));
50 50
                         if (!sender.isEmpty()) {
51
-                            in.setHeader(TribuneConstants.SENDER, config.getNickname() + "/" + sender);
51
+                            in.setHeader(TribuneConstants.SENDER, config.getTribune().getNicknamePrefix() + sender);
52 52
                         }
53 53
                     }
54 54
                 }).to(tribuneEndPoint).process(new Processor() {
... ...
@@ -93,7 +93,7 @@ public class Replopbot {
93 93
                         Message in = ex.getIn();
94 94
                         String sender = ObjectUtils.toString(in.getHeader(IrcConstants.IRC_USER_NICK));
95 95
                         if (!sender.isEmpty()) {
96
-                            in.setHeader(TribuneConstants.SENDER, config.getNickname() + "/" + sender);
96
+                            in.setHeader(TribuneConstants.SENDER, config.getTribune().getNicknamePrefix() + sender);
97 97
                         }
98 98
                     }
99 99
                 }).to(tribuneEndPoint).process(new Processor() {
... ...
@@ -120,6 +120,9 @@ public class Replopbot {
120 120
                         if (StringUtils.contains(sender, config.getNickname())) {
121 121
                             return false;
122 122
                         }
123
+                        if (StringUtils.startsWith(sender, config.getTribune().getNicknamePrefix())) {
124
+                            return false;
125
+                        }
123 126
                         if (StringUtils.isBlank(sender)) { // probably some
124 127
                             // douchebag moules
125 128
                             return false;
... ...
@@ -2,8 +2,9 @@ package im.bci.replopbot.conf;
2 2
 
3 3
 public class ReplopbotTribuneConfiguration {
4 4
 
5
-    private String getUrl = "http://devnewton.bci.im/fr/chat/xml";
6
-    private String postUrl = "http://devnewton.bci.im/fr/chat/post";
5
+    private String getUrl;
6
+    private String postUrl;
7
+    private String nicknamePrefix;
7 8
 
8 9
     public String getGetUrl() {
9 10
         return getUrl;
... ...
@@ -21,5 +22,13 @@ public class ReplopbotTribuneConfiguration {
21 22
         this.postUrl = postUrl;
22 23
     }
23 24
 
25
+    public String getNicknamePrefix() {
26
+        return nicknamePrefix;
27
+    }
28
+
29
+    public void setNicknamePrefix(String nicknamePrefix) {
30
+        this.nicknamePrefix = nicknamePrefix;
31
+    }
32
+
24 33
    
25 34
 }