GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  NET::XMPP2::EXT::MUC (3)

.ds Aq ’

NAME

Net::XMPP2::Ext::MUC - Implements XEP-0045: Multi-User Chat

CONTENTS

SYNOPSIS



   my $con = Net::XMPP2::Connection->new (...);
   $con->add_extension (my $disco = Net::XMPP2::Ext::Disco->new);
   $con->add_extension (
      my $muc = Net::XMPP2::Ext::MUC->new (disco => $disco, connection => $con)
   );
   ...



DESCRIPTION

This module handles multi user chats and provides new events to catch multi user chat messages. It intercepts messages from the connection so they don’t interfere with your other callbacks on the connection.

This extension requires the Net::XMPP2::Ext::Disco extension for service discovery.

METHODS

<B>newB> This is the constructor for a pubsub object. It takes no further arguments.
<B>is_conference ($jid, B>$cb<B>)B> TODO
<B>is_room ($jid, B>$cb<B>)B> This method sends a information discovery to the $jid. $cb is called when the information arrives or with an error after the usual IQ timeout.

When the $jid was a room $cb is called with the first argument being a Net::XMPP2::Ext::MUC::RoomInfo object. If the destination wasn’t reachable, the room doesn’t exist or some other error happened the first argument will be undefined and the second a Net::XMPP2::Error::IQ object.

<B>join_room ($jid, B>$nick<B>, B>$cb<B>, B>%args<B>)B> This method joins a room.

$jid should be the bare jid of the room. $nick should be your desired nickname in the room.

$cb is called upon successful entering the room or if an error occured. If no error occured the first argument is a Net::XMPP2::Ext::MUC::Room object (the one of the joined room) and the second is a Net::XMPP2::Ext::MUC::User object, the one of yourself. And the third argument is undef.

If an error occured and we couldn’t join the room, the first two arguments are undef and the third is a Net::XMPP2::Error::MUC object signalling the error.

%args hash can contain one of the following keys:
timeout => $timeout_in_secs This is the timeout for joining the room. The default timeout is 60 seconds if the timeout is not specified.
create_instant => $bool If you set $bool to a true value we try to establish an instant room on joining if it doesn’t already exist.

The default for this flag is true! So if you want to creat an reserved room with custom creation in the beginning you have to pass a false value as $bool.

<B>PLEASE NOTE:B> If you set $bool to a <B>falseB> value you have to check the did_create_room statusflag on your own instance of Net::XMPP2::Ext::MUC::User (provided as the second argument to the callback) to see whether you need to finish room creation! If you don’t do this the room <B>may stay LOCKED for everB>.

See also the make_instant and request_configuration methods of Net::XMPP2::Ext::MUC.

password => $password The password for the room.
nickcollision_cb => $cb If the join to the room results in a nickname collision the $cb will be called with the nickname that collided and the return value will be used as alternate nickname and the join is retried.

This function is called everytime the nickname collides on join, so you should take care of possible endless retries.

<B>get_room ($jid)B> This returns the Net::XMPP2::Ext::MUC::Room object for the bare part of the $jid if we are joining or have joined such a room.

If we are not joined undef is returned.

<B>is_connectedB> This returns whether we are still connected and can send messages.

EVENTS

All events from Net::XMPP2::Ext::MUC::Room instances that were joined with this MUC are forwarded to this object. The events from the room are prefixed with ’room_’ and the first argument is always the Net::XMPP2::Connection the MUC operates on, the second is always the Net::XMPP2::Ext::MUC::Room object and the rest of the argument corresponds to the arguments of the event of the room. See the event description for Net::XMPP2::Ext::MUC::Room for details which events are generated. Generally, if you want for example to get the joined event:



   $muc->reg_cb (room_enter => sub {
      my ($muc, $con, $room) = @_;
      # ...
   });



These additional events can be registered on with reg_cb:

AUTHOR

Robin Redeker, <elmex at ta-sa.org>, JID: <elmex at jabber.org>

COPYRIGHT & LICENSE

Copyright 2007 Robin Redeker, all rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 NET::XMPP2::EXT::MUC (3) 2008-03-24

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.