[ejabberd] how to run xmpp compliant code in ejabberd 15.06

Evgeny Khramtsov xramtsov at gmail.com
Mon May 1 13:48:56 MSK 2017


Mon, 1 May 2017 15:32:29 +0530 (IST)
Abhishek Ranjan <abhishek at blacklightsw.com> wrote:

> Hi,
> 
> I wrote the following code for catching only message stanzas. 
> 
> 
> 
> myMessage({Packet, C2SState})->
> 
>   PacketType=xmpp:get_name(Packet),
> 
>   case PacketType of
>     <<"message">> ->
> 
>       ?INFO_MSG("Hello there",[]);
> 
>     _Any -> ok
> 
> end,
> 
> {Packet,C2SState}.
> 
> 
> It works fine in ejabberd 17.03 but I found that doesn't goes well
> with ejabberd 15.06 since xmpp compliant code became more defined
> from ejabberd 17.03.
> 
> The custom module in ejabberd 17.03 which contains the above code
> also includes xmpp.hrl and since there is no such file in ejabberd
> 15.06 so I was wondering if there any way that this code snippet
> might work with ejabberd 15.06 also.

No, you need to completely rewrite XML related stuff for 15.06.
Also, don't abuse xmpp:get_name/1 function, use pattern matching, e.g.

myMessage({#message{} = Msg, State} = Acc) ->
    do_something(Msg),
    Acc;
myMessage(Acc) ->
    Acc.


More information about the ejabberd mailing list