[ejabberd] how to create chat room programmatically?

Holger Weiß holger at zedat.fu-berlin.de
Fri Aug 15 16:26:59 MSK 2014


* liudanking <liudanking at gmail.com> [2014-08-15 18:31]:
> i am using ejabberd v14.07 as my xmpp server.
> 
> And i want to create chat room programmatically:
> 
> mod_muc:create_room(<<"mac.xmpp.com">>, "chatgroup",
> jlib:string_to_jid(<<"liudan at localhost">>), "nickname", default)

The type of the "chatgroup" and "nickname" arguments is wrong.  And if
you're creating a room programmatically, chances are you want it to be
persistent.  So:

    mod_muc:create_room(
        <<"mac.xmpp.com">>,
        <<"chatgroup">>,
        jlib:string_to_jid(<<"liudan at localhost">>),
        <<"nickname">>,
        [{persistent, true}]
    ).

Holger


More information about the ejabberd mailing list