summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Stepper2007-11-12 03:59:29 (EST)
committerEike Stepper2007-11-12 03:59:29 (EST)
commitf9eff9095f2c4f5bb255c0fc89c33536d87b7f17 (patch)
treebbc653c51b51925e89b65b924e117c230a34a289
parent72a48cd95510d3750891014920b8c2dc3497e025 (diff)
downloadcdo-f9eff9095f2c4f5bb255c0fc89c33536d87b7f17.zip
cdo-f9eff9095f2c4f5bb255c0fc89c33536d87b7f17.tar.gz
cdo-f9eff9095f2c4f5bb255c0fc89c33536d87b7f17.tar.bz2
[209380] Add invitation capability for multi buddy collaborations
https://bugs.eclipse.org/bugs/show_bug.cgi?id=209380
-rw-r--r--plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/BuddyAdmin.java2
-rw-r--r--plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/CollaborationInitiatedNotification.java7
-rw-r--r--plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/InviteBuddiesIndication.java4
-rw-r--r--plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/BuddyCollaboration.java34
-rw-r--r--plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/CollaborationInitiatedIndication.java6
5 files changed, 37 insertions, 16 deletions
diff --git a/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/BuddyAdmin.java b/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/BuddyAdmin.java
index 7e6dc72..a09c2f6 100644
--- a/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/BuddyAdmin.java
+++ b/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/BuddyAdmin.java
@@ -177,7 +177,7 @@ public class BuddyAdmin extends CollaborationContainer implements IBuddyAdmin, I
{
invitations.remove(buddy);
IChannel channel = buddy.getSession().getChannel();
- new CollaborationInitiatedNotification(channel, collaborationID, invitations).send();
+ new CollaborationInitiatedNotification(channel, collaborationID, invitations, null).send();
}
catch (Exception ex)
{
diff --git a/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/CollaborationInitiatedNotification.java b/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/CollaborationInitiatedNotification.java
index 5117c71..41d0863 100644
--- a/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/CollaborationInitiatedNotification.java
+++ b/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/CollaborationInitiatedNotification.java
@@ -29,11 +29,15 @@ public class CollaborationInitiatedNotification extends Request
private Collection<IBuddy> buddies;
- public CollaborationInitiatedNotification(IChannel channel, long collaborationID, Collection<IBuddy> buddies)
+ private String[] facilityTypes;
+
+ public CollaborationInitiatedNotification(IChannel channel, long collaborationID, Collection<IBuddy> buddies,
+ String[] facilityTypes)
{
super(channel);
this.collaborationID = collaborationID;
this.buddies = buddies;
+ this.facilityTypes = facilityTypes;
}
@Override
@@ -47,5 +51,6 @@ public class CollaborationInitiatedNotification extends Request
{
out.writeLong(collaborationID);
ProtocolUtil.writeBuddies(out, buddies);
+ ProtocolUtil.writeFacilityTypes(out, facilityTypes);
}
}
diff --git a/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/InviteBuddiesIndication.java b/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/InviteBuddiesIndication.java
index 248e2d7..25a5bed 100644
--- a/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/InviteBuddiesIndication.java
+++ b/plugins/org.eclipse.net4j.buddies.server/src/org/eclipse/net4j/buddies/internal/server/protocol/InviteBuddiesIndication.java
@@ -65,11 +65,13 @@ public class InviteBuddiesIndication extends Indication
for (IBuddy buddy : buddies)
{
IChannel channel = buddy.getSession().getChannel();
+ String[] facilityTypes = null;
Set<IBuddy> set = new HashSet<IBuddy>();
if (added.contains(buddy))
{
set.addAll(buddies);
set.remove(buddy);
+ facilityTypes = collaboration.getFacilityTypes();
}
else
{
@@ -80,7 +82,7 @@ public class InviteBuddiesIndication extends Indication
{
try
{
- new CollaborationInitiatedNotification(channel, collaborationID, set).send();
+ new CollaborationInitiatedNotification(channel, collaborationID, set, facilityTypes).send();
}
catch (Exception ex)
{
diff --git a/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/BuddyCollaboration.java b/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/BuddyCollaboration.java
index 281adaa..028bb6f 100644
--- a/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/BuddyCollaboration.java
+++ b/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/BuddyCollaboration.java
@@ -52,23 +52,31 @@ public class BuddyCollaboration extends Collaboration implements IBuddyCollabora
public IFacility installFacility(String type)
{
- try
+ return installFacility(type, true);
+ }
+
+ public IFacility installFacility(String type, boolean request)
+ {
+ IFacility facility = createFacility(type);
+ if (request)
{
- IFacility facility = createFacility(type);
- IChannel channel = session.getChannel();
- boolean success = new InstallFacilityRequest(channel, getID(), type).send(ProtocolConstants.TIMEOUT);
- if (success)
+ try
{
- addFacility(facility, false);
- return facility;
+ IChannel channel = session.getChannel();
+ boolean success = new InstallFacilityRequest(channel, getID(), type).send(ProtocolConstants.TIMEOUT);
+ if (!success)
+ {
+ return null;
+ }
+ }
+ catch (Exception ex)
+ {
+ throw WrappedException.wrap(ex);
}
-
- return null;
- }
- catch (Exception ex)
- {
- throw WrappedException.wrap(ex);
}
+
+ addFacility(facility, !request);
+ return facility;
}
public IFacility createFacility(String type)
diff --git a/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/CollaborationInitiatedIndication.java b/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/CollaborationInitiatedIndication.java
index 5c951b1..027c3b6 100644
--- a/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/CollaborationInitiatedIndication.java
+++ b/plugins/org.eclipse.net4j.buddies/src/org/eclipse/net4j/internal/buddies/protocol/CollaborationInitiatedIndication.java
@@ -47,6 +47,7 @@ public class CollaborationInitiatedIndication extends Indication
long collaborationID = in.readLong();
Set<IBuddy> buddies = ProtocolUtil.readBuddies(in, session);
+ String[] facilityTypes = ProtocolUtil.readFacilityTypes(in);
BuddyCollaboration collaboration = (BuddyCollaboration)self.getCollaboration(collaborationID);
if (collaboration == null)
@@ -67,5 +68,10 @@ public class CollaborationInitiatedIndication extends Indication
Membership.create(buddy, collaboration);
}
}
+
+ for (String facilityType : facilityTypes)
+ {
+ collaboration.installFacility(facilityType, false);
+ }
}
}