powered by Jive Software

Implementation of MucSub in Smack

Hi,
I’m trying to implement the MucSub (MucSub: Multi-User Chat Subscriptions | ejabberd Docs) for MUC but I’m facing a strange problem.

I correctly subscribe to service and I can query for every info, but when I send a message it does not arrives to the Smack client.

I added a custom stanza listener, just to log everything

        xmppConnection.addAsyncStanzaListener(StanzaListener { packet ->
            // prints packet.toXML()
        }, AndFilter(StanzaTypeFilter.MESSAGE))

But nothing is logged for MUC. Instead, every single-chat message is logged.
As defined in MucSub, if I join the MUC the messages arrives in the MessageListener.

Using a different client, I can see in the log that the message arrives, formatted as defined in specs:

<message from="coven@muc.shakespeare.example"
         to="hag66@shakespeare.example/pda">
  <event xmlns="http://jabber.org/protocol/pubsub#event">
    <items node="urn:xmpp:mucsub:nodes:messages">
      <item id="18277869892147515942">
        <message from="coven@muc.shakespeare.example/secondwitch"
                 to="hag66@shakespeare.example/pda"
                 type="groupchat"
                 xmlns="jabber:client">
          <archived xmlns="urn:xmpp:mam:tmp"
                    by="muc.shakespeare.example"
                    id="1467896732929849" />
          <stanza-id xmlns="urn:xmpp:sid:0"
                     by="muc.shakespeare.example"
                     id="1467896732929849" />
          <body>Hello from the MUC room !</body>
        </message>
      </item>
    </items>
  </event>
</message>

So, my question is: what’s the right way to intercept this king of stanza?
Does already exists an implementation for MucSub in Smack?

Thanks!

Use the Smack debugger (SmackConfiguration.DEBUG = true;) to find out if the message actually arrives. If you see it in the Smack debugger, then use a Java debugger to follow the processing chain of the message to determine why the async stanza listener is not invoked.

Strangely the message does not arrives… I will investigate what’s happening.
Thanks for the hint!