summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-10-16 14:15:55 (EDT)
committerEike Stepper2007-10-16 14:15:55 (EDT)
commit59924eae7c4e46412ca8a9a3597887e2344d9ca2 (patch)
tree3e80beaaa2e7e9ef3bdae23abba85c14f2cd0f03
parentc1dad986d4271fd5d74ff9098170e0d91304f3ff (diff)
downloadcdo-59924eae7c4e46412ca8a9a3597887e2344d9ca2.zip
cdo-59924eae7c4e46412ca8a9a3597887e2344d9ca2.tar.gz
cdo-59924eae7c4e46412ca8a9a3597887e2344d9ca2.tar.bz2
[206224] Provide chat example
https://bugs.eclipse.org/bugs/show_bug.cgi?id=206224
-rw-r--r--plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/ServerCollaborationLeftIndication.java41
-rw-r--r--plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/ServerProtocol.java3
-rw-r--r--plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsPane.java17
3 files changed, 42 insertions, 19 deletions
diff --git a/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/ServerCollaborationLeftIndication.java b/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/ServerCollaborationLeftIndication.java
new file mode 100644
index 0000000..b92466e
--- /dev/null
+++ b/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/ServerCollaborationLeftIndication.java
@@ -0,0 +1,41 @@
+package org.eclipse.net4j.buddies.internal.server.protocol;
+
+import org.eclipse.net4j.buddies.internal.protocol.Collaboration;
+import org.eclipse.net4j.buddies.internal.protocol.CollaborationLeftIndication;
+import org.eclipse.net4j.buddies.internal.protocol.CollaborationLeftNotification;
+import org.eclipse.net4j.buddies.protocol.IBuddy;
+import org.eclipse.net4j.buddies.server.IBuddyAdmin;
+import org.eclipse.net4j.util.ObjectUtil;
+import org.eclipse.net4j.util.WrappedException;
+
+/**
+ * @author Eike Stepper
+ */
+public class ServerCollaborationLeftIndication extends CollaborationLeftIndication
+{
+ public ServerCollaborationLeftIndication()
+ {
+ super(IBuddyAdmin.INSTANCE);
+ }
+
+ @Override
+ protected void collaborationLeft(Collaboration collaboration, String userID)
+ {
+ for (IBuddy buddy : collaboration.getBuddies())
+ {
+ if (!ObjectUtil.equals(buddy.getUserID(), userID))
+ {
+ try
+ {
+ new CollaborationLeftNotification(buddy.getSession().getChannel(), collaboration.getID(), userID).send();
+ }
+ catch (Exception ex)
+ {
+ throw WrappedException.wrap(ex);
+ }
+ }
+ }
+
+ super.collaborationLeft(collaboration, userID);
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/ServerProtocol.java b/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/ServerProtocol.java
index f3e5fe7..64e53e2 100644
--- a/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/ServerProtocol.java
+++ b/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/ServerProtocol.java
@@ -10,7 +10,6 @@
**************************************************************************/
package org.eclipse.net4j.buddies.internal.server.protocol;
-import org.eclipse.net4j.buddies.internal.protocol.CollaborationLeftIndication;
import org.eclipse.net4j.buddies.internal.protocol.MessageIndication;
import org.eclipse.net4j.buddies.internal.protocol.ProtocolConstants;
import org.eclipse.net4j.buddies.server.IBuddyAdmin;
@@ -49,7 +48,7 @@ public class ServerProtocol extends SignalProtocol
return new InitiateCollaborationIndication();
case ProtocolConstants.SIGNAL_COLLABORATION_LEFT:
- return new CollaborationLeftIndication(IBuddyAdmin.INSTANCE);
+ return new ServerCollaborationLeftIndication();
case ProtocolConstants.SIGNAL_MESSAGE:
return new MessageIndication(IBuddyAdmin.INSTANCE);
diff --git a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsPane.java b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsPane.java
index a89cb31..5ed67ca 100644
--- a/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsPane.java
+++ b/plugins/org.eclipse.net4j.buddies.ui/src/org/eclipse/net4j/buddies/internal/ui/views/CollaborationsPane.java
@@ -175,7 +175,6 @@ public class CollaborationsPane extends Composite implements IListener
return;
}
- System.out.println("EVENT: " + event);
if (event.getSource() == session.getSelf() && event instanceof IContainerEvent)
{
IContainerEvent<ICollaboration> e = (IContainerEvent<ICollaboration>)event;
@@ -192,22 +191,6 @@ public class CollaborationsPane extends Composite implements IListener
}
});
}
- // else if (event.getSource() == session && event instanceof IContainerEvent)
- // {
- // IContainerEvent<ICollaboration> e = (IContainerEvent<ICollaboration>)event;
- // e.accept(new IContainerEventVisitor<ICollaboration>()
- // {
- // public void added(ICollaboration collaboration)
- // {
- // collaborationAdded((IBuddyCollaboration)collaboration);
- // }
- //
- // public void removed(ICollaboration collaboration)
- // {
- // collaborationRemoved((IBuddyCollaboration)collaboration);
- // }
- // });
- // }
else if (event instanceof IFacilityInstalledEvent)
{
IFacilityInstalledEvent e = (IFacilityInstalledEvent)event;