Abstract interface for Chat and MultiUserChat

I just noticed that MultiUserChat’‘s interface contains practically all the methods in Chat. It would help my application if I had an abstract class or interface for those common operations. I can use the Adapter pattern, but if it’‘s ok with you I’'d rather implement the changes directly on Smack and allow others to benefit from the change.

IChat could work as a name for the interface (although I don’‘t like the “I” prefix, “Chat” is already taken). Just give me a catchy name and I’'ll do it

Actually, I’‘d prefer for us not to make this change even though it’‘s a good idea in general. The main reason is that “Chat” will go away in the future. “Chat” is the old Jabber groupchat protocol and “MultiUserChat” is the more modern MUC protocol detailed in JEP-0045. In Smack 2.0, we’'ll totally phase out support for the old groupchat protocol and only leave in support for MUC. At that point, there would be no point in having an interface.

Thanks,

Matt

Please note that I’'m referring to Chat and not GroupChat.

In case Chat actually uses groupchat, how are you going to handle user-to-user chats without having to set up a room?

Ahh, urg. I got myself confused. So, the question would be if it’'s useful to have one interface for both Chat and MultiUserChat (since GroupChat will go away). It might indeed be useful…

-Matt

Here is the implementation. IChat is the common interface and the other file are two methods that should be added to Chat. They’'re necessary because I thought it would be nice to have getParticipants and getParticipantCount in the interface, too.

Sorry I didn’'t add comments to the interface definition, but it should be easy to cut and past from Chat and MultiUserChat as corresponding.
IChat.java (1125 Bytes)
Chat2IChat.txt (564 Bytes)

Hmmm… now I’‘m confused. Does getParticipants include the local user or not? If it should, then the implementation in Chat2IChat.txt is wrong. Let me know and I’'ll fix it.

Here’'s an updated patch against CVS HEAD that clarifies this issue.
smack-cvs-jkohen-ichat.patch (3592 Bytes)