Search code examples
erlangejabberd

What is protocol attribute in the module of ejabberd


In the ejabberd.erl module, the -protocol attribute is used:

-module(ejabberd).
-author('[email protected]').


-protocol({xep, 4, '2.9'}).
-protocol({xep, 86, '1.0'}).

What's the usage of this attribute?


Solution

  • They are user-defined Erlang module attributes which can be used both for information and programmatically.

    For example in mod_ping.erl module which implemented XEP-0199 (XMPP Ping) you can see its attibute:

    -module(mod_ping).
    -protocol({xep, 199, '2.0'}).
    

    And also in mod_vcard.erl which implemented bot XEP-0054 (vcard-temp) and XEP-0055 (Jabber Search) you can see their attributes:

    -module(mod_vcard).
    -protocol({xep, 54, '1.2'}).
    -protocol({xep, 55, '1.3'}).
    

    In this page you can find a full list of XMPP Extensions.


    Also it is good to know that using ModuleName:module_info(attributes) you can get a list of module attributes.