ejabberd模块中的协议属性是什么

What is protocol attribute in the module of ejabberd

ejabberd.erl模块中,使用了-protocol属性:

-module(ejabberd).
-author('alexey@process-one.net').


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

这个属性有什么用?

它们是用户定义的 Erlang 模块属性,可用于信息和编程。

例如在实现了XEP-0199(XMPP Ping)的mod_ping.erl模块中你可以看到它的属性:

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

并且在实现 bot XEP-0054 (vcard-temp) and XEP-0055(Jabber 搜索)的 mod_vcard.erl 中,您还可以看到它们的属性:

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

this page 中您可以找到完整的 XMPP 扩展列表。


同样很高兴知道使用 ModuleName:module_info(attributes) 可以获得模块属性列表。