use of org.eclipse.ecf.presence.chatroom.IChatRoomManager in project ecf by eclipse.
the class IRCConnectWizard method performFinish.
public boolean performFinish() {
final String connectID = page.getConnectID();
final String password = page.getPassword();
connectContext = ConnectContextFactory.createPasswordConnectContext(password);
page.saveComboText();
try {
targetID = IDFactory.getDefault().createID(container.getConnectNamespace(), connectID);
} catch (final IDCreateException e) {
new IDCreateErrorDialog(null, connectID, e).open();
return false;
}
final IChatRoomManager manager = (IChatRoomManager) this.container.getAdapter(IChatRoomManager.class);
final IRCUI ui = new IRCUI(this.container, manager, null);
ui.showForTarget(targetID);
// If it's not already connected, then we connect this new container
if (!ui.isContainerConnected()) {
page.saveComboItems();
// bug 274613, we need to remove the extra autojoin channel bits
IRCID id = (IRCID) targetID;
// start with user, then host, then port, abc@irc.freenode.net:6667
StringBuffer buffer = new StringBuffer(id.getUsername());
buffer.append('@').append(id.getHost());
buffer.append(':').append(id.getPort());
// create a truncated ID instance for the container to connect to
id = (IRCID) container.getConnectNamespace().createInstance(new Object[] { buffer.toString() });
new AsynchContainerConnectAction(container, id, connectContext, null, new Runnable() {
public void run() {
cachePassword(page.getPasswordKeyFromUserName(connectID), password);
}
}).run();
}
return true;
}
use of org.eclipse.ecf.presence.chatroom.IChatRoomManager in project ecf by eclipse.
the class AbstractAdapterAccessTest method testGetChatRoomManager.
public void testGetChatRoomManager() {
final IPresenceContainerAdapter adapter = getPresenceAdapter();
assertNotNull(adapter);
final IChatRoomManager chatRoomManager = adapter.getChatRoomManager();
assertNotNull(chatRoomManager);
}
use of org.eclipse.ecf.presence.chatroom.IChatRoomManager in project ecf by eclipse.
the class IRCChannelHyperlink method open.
public void open() {
IChatRoomContainer container = view.getRootChatRoomContainer();
final IChatRoomManager manager = (IChatRoomManager) container.getAdapter(IChatRoomManager.class);
view.joinRoom(manager.getChatRoomInfo(channel), "");
}
use of org.eclipse.ecf.presence.chatroom.IChatRoomManager in project ecf by eclipse.
the class AbstractChatRoomParticipantTest method setUp.
/*
* (non-Javadoc)
*
* @see org.eclipse.ecf.tests.presence.AbstractPresenceTestCase#setUp()
*/
protected void setUp() throws Exception {
super.setUp();
setClientCount(2);
clients = createClients();
IChatRoomManager chat0, chat1;
chat0 = getPresenceAdapter(0).getChatRoomManager();
chat1 = getPresenceAdapter(1).getChatRoomManager();
for (int i = 0; i < getClientCount(); i++) {
connectClient(i);
}
final IChatRoomInfo roomInfo0 = chat0.getChatRoomInfo(CHAT_ROOM_NAME);
if (roomInfo0 == null)
return;
chatRoomContainer0 = roomInfo0.createChatRoomContainer();
chatRoomContainer0.addChatRoomParticipantListener(participantListener0);
chatRoomContainer0.connect(roomInfo0.getRoomID(), null);
final IChatRoomInfo roomInfo1 = chat1.getChatRoomInfo(CHAT_ROOM_NAME);
chatRoomContainer1 = roomInfo1.createChatRoomContainer();
chatRoomContainer1.addChatRoomParticipantListener(participantListener1);
chatRoomContainer1.connect(roomInfo1.getRoomID(), null);
Thread.sleep(2000);
}
use of org.eclipse.ecf.presence.chatroom.IChatRoomManager in project ecf by eclipse.
the class ChatRoomBot method connect.
public synchronized void connect() throws ECFException {
fireInitBot();
try {
Namespace namespace = null;
if (container == null) {
container = ContainerFactory.getDefault().createContainer(bot.getContainerFactoryName());
namespace = container.getConnectNamespace();
} else
// $NON-NLS-1$
throw new ContainerConnectException("Already connected");
targetID = IDFactory.getDefault().createID(namespace, bot.getConnectID());
IChatRoomManager manager = (IChatRoomManager) container.getAdapter(IChatRoomManager.class);
if (manager == null)
// $NON-NLS-1$
throw new ECFException("No chat room manager available");
firePreConnect();
String password = bot.getPassword();
IConnectContext context = (password == null) ? null : ConnectContextFactory.createPasswordConnectContext(password);
container.connect(targetID, context);
String[] roomNames = bot.getChatRooms();
String[] roomPasswords = bot.getChatRoomPasswords();
for (int i = 0; i < roomNames.length; i++) {
IChatRoomInfo room = manager.getChatRoomInfo(roomNames[i]);
roomContainer = room.createChatRoomContainer();
roomID = room.getRoomID();
firePreRoomConnect();
roomContainer.addMessageListener(this);
IConnectContext roomContext = (roomPasswords[i] == null) ? null : ConnectContextFactory.createPasswordConnectContext(roomPasswords[i]);
roomContainer.connect(roomID, roomContext);
}
} catch (ECFException e) {
if (container != null) {
if (container.getConnectedID() != null) {
container.disconnect();
}
container.dispose();
}
container = null;
throw e;
}
}
Aggregations