[JDEV] MUC and creating rooms

David Sutton jabber at dsutton.legend.uk.com
Thu Jan 2 23:33:39 CST 2003


Hi there,

  Ok, its only one field that its really looking for, and its the config
  field. This was originally used when the service could receive a
  number of different x:data forms, and I needed a simple way to
  differiciate between them. I'm currently working on removing the
  dependancy in the CVS version, so that an empty form will suffice.

Regards,

  David

On Thu, Jan 02, 2003 at 04:47:16PM -0500, Vincent Dibartolo wrote:
>    All,
> 
>            I'm sure I'm doing something wrong, but I've been banging up
>    against the most frustrating problem having a bot create a chat room,
>    and I've found some unusual behavior by looking at debugging output
>    from the Exodus client.  To begin with, I know that MUC is properly
>    installed on my server because I can create conference rooms on the
>    fly using Exodus.
> 
>            I've been using the Net::Jabber Perl library to have a bot
>    connect using MUCJoin (I have v1.28).  The following is an outline of
>    my code:
> 
>                            $jabber = new Net::Jabber::Client();
>                            my ($status) =
>    $jabber->Connect(hostname=>$j_server,  port=>$j_port);
>                            my (@result) =
>    $jabber->AuthSend(username=>$user,  password=>$pass,
>    resource=>$resource);
>                            $jabber->MUCJoin(room=>$room_name,
>    server=>$j_chat_server, nick=>$chat_nickname);
> 
>            If I look in the ".../jabber/spool/<chat server name>/"
>    directory I don't see any files created, and I can't get another
>    client to connect to that room (keep getting a "Forbidden" message in
>    Exodus).  Frustratingly, I have to restart the Jabber server before I
>    can try to create this room with Exodus, which is annoying but not
>    necessary for my project.  I assume this is because the room is in
>    some half-created state and the server is not allowing anyone else to
>    create a room with the same name.
> 
>            So I looked at the debug output from the Exodus
>    connection/creation of the conference room and found that if I do what
>    it does everything works fine.  This amounts to the following, which
>    as you can see is ugly and undesirable:
> 
>                            $jabber = new Net::Jabber::Client();
>                            my ($status) =
>    $jabber->Connect(hostname=>$j_server,  port=>$j_port);
>                            my (@result) =
>    $jabber->AuthSend(username=>$user,  password=>$pass,
>    resource=>$resource);
>                            $jabber->MUCJoin(room=>$room_name,
>    server=>$j_chat_server, nick=>$chat_nickname);
> 
>                             # this is the first part of the hack
>    protocol, which will send back a config "form",
>                            # which describes the room's settings
>                            my ($iq) = new Net::Jabber::IQ();
>                            $iq->SetIQ(to=>$room_name.'@'.$j_chat_server,
>    type=>"get");
>                            my ($iq_type) = $iq->NewQuery();
> 
>    $iq_type->SetXMLNS("http://jabber.org/protocol/muc#owner");
>                            $jabber->Send($iq, 1);
> 
>                            # this is the second part of the hack that
>    just accepts the default settings
>    my ($msg) =<<EOL;
>    <iq to="$room_name\@$j_chat_server" type="set"><query
>    xmlns="http://jabber.org/protocol/muc#owner"><x type="submit"
>    xmlns="jabber:x:data"><title>Room configuration</title><field
>    var="logformat"><value>text</value></field><field
>    var="logging"><value>0</value></field><field
>    var="whois"><value>admins</value></field><field
>    var="password"><value>0</value></field><field
>    var="invites"><value>0</value></field><field
>    var="invitation"><value>0</value></field><field
>    var="privmsg"><value>0</value></field><field
>    var="defaulttype"><value>0</value></field><field
>    var="moderated"><value>0</value></field><field
>    var="legacy"><value>1</value></field><field
>    var="persistant"><value>0</value></field><field
>    var="public"><value>1</value></field><field
>    var="privacy"><value>1</value></field><field
>    var="participants"><value>30</value></field><field
>    var="subject"><value>0</value></field><field var="rename"><value>is
>    now known as</value></field><field var="join"><value>has become
>    available</value></field><field var="leave"><value>has
>    left</value></field><field var="title"><value>t1</value></field><field
>    var="form"><value>config</value></field></x></query></iq>
> 
>    EOL
> 
>                            $jabber->Send($msg);
> 
>            Now, this creates the room (by which I mean I see a file in
>    ".../jabber/spool/<chat server name>/") which other clients can
>    connect to.  There are a couple of things I don't understand:
> 
>            1) If I send any less than the complete registration form
>    ("$msg" above) it doesn't work
>            2) Why do I have to take those extra steps at all?  Shouldn't
>    MUCJoin take care of all this for me?  Does this imply a problem or is
>    this expected behavior?
> 
>            I've seen some unrelated posts about joining a MUC so my
>    apologies if this is a known problem that I wasn't able to find.
> 
>            -Vinny

-- 
David Sutton
Email: dsutton at legend.co.uk
Jabber: peregrine at legend.net.uk
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: not available
URL: <https://www.jabber.org/jdev/attachments/20030102/ba68a473/attachment-0002.pgp>


More information about the JDev mailing list