summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-10-07 18:14:40 (EDT)
committerEike Stepper2007-10-07 18:14:40 (EDT)
commitd7992989e952b43eb492b962def7eee235d9be60 (patch)
tree7daf05e481999f3a59f83b56f7a547cad611ab87
parent0e6b366ac9d1fe3a4197da9e9356b9da63c952db (diff)
downloadcdo-d7992989e952b43eb492b962def7eee235d9be60.zip
cdo-d7992989e952b43eb492b962def7eee235d9be60.tar.gz
cdo-d7992989e952b43eb492b962def7eee235d9be60.tar.bz2
[205668] Provide buddies example
https://bugs.eclipse.org/bugs/show_bug.cgi?id=205668
-rw-r--r--plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/OpenSessionIndication.java21
-rw-r--r--plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/buddies/BuddiesUtil.java2
2 files changed, 22 insertions, 1 deletions
diff --git a/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/OpenSessionIndication.java b/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/OpenSessionIndication.java
index 7599158..f7e33ab 100644
--- a/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/OpenSessionIndication.java
+++ b/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/OpenSessionIndication.java
@@ -10,6 +10,7 @@
**************************************************************************/
package org.eclipse.net4j.buddies.internal.server.protocol;
+import org.eclipse.net4j.IChannel;
import org.eclipse.net4j.buddies.internal.server.bundle.OM;
import org.eclipse.net4j.buddies.protocol.BuddiesProtocolConstants;
import org.eclipse.net4j.buddies.protocol.IBuddyAccount;
@@ -21,6 +22,8 @@ import org.eclipse.net4j.util.io.ExtendedDataOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
+import java.util.ArrayList;
+import java.util.List;
import java.util.Map;
/**
@@ -71,14 +74,32 @@ public class OpenSessionIndication extends IndicationWithResponse
if (account != null)
{
out.writeBoolean(true);
+ List<IChannel> channels = new ArrayList<IChannel>();
out.writeInt(buddies.length);
for (String buddy : buddies)
{
out.writeString(buddy);
+ IBuddySession buddySession = IBuddyAdmin.INSTANCE.getSessions().get(buddy);
+ if (buddySession != null)
+ {
+ channels.add(buddySession.getChannel());
+ }
}
ObjectOutputStream oos = new ObjectOutputStream(out);
oos.writeObject(account);
+
+ for (IChannel channel : channels)
+ {
+ try
+ {
+ new BuddyAddedNotification(channel, account.getUserID()).send();
+ }
+ catch (Exception ex)
+ {
+ OM.LOG.error(ex);
+ }
+ }
}
else
{
diff --git a/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/buddies/BuddiesUtil.java b/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/buddies/BuddiesUtil.java
index 5f63aad..8fc6795 100644
--- a/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/buddies/BuddiesUtil.java
+++ b/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/buddies/BuddiesUtil.java
@@ -31,7 +31,7 @@ public final class BuddiesUtil
{
IChannel channel = connector.openChannel(BuddiesProtocolConstants.PROTOCOL_NAME, null);
OpenSessionRequest request = new OpenSessionRequest(channel, userID, password);
- return request.send(5000L);
+ return request.send();
}
catch (Exception ex)
{