permanent MUC rooms only

I've got ejabberd running. Now I'd like some general advice before I start hacking.

How would I set up permanent rooms that only I--the administrator, can change? Can I do this via ejabberd.cfg?

{mod_muc,        [
		  {"room_1", "@HOST@},
                  {"room_2", "@HOST@},
                  {access_create, admin},
		  {default_room_options, [
                    {persistent, true}...

These are not showing up as options when I log on to my Jabber client (Spark) to test.

Thanks, Matt

After a little more research: http://www.ejabberd.im/node/67. I see that I should write:

 {mod_muc,       [
		  {host, "english.Pet-G5.local"},
		  {access, muc},
		  {access_create, muc},
		  {access_persistent, muc},
		  {access_admin, muc_admin}
		 ]},

at the top of the MUC configuration and connect to the server with a special MUC client that allows my admin user to configure the room.

I finally got this working when I switched back to Spark (OS X), but I can't configure multiple rooms. I've tried this:

{host, ["french.Pet-G5.local", "german.Pet-G5.local", "english.Pet-G5.local"]},

and this

{hosts, ["french.Pet-G5.local", "german.Pet-G5.local", "english.Pet-G5.local"]},

and this

{host, "french.pet-g5.local"},
{host, "english.pet-g5.local"},
{host, "russian.pet-g5.local"},

This last one works but only the first conference will be recognized.

Try this example

If I understood correctly, you have an ejabberd 2.0.2 server with the vhost "pet-g5.local". You want to have a chatroom service where only you can create and delete the rooms, and you want them to be persistent. The first rooms to have would be: "french", "german", and "english".

Tip: instead of a local name like "pet-g5.local", you better put in ejabberd.cfg the final name you will put to your Jabber domain (maybe it will be "pet-g5.net" or similar).

First check that you have in ejabberd.cfg all this:

%% Define the list of Jabber domains you want to serve in ejabberd:
{hosts, ["pet-g5.local"]}.

{acl, admin, {user, "matt", "pet-g5.local"}}.

{access, muc_admin, [{allow, admin}]}.

{modules,
 [
  ...
  %% This is the definition of the chatroom service
  {mod_muc, [
             %% The chatroom service will be "chatrooms.pet-g5.local":
             {host, "chatrooms.@HOST@"}, 
             {access, muc},
             {access_create, muc_admin},
             {access_persistent, muc_admin},
             {access_admin, muc_admin},
             {default_room_options,
              [
               {persistent, true}
              ]}
            ]},
  ...
 ]}.

Now start ejabberd. Since no rooms exist yet, you need to create them. Login with a Jabber client in the account "matt@pet-g5.local" (this is defined as admin of all the ejabberd server, and also admin of MUC service). It is a good idea that your client supports MUC, so you can configure the rooms.

With your Jabber client, login to a room that you want to create (for example room name "english" in MUC service "chatrooms.pet-g5.local"), and it will be created immediately. Since you already defined the default room options, you don't need to configure the room to be persistent. Of course, maybe you want to configure the room title, etc. You can exit the room, and it should persist.

Repeat the previous step for each room you want to create.

Anybody can join the rooms. Only you can create, delete or configure them.

thanks!

Worked like a charm. The rooms persist. I didn't understand that I was creating a "conference" service, then creating manually rooms from that service.

I also took your advice and replaced "Pet-G5.local" with the ultimate destination of the server: "chatisdemocracy.com". Here things did not go so well. Ejabberd starts without errors, but the web admin does not come up, instead I get this error message:

Safari can’t open the page “http://localhost:5280/admin/access/” because it can’t find the server “localhost”.

Also the chat client fails to find it, understandably, since chatisdemocracy is just a reserved url at this point. So I'm assuming that 1) the config knows the server automatically, and 2) it uses the host "name" so that addresses with that name are routed to the server, and 3) there is some way to point the chat client and the web admin at the "local" name "chatisdemocracy.com." (chatisdemocracy.com.local does not work.)

But I'm very stupid about networks! So all my assumptions could be wrong.

P.S This site makes very efficient, user-friendly use of Ajax.

Try to specify host in the Jabber client or in /etc/hosts

Most Jabber clients (including Psi, Gajim, Tkabber...) allow you to specify the IP to connect and port. For example:

  • host: 127.0.0.1 <-- this is used by your client to establish the TCP connection
  • port: 5222 (or leave empty for default value) <-- this is used by your client to establish the TCP connection
  • username: matt <-- this is used at XMPP level to login in ejabberd
  • jabber server: chatisdemocracy.com <-- this is used at XMPP level to login in ejabberd

Alternatively, you can add to your file /etc/hosts the line:

127.0.0.1       chatisdemocracy.com

This way your operating system will always try those IPs before asking some external DNS server.

Once you register the domain and it points to the IP address where ejabberd listens, you don't need to specify Host in Jabber client, nor in /etc/hosts.

thanks again

I never quite understood the difference between IP address and domain name. Now I know better.

So in solo ejabberd development, you typically use the local IP address (127.0.0.1) for configuration. OR you use the production domain name, and configure your OS to point that name at the local IP.

development/test/production-distinct MUC services

Is it possible to create 3 different conference host services? I've tried like this:

{mod_muc,      [
  {host, "production_scenarios.@HOST@"},
  {host, "development_scenarios.@HOST@"},
  {host, "test_scenarios.@HOST@"},
  {access, muc},
  {access_create, muc_admin},
  {access_persistent, muc_admin},
  {access_admin, muc_admin},
{default_room_options, [
{public, true},
{history_size, 0},
{persistent, true},
{password_protected, false}
]}
]},

But this does not work. Since my rails app looks at its chats table before logging into ejabberd and starts creating MUCs, it would hugely convenient if each distinct part of the app (development/test/production) was pointed at a different service. Different aspect of rails app-->Different chat DB-->Different MUC service-->Different chats.

Only one service per vhost

Matt Garland wrote:

Is it possible to create 3 different conference host services?

No, each vhost can only have one MUC service. Just create three rooms in it, and join the proper one in each case.

Syndicate content