Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ecf-dev] Chatroom ID

Hi Tim/all,

I agree that creating room IDs is not as easy as should be.

I'm mulling over Tim's thoughts...and have some affinity for #2 as well...although it sort of changes the meaning of container.getAdapter somewhat...which may be OK.

It also may be possible to use an idiom like:

ID newID = IDFactory.getDefault().createID(c.getConnectNamespace(),"xmpp_room:slewis@xxxxxxxxxxxxxxxxxxxxxxxxxx/room");

I should have probably had this supported in XMPP room ID creation anyway. The XMPP conference room identification (e.g. conference.ecf.eclipse.org/room) is sort of clumsy IMHO...which sort of exacerbates this design problem.

OTOH, I do like #2 from Tim below for compactness.

Any thoughts/discussion?

Scott


Tim Terlegård wrote:
Creating a generic chatroom ID is hard, too hard IMHO. We talked about
util methods, but should it really be so hard in the core API?

I couldn't come up with a perfect solution. I've come up with 3 possible
solutions. If you want to create a chatroom ID right now you do something
like this:

ID chatRoomID =
    IDFactory.getDefault().createID(chatroom.getConnectNamespace(),
    new Object[] {"user", "host", "domain", "room", "nickname"});

It took quite a while before I realized how to create that ID correctly.
Possible solution I come up with:

1)

class XMPPChatManager implements IChatManager {
   public void join(String room, String nick) {
      IChatRoomContainer chat = createChatRoomContainer();
      ID id = new XMPPRoomID(chat.getConnectedNamespace(),
                             xmppConnection, "room", "nick");
      chat.connect(id, null);
      return chat;
   }
}

It makes it easier to join a chatroom and it hides the ID creation, but
it's still hard to create a generic chatroom ID using the core API.

2)

IChatRoomContainer chat = chatManager.createChatRoomContainer();
IChatRoomIDFactory f = chat.getAdapter(IChatRoomIDFactory.class);
f.createID("room", "nick");

3)

class XMPPRoomNamespace extends ChatRoomNamespace {
   public ID createInstance(String room, String nick) {
      return createInstance(...);
   }
}

ChatRoomNamespace chat = (ChatRoomNamespace) container.getConnectedNamespace();
IChatRoomID chatRoomID = chat.createInstance("room", "nick");

But the chatRoomID still miss information about username and domain.

I like solution 2, but I suspect it's not the Eclipse way?

Tim
_______________________________________________
ecf-dev mailing list
ecf-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/ecf-dev




Back to the top