Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrsuen2009-07-29 12:44:28 -0400
committerrsuen2009-07-29 12:44:28 -0400
commiteb3d025314ad88259590c11218adf0330197a831 (patch)
treea483dd1caa9d5b9a4fa1f41e46a77f618c39e860 /applications/kosmos/bundles/org.eclipse.ecf.presence.bot.kosmos/src/org/eclipse/ecf/internal/presence
parent2483b8cf26c9d5dcf4f352a3130dcee92f201341 (diff)
downloadorg.eclipse.ecf-eb3d025314ad88259590c11218adf0330197a831.tar.gz
org.eclipse.ecf-eb3d025314ad88259590c11218adf0330197a831.tar.xz
org.eclipse.ecf-eb3d025314ad88259590c11218adf0330197a831.zip
Generalize the self-skipping mechanism.
Diffstat (limited to 'applications/kosmos/bundles/org.eclipse.ecf.presence.bot.kosmos/src/org/eclipse/ecf/internal/presence')
-rw-r--r--applications/kosmos/bundles/org.eclipse.ecf.presence.bot.kosmos/src/org/eclipse/ecf/internal/presence/bot/kosmos/ChatRoomMessageHandler.java16
1 files changed, 15 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 b6fb1af8b..d4b0f5ea6 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
@@ -56,6 +56,7 @@ import org.eclipse.ecf.presence.bot.IChatRoomMessageHandler;
import org.eclipse.ecf.presence.chatroom.IChatRoomContainer;
import org.eclipse.ecf.presence.chatroom.IChatRoomMessage;
import org.eclipse.ecf.presence.chatroom.IChatRoomMessageSender;
+import org.eclipse.ecf.presence.im.IChatID;
import org.eclipse.ecf.presence.im.IChatMessageEvent;
import org.eclipse.ecf.presence.im.IChatMessageSender;
import org.eclipse.osgi.util.NLS;
@@ -144,6 +145,11 @@ public class ChatRoomMessageHandler implements IChatRoomMessageHandler {
private IContainer container;
private IChatMessageSender chatMessageSender;
+
+ /**
+ * The name of this bot. May be <code>null</code> if the name could not be retrieved from the container.
+ */
+ private String botName;
private String password;
@@ -869,7 +875,7 @@ public class ChatRoomMessageHandler implements IChatRoomMessageHandler {
public void handleRoomMessage(IChatRoomMessage message) {
ID fromID = message.getFromID();
String name = fromID.getName();
- if (name.charAt(0) == '#' || name.equals("KOS-MOS")) { // skip messages
+ if (name.charAt(0) == '#' || name.equals(botName)) { // skip messages
// from the
// channel or
// self
@@ -933,6 +939,14 @@ public class ChatRoomMessageHandler implements IChatRoomMessageHandler {
}
public void preChatRoomConnect(IChatRoomContainer roomContainer, ID roomID) {
+ // retrieve our name
+ ID connectedID = container.getConnectedID();
+ botName = connectedID.getName();
+ IChatID chatID = (IChatID) connectedID.getAdapter(IChatID.class);
+ if (chatID != null) {
+ botName = chatID.getUsername();
+ }
+
messageSenders.put(roomID, roomContainer.getChatRoomMessageSender());
if (password != null) {
try {

Back to the top