Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrsuen2008-01-18 16:12:59 -0500
committerrsuen2008-01-18 16:12:59 -0500
commit6c6b9be8087499b576ce32052f70266fffd62224 (patch)
tree7efdcea7da0512e8a9ccb935c941e27ff3bf1743 /applications/kosmos/bundles/org.eclipse.ecf.presence.bot.kosmos/src/org/eclipse/ecf/internal/presence/bot/kosmos
parent3c80c293fce8b89801c175659c491c693104c953 (diff)
downloadorg.eclipse.ecf-6c6b9be8087499b576ce32052f70266fffd62224.tar.gz
org.eclipse.ecf-6c6b9be8087499b576ce32052f70266fffd62224.tar.xz
org.eclipse.ecf-6c6b9be8087499b576ce32052f70266fffd62224.zip
Let KOS-MOS catch embedded messages.
Diffstat (limited to 'applications/kosmos/bundles/org.eclipse.ecf.presence.bot.kosmos/src/org/eclipse/ecf/internal/presence/bot/kosmos')
-rw-r--r--applications/kosmos/bundles/org.eclipse.ecf.presence.bot.kosmos/src/org/eclipse/ecf/internal/presence/bot/kosmos/ChatRoomMessageHandler.java31
1 files changed, 30 insertions, 1 deletions
diff --git a/applications/kosmos/bundles/org.eclipse.ecf.presence.bot.kosmos/src/org/eclipse/ecf/internal/presence/bot/kosmos/ChatRoomMessageHandler.java b/applications/kosmos/bundles/org.eclipse.ecf.presence.bot.kosmos/src/org/eclipse/ecf/internal/presence/bot/kosmos/ChatRoomMessageHandler.java
index 865aab6fd..a8ac82768 100644
--- a/applications/kosmos/bundles/org.eclipse.ecf.presence.bot.kosmos/src/org/eclipse/ecf/internal/presence/bot/kosmos/ChatRoomMessageHandler.java
+++ b/applications/kosmos/bundles/org.eclipse.ecf.presence.bot.kosmos/src/org/eclipse/ecf/internal/presence/bot/kosmos/ChatRoomMessageHandler.java
@@ -687,13 +687,42 @@ public class ChatRoomMessageHandler implements IChatRoomMessageHandler {
}
public void handleRoomMessage(IChatRoomMessage message) {
+ ID fromID = message.getFromID();
+ if (fromID.getName().equals("KOS-MOS")) {
+ return;
+ }
+
String msg = message.getMessage();
switch (msg.charAt(0)) {
case '~':
case '!':
- handleMessage(message.getFromID(), message.getChatRoomID(), msg
+ handleMessage(fromID, message.getChatRoomID(), msg
.substring(1).trim());
break;
+ default:
+ String upperCase = msg.toUpperCase();
+ if (upperCase.startsWith("KOS-MOS:") || upperCase.startsWith("KOS-MOS,")) {
+ msg = upperCase.substring(8).trim();
+ switch (msg.charAt(0)) {
+ case '~':
+ case '!':
+ handleMessage(fromID, message.getChatRoomID(), msg
+ .substring(1).trim());
+ break;
+ }
+ } else {
+ String[] split = msg.split("\\s"); //$NON-NLS-1$
+ for (int i = 0; i < split.length; i++) {
+ switch (split[i].charAt(0)) {
+ case '~':
+ case '!':
+ handleMessage(fromID, message
+ .getChatRoomID(), split[i].substring(1).trim());
+ break;
+ }
+ }
+ }
+ break;
}
}

Back to the top