From 85f13e35d40cd728ed3f98efb424a436b2b8bc72 Mon Sep 17 00:00:00 2001 From: rsuen Date: Sun, 10 Feb 2008 21:59:11 +0000 Subject: Reverting the message handling code so that commands with arguments will work properly. --- .../bot/kosmos/ChatRoomMessageHandler.java | 48 +++++++++++++--------- 1 file changed, 28 insertions(+), 20 deletions(-) (limited to 'applications/kosmos/bundles/org.eclipse.ecf.presence.bot.kosmos/src/org/eclipse/ecf/internal/presence/bot') 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 9e73c8d14..bd5efcb61 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 @@ -782,26 +782,34 @@ public class ChatRoomMessageHandler implements IChatRoomMessageHandler { } String msg = message.getMessage(); - 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++) { - if (split[i].length() > 0) { - switch (split[i].charAt(0)) { - case '~': - case '!': - handleMessage(fromID, message - .getChatRoomID(), split[i].substring(1).trim()); - break; + switch (msg.charAt(0)) { + case '~': + case '!': + 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++) { + if (split[i].length() > 0) { + switch (split[i].charAt(0)) { + case '~': + case '!': + handleMessage(fromID, message + .getChatRoomID(), split[i].substring(1).trim()); + break; + } } } } -- cgit v1.2.3