NAME

Net::XMPP2::Ext::MUC::Room - Room class

SYNOPSIS

DESCRIPTION

This module represents a room handle for a MUC.

METHODS

new (%args)
get_user ($nick)

This method returns the user with the $nick in the room.

get_me

This method returns the Net::XMPP2::Ext::MUC::User object of yourself in the room. If will return undef if we are not in the room anymore.

get_user_jid ($jid)

This method looks whether a user with the JID $jid exists in the room. That means whether the node and domain part of the JID match the rooms node and domain part, and the resource part of the JID matches a joined nick.

make_instant ($cb)

If you just created a room you can create an instant room with this method instead of going through room configuration for a reserved room.

If you want to create a reserved room instead don't forget to unset the create_instant argument of the join_room method of Net::XMPP2::Ext::MUC!

See also the request_configuration method below for the reserved room config.

$cb is the callback that will be called when the instant room creation is finished. If successful the first argument will be this room object ($self), if unsuccessful the first argument will be undef and the second will be a Net::XMPP2::Error::IQ object.

make_message (%args)

This method constructs a Net::XMPP2::Ext::MUC::Message with a connection to this room.

%args are further arguments for the constructor of Net::XMPP2::Ext::MUC::Message. The default to argument for the message is the room and the type will be 'groupchat'.

send_part ($msg, $cb, $timeout)

This lets you part the room, $msg is an optional part message and can be undef if no custom message should be generated.

$cb is called when we successfully left the room or after $timeout seconds. The default for $timeout is 60.

The first argument to the call of $cb will be undef if we successfully parted, or a true value when the timeout hit. Even if we timeout we consider ourself parted.

users

Returns a list of Net::XMPP2::Ext::MUC::User objects which are in this room.

jid

Returns the bare JID of this room.

nick_jid

Returns the full JID of yourself in the room.

is_connected

Returns true if this room is still connected (but maybe not joined (yet)).

is_joined

Returns true if this room is still joined (and connected).

change_nick ($newnick)

This method lets you change your nickname in this room.

EVENTS

These events can be registered on with reg_cb:

message => $msg, $is_echo

This event is emitted when a message was received from the room. $msg is a Net::XMPP2::Ext::MUC::Message object and $is_echo is true if the message is an echo.

error => $error

This event is emitted when any error occured. $error is a Net::XMPP2::Error::MUC object.

join_error => $error

This event is emitted when a error occured when joining a room. $error is a Net::XMPP2::Error::MUC object.

enter => $user

This event is emitted when we successfully joined the room. $user is a Net::XMPP2::Ext::MUC::User object which is the user handle for ourself.

join => $user

This event is emitted when a new user joins the room. $user is the Net::XMPP2::Ext::MUC::User of that user.

presence => $user

This event is emitted when a user changes it's presence status (eg. affiliation or role, or away status). $user is the Net::XMPP2::Ext::MUC::User of that user.

part => $user

This event is emitted when a user leaves the channel. $user is the Net::XMPP2::Ext::MUC::User of that user, but please note that you shouldn't send any messages to this user anymore.

leave

This event is emitted when we leave the room.

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.