Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrsuen2008-12-13 10:46:33 -0500
committerrsuen2008-12-13 10:46:33 -0500
commitc805438ea2849b4eb6b177852207195c5d0a46bf (patch)
treeb665a94b9b5ddadaeac464bbd8c2df32e6ecc162 /examples/bundles/org.eclipse.ecf.example.collab
parent066599a2c4741f78633436ee4d30ddf630001d7e (diff)
downloadorg.eclipse.ecf-c805438ea2849b4eb6b177852207195c5d0a46bf.tar.gz
org.eclipse.ecf-c805438ea2849b4eb6b177852207195c5d0a46bf.tar.xz
org.eclipse.ecf-c805438ea2849b4eb6b177852207195c5d0a46bf.zip
Add support for sending IMs.
Diffstat (limited to 'examples/bundles/org.eclipse.ecf.example.collab')
-rw-r--r--examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/share/EclipseCollabSharedObject.java10
-rw-r--r--examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/presence/PresenceContainer.java38
2 files changed, 41 insertions, 7 deletions
diff --git a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/share/EclipseCollabSharedObject.java b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/share/EclipseCollabSharedObject.java
index 7946d743f..a0881f2c5 100644
--- a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/share/EclipseCollabSharedObject.java
+++ b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/example/collab/share/EclipseCollabSharedObject.java
@@ -88,7 +88,7 @@ public class EclipseCollabSharedObject extends GenericSharedObject {
this.workbenchWindow = window;
this.localUser = user;
this.downloadDirectory = downloaddir;
- presenceContainer = new PresenceContainer(container, localUser);
+ presenceContainer = new PresenceContainer(this, container, localUser);
createOutputView();
Assert.isNotNull(localGUI, "Local GUI cannot be created...exiting"); //$NON-NLS-1$
@@ -436,14 +436,18 @@ public class EclipseCollabSharedObject extends GenericSharedObject {
}
}
- public void sendPrivateMessageToUser(IUser touser, String msg) {
+ public void sendPrivateMessageToUser(ID toId, String msg) {
try {
- forwardMsgTo(touser.getID(), SharedObjectMsg.createMsg(null, HANDLE_SHOW_PRIVATE_TEXT_MSG, localUser, msg));
+ forwardMsgTo(toId, SharedObjectMsg.createMsg(null, HANDLE_SHOW_PRIVATE_TEXT_MSG, localUser, msg));
} catch (final Exception e) {
log("Exception on sendShowPrivateTextMsg to remote clients", e); //$NON-NLS-1$
}
}
+ public void sendPrivateMessageToUser(IUser touser, String msg) {
+ sendPrivateMessageToUser(touser.getID(), msg);
+ }
+
public void sendRegisterProxy(ID toID, String proxyClass, String name) {
try {
forwardMsgTo(toID, SharedObjectMsg.createMsg(null, HANDLE_REGISTER_PROXY_MSG, localUser, proxyClass, name));
diff --git a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/presence/PresenceContainer.java b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/presence/PresenceContainer.java
index b59af33c4..137fc5069 100644
--- a/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/presence/PresenceContainer.java
+++ b/examples/bundles/org.eclipse.ecf.example.collab/src/org/eclipse/ecf/internal/example/collab/presence/PresenceContainer.java
@@ -10,25 +10,31 @@
******************************************************************************/
package org.eclipse.ecf.internal.example.collab.presence;
+import java.util.Map;
import org.eclipse.ecf.core.IContainer;
import org.eclipse.ecf.core.identity.ID;
import org.eclipse.ecf.core.user.IUser;
import org.eclipse.ecf.core.util.ECFException;
+import org.eclipse.ecf.example.collab.share.EclipseCollabSharedObject;
import org.eclipse.ecf.internal.example.collab.ClientPlugin;
import org.eclipse.ecf.presence.*;
-import org.eclipse.ecf.presence.im.IChatManager;
+import org.eclipse.ecf.presence.history.IHistoryManager;
+import org.eclipse.ecf.presence.im.*;
+import org.eclipse.ecf.presence.im.IChatMessage.Type;
import org.eclipse.ecf.presence.roster.IRosterManager;
import org.eclipse.ecf.presence.service.IPresenceService;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
-public class PresenceContainer extends AbstractPresenceContainer implements IPresenceSender, IPresenceService {
+public class PresenceContainer extends AbstractPresenceContainer implements IChatManager, IChatMessageSender, IPresenceSender, IPresenceService {
+ private final EclipseCollabSharedObject sharedObject;
private final IContainer container;
private final IRosterManager manager;
private ServiceRegistration serviceRegistration;
- public PresenceContainer(IContainer container, IUser user) {
+ public PresenceContainer(EclipseCollabSharedObject sharedObject, IContainer container, IUser user) {
+ this.sharedObject = sharedObject;
this.container = container;
manager = new RosterManager(this, user);
@@ -44,7 +50,7 @@ public class PresenceContainer extends AbstractPresenceContainer implements IPre
}
public IChatManager getChatManager() {
- return null;
+ return this;
}
public IRosterManager getRosterManager() {
@@ -72,4 +78,28 @@ public class PresenceContainer extends AbstractPresenceContainer implements IPre
// unimplemented as we have no concept of presence support, either online or offline
}
+ public IChat createChat(ID targetUser, IIMMessageListener messageListener) throws ECFException {
+ return null;
+ }
+
+ public IChatMessageSender getChatMessageSender() {
+ return this;
+ }
+
+ public IHistoryManager getHistoryManager() {
+ return null;
+ }
+
+ public ITypingMessageSender getTypingMessageSender() {
+ return null;
+ }
+
+ public void sendChatMessage(ID toId, ID threadId, Type type, String subject, String body, Map properties) throws ECFException {
+ sharedObject.sendPrivateMessageToUser(toId, body);
+ }
+
+ public void sendChatMessage(ID toId, String body) throws ECFException {
+ sendChatMessage(toId, null, null, null, body, null);
+ }
+
}

Back to the top