Question

I have problem with my invitation handler. It is never fired. I can see invitation from group:

<body xmlns='http://jabber.org/protocol/httpbind'>
        <message xmlns="jabber:client" from="epthi_795@conference.188.2.16.19" to="nikoladerikonjic@188.2.16.19">
            <x xmlns="http://jabber.org/protocol/muc#user">
                <invite from="sanjicabjelica@188.2.16.19">
                    <reason>Please join me in conference.</reason>
                </invite>
            </x>
            <x xmlns="jabber:x:conference" jid="epthi_795@conference.188.2.16.19"/>
        </message>
</body>

but on_message handler is not fired. Because no type is defined.

When I put Chat.connection.addHandler(Chat.on_message,null, "message", null,null,null,null);

Invitations is shown but then all messages group or chat are handled by this. I want to me able to have

Chat.connection.addHandler(Chat.on_message,null, "message", "chat");
Chat.connection.addHandler(Chat.on_message,null, "message", "groupchat");

for separate type of messages.

I am going around i circles for two days with this. Help!?

In other words what to put in addHandler for messages that contain invite?

UPDATE

I have to put

Chat.connection.addHandler(Chat.on_message,null, "message"); 

before I did invite.

I do not understand why is that? Does anyone has idea?

Was it helpful?

Solution

The 2 handlers you started with require a type. The invite does not have a type. The handler I use for invites looks for the namespace instead. That way it's separated from my message handler.

connection.addHandler(onInvite, 'jabber:x:conference');

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top