Old Groupchat Functionality

Hi Guys,

I have been working on a pretty complex application for some time now. As such, my code is based on an old build of Smack (ie no muc functionality). I was hoping you all could help me out with it.

I have implemented basic groupchat functionality using GroupChat to join the room and setting a MessageListener to process the message packets. Everything is working perfectly in that other clients are able to communicate with my client in groupchat if they were already in the chat before I was.

However, if they arrive in the groupchat after I am already there, there messages do not come through to my listener. They can see my messages fine but I can’'t see theirs. Do I need to reinitialize the Listener? Or add something to it? If so, how?

This is the last step in a big process, so I very much appreciate your feedback in knocking out this bug.

Best Regards,


What is the packet filter that you are using to recieve the messages? Ive never used the groupchat so it might be a built in function, you can go into the code perhaps and look at it there. Also, do you have the debugger open and are you recieving the messages there?

Let me give you some of my code:


    chat = connection.createGroupChat("test@conference.chat.multiling.com");




    Message message = new Message("tim.chandler@chat.multiling.com");

message.setBody(“Join me for a group chat!”);

    message.addExtension(new org.jivesoftware.smackx.GroupChatInvitation("test@conference.chat.multiling.com"));


chat.sendMessage(L.s(“MESSAGE FROM”) + " " + webClient.getName());

chat.sendMessage(L.s(“COMPANY”) + ": " + webClient.getChatQuestion());


public void processPacket(Packet packet) {

Message message = chat.nextMessage();

synchronized(buf) {


buf.append(": ");



Everything works (including sending the invitation, processing the packets, etc) for users who are already in the chat. But for anyone who joins, their messages do not show up. Any ideas?


Hey Tim,

Could you open a smack debugger and check the messages that your client is receiving? The message listener of the group chat is filtering on type=groupchat and sender=room address. So my guess is that the messages that you are receiving have something different.


– Gato

Sure enough, the messages are coming through, like this:

  • The strange thing is that these messages all show up the same under the “Raw Received Packets” tab in the debugger. However, in the All Packets tab, the messages only show up when the user is already logged in per the earlier discussion. If they weren’'t logged in, they show up under Raw Received Packets but not under All Packets. *

<<< Fixed this after posting it:

Also, it seems that this may have something to do with another problem I just discovered - the Smack client is falling behind, if there is a room history. When I type a message in the Exodus client, my listener will pick up an older message, not the current one. It will then not put any of the messages since then, until I type something else in Exodus, and it will give the message slightly newer than the previous old message. Do I need to clear the nextMessages? How do I do that?

<<< However, the other problem continues… the messages are the same, but the listener is not picking them up from the client who joins after the listener is initialized. >>>

Thanks for all of your help!

PS - for some reason this posting is showing a ; in one of the tags and a space in the body tags. This is not the case. These tags are normal.

You may or may not be running into this issue: http://www.jivesoftware.org/issues/browse/SMACK-6

Try using a PacketCollector instead and see if that makes a difference.