Project

General

Profile

Tigase plugins: how to process stanza without namespace (+Possible minor issue in MUC)

HaXkil The
Added about 5 years ago

Hi guys. I wonder, whether it is possible to make Tigase plugin process stanzas without namespace.

I have plugin which looks similar to this

public class MUCPlugin extends XMPPProcessor implements XMPPProcessorIfc {
    private static final String ID = "muc:client";
    private static final String[][] ELEMENTS = {{Presence.ELEM_NAME}, {Iq.ELEM_NAME}, {Message.ELEM_NAME}};
    private static final String[] NAMESPACES = {"jabber:client","jabber:client", "jabber:client"};
    ...

    @Override
    public void process(..)

     @Override
    public String id() {
        return ID;
    }

    @Override
    public String[] supNamespaces() {
        return NAMESPACES;
    }

    @Override
    public String[][] supElementNamePaths() {
        return ELEMENTS;
    }
}

Stanza, which I try to process looks like this

<presence from="the-room@muc.d/the-nickname" type="unavailable" to="the-jid@di/the-resource">
<x xmlns="http://jabber.org/protocol/muc#user">
<item ... /></x>
</presence>

this stanza is sent by MUC component.

I'm trying to process this stanza, but process() method is not executed. I think the possible reason is that this stanza does not contain expected namespace.

Another thing I want to mention here is about MUC component.

It seems to me, that tigase/muc/modules/ModeratorModule.java method: makePresence()

is not setting up any namespace in case passed parameter is unavailable=true.

Could you take a look at it?

Thank you.


Replies (7)

Avatar?id=6098&size=32x32

Added by Bartosz Małkowski TigaseTeam about 5 years ago

I added xmlns to stanzas made by makePresence().

Thanks you!

(1)

Added by HaXkil The about 5 years ago

Wow! Thanks for rapid response!

Avatar?id=6023&size=32x32

Added by Artur Hefczyc TigaseTeam about 5 years ago

Plugins are designed to process stanzas with a specific name(s) and namespace(s) only. So you cannot process stanza without a namespace. This is OK because in XMPP every single stanza must have a namespace. If it does not have it, it's a bug in code creating the stanza.

Added by HaXkil The about 5 years ago

Good to know. And I don't need to process stanza without namespace anymore, since Bartosz has been already made change in MUC. Thank you!

(1)

Added by HaXkil The about 5 years ago

Hi. Sorry, but could you take a look at tigase.muc.modules.PresenceModule.doQuit() as well?

Seems like presence-type packets, generated there do not contain standard namespace.

Thank you.

(1)
Avatar?id=6098&size=32x32

Added by Bartosz Małkowski TigaseTeam about 5 years ago

Fixed.

I also found (I hope) all places with missing xmlns.

(1)

Added by HaXkil The about 5 years ago

Thanks a lot! Are these changes available for Maven?

    (1-7/7)