[ejabberd] Create multi user chat room programmatically

Daniel Dormont dan at greywallsoftware.com
Mon May 16 18:20:35 MSD 2011

Hi Alexander,

I tried it just now and it worked for me. From ejabberd debug window:

mod_muc:create_room("danslaptop", "foo", jlib:string_to_jid("dan at danslaptop"), "dan", [{persistent, true}]).           

I checked under mod_muc_admin and the room exists. 

Then I joined the room using Psi:

<presence to="foo at conference.danslaptop/dan" >
<c xmlns="http://jabber.org/protocol/caps" node="http://psi-im.org/caps" ver="caps-b75d8d2b25" ext="ca ep-notify html" />
<x xmlns="http://jabber.org/protocol/muc"/>
<presence from="foo at conference.danslaptop/dan" xml:lang="en" to="dan at danslaptop/Daniel-Dormonts-MacBook-Pro" >
<c xmlns="http://jabber.org/protocol/caps" node="http://psi-im.org/caps" ver="caps-b75d8d2b25" ext="ca ep-notify html" />
<x xmlns="http://jabber.org/protocol/muc#user">
<item affiliation="owner" role="moderator" jid="dan at danslaptop/Daniel-Dormonts-MacBook-Pro" />
<status code="201" />
<iq type="set" to="foo at conference.danslaptop" id="abe4a" >
<query xmlns="http://jabber.org/protocol/muc#owner">
<x xmlns="jabber:x:data" type="submit" />
<iq from="foo at conference.danslaptop" type="result" to="dan at danslaptop/Daniel-Dormonts-MacBook-Pro" id="abe4a" >
<query xmlns="http://jabber.org/protocol/muc#owner"/>

At any rate, in my own application I have taken a different approach to creating rooms programmatically. I've restricted room creation to a set of admin users, and I have one of those users log in programmatically and create the room - and configure it, including enabling persistence - using ordinary XMPP. I can share the code if you like.


On May 16, 2011, at 10:02 AM, Alexander Kuleshov wrote:

> Why after create_room/5 room does not exist? Maybe i need make
> something else to create room?
> Thank you.
> _______________________________________________
> ejabberd mailing list
> ejabberd at jabber.ru
> http://lists.jabber.ru/mailman/listinfo/ejabberd

More information about the ejabberd mailing list