Package pyxmpp :: Package jabber :: Module muc :: Class MucRoomState
[show private | hide private]
[frames | no frames]

Class MucRoomState


Describes the state of a MUC room, handles room events and provides an interface for room actions.
Method Summary
  __init__(self, manager, own_jid, room_jid, handler)
Initialize a MucRoomState object.
  change_nick(self, new_nick)
Send a nick change request to the room.
unicode configure_room(self, form)
Configure the room using the provided data.
unicode get_nick(self)
Get own nick.
JID get_room_jid(self, nick)
Get own room JID or a room JID for given nick.
MucRoomUser get_user(self, nick_or_jid, create)
Get a room user with given nick or JID.
  join(self, password, history_maxchars, history_maxstanzas, history_seconds, history_since)
Send a join request for the room.
  leave(self)
Send a leave request for the room.
  process_available_presence(self, stanza)
Process <presence/> received from the room.
  process_configuration_error(self, stanza)
Process error response for a room configuration request.
  process_configuration_form_error(self, stanza)
Process error response for a room configuration form request.
  process_configuration_form_success(self, stanza)
Process successful result of a room configuration form request.
  process_configuration_success(self, stanza)
Process success response for a room configuration request.
  process_error_message(self, stanza)
Process <message type="error"/> received from the room.
  process_error_presence(self, stanza)
Process <presence type="error"/> received from the room.
  process_groupchat_message(self, stanza)
Process <message type="groupchat"/> received from the room.
  process_unavailable_presence(self, stanza)
Process <presence type="unavailable"/> received from the room.
unicode request_configuration_form(self)
Request a configuration form for the room.
unicode request_instant_room(self)
Request an "instant room" -- the default configuration for a MUC room.
  send_message(self, body)
Send a message to the room.
  set_stream(self, stream)
Called when current stream changes.
  set_subject(self, subject)
Send a subject change request to the room.

Instance Variable Summary
  configured: False if the room requires configuration.
  handler: MucRoomHandler object containing callbacks to be called.
  joined: True if the channel is joined.
  manager: MucRoomManager object managing this room.
  me: MucRoomUser instance of the owner.
  own_jid: real jid of the owner (client using this class).
  room_jid: room jid of the owner.
  subject: current subject of the room.
  users: dictionary of users in the room.

Method Details

__init__(self, manager, own_jid, room_jid, handler)
(Constructor)

Initialize a MucRoomState object.
Parameters:
manager - an object to manage this room.
           (type=MucRoomManager)
own_jid - real JID of the owner (client using this class).
           (type=JID)
room_jid - room JID of the owner (provides the room name and the nickname).
           (type=JID)
handler - an object to handle room events.
           (type=MucRoomHandler)

change_nick(self, new_nick)

Send a nick change request to the room.
Parameters:
new_nick - the new nickname requested.
           (type=unicode)

configure_room(self, form)

Configure the room using the provided data. Do nothing if the provided form is of type 'cancel'.
Parameters:
form - the configuration parameters. Should be a 'submit' form made by filling-in the configuration form retireved using self.request_configuration_form or a 'cancel' form.
           (type=Form)
Returns:
id of the request stanza or None if a 'cancel' form was provieded.
           (type=unicode)

get_nick(self)

Get own nick.
Returns:
own nick.
           (type=unicode)

get_room_jid(self, nick=None)

Get own room JID or a room JID for given nick.
Parameters:
nick - a nick for which the room JID is requested.
           (type=unicode)
Returns:
the room JID.
           (type=JID)

get_user(self, nick_or_jid, create=False)

Get a room user with given nick or JID.
Parameters:
nick_or_jid - the nickname or room JID of the user requested.
           (type=unicode or JID)
create - if True and nick_or_jid is a JID, then a new user object will be created if there is no such user in the room.
           (type=bool)
Returns:
the named user or None
           (type=MucRoomUser)

join(self, password=None, history_maxchars=None, history_maxstanzas=None, history_seconds=None, history_since=None)

Send a join request for the room.
Parameters:
password - password to the room.
           (type=unicode)
history_maxchars - limit of the total number of characters in history.
           (type=int)
history_maxstanzas - limit of the total number of messages in history.
           (type=int)
history_seconds - send only messages received in the last history_seconds seconds.
           (type=int)
history_since - Send only the messages received since the dateTime specified (UTC).
           (type=datetime.datetime)

leave(self)

Send a leave request for the room.

process_available_presence(self, stanza)

Process <presence/> received from the room.
Parameters:
stanza - the stanza received.
           (type=MucPresence)

process_configuration_error(self, stanza)

Process error response for a room configuration request.
Parameters:
stanza - the stanza received.
           (type=Presence)

process_configuration_form_error(self, stanza)

Process error response for a room configuration form request.
Parameters:
stanza - the stanza received.
           (type=Presence)

process_configuration_form_success(self, stanza)

Process successful result of a room configuration form request.
Parameters:
stanza - the stanza received.
           (type=Presence)

process_configuration_success(self, stanza)

Process success response for a room configuration request.
Parameters:
stanza - the stanza received.
           (type=Presence)

process_error_message(self, stanza)

Process <message type="error"/> received from the room.
Parameters:
stanza - the stanza received.
           (type=Message)

process_error_presence(self, stanza)

Process <presence type="error"/> received from the room.
Parameters:
stanza - the stanza received.
           (type=Presence)

process_groupchat_message(self, stanza)

Process <message type="groupchat"/> received from the room.
Parameters:
stanza - the stanza received.
           (type=Message)

process_unavailable_presence(self, stanza)

Process <presence type="unavailable"/> received from the room.
Parameters:
stanza - the stanza received.
           (type=MucPresence)

request_configuration_form(self)

Request a configuration form for the room.

When the form is received self.handler.configuration_form_received will be called. When an error response is received then self.handler.error will be called.

Returns:
id of the request stanza.
           (type=unicode)

request_instant_room(self)

Request an "instant room" -- the default configuration for a MUC room.
Returns:
id of the request stanza.
           (type=unicode)

send_message(self, body)

Send a message to the room.
Parameters:
body - the message body.
           (type=unicode)

set_stream(self, stream)

Called when current stream changes.

Mark the room not joined and inform self.handler that it was left.

Parameters:
stream - the new stream.
           (type=pyxmpp.stream.Stream)

set_subject(self, subject)

Send a subject change request to the room.
Parameters:
subject - the new subject.
           (type=unicode)

Instance Variable Details

configured

False if the room requires configuration.

handler

MucRoomHandler object containing callbacks to be called.

joined

True if the channel is joined.

manager

MucRoomManager object managing this room.

me

MucRoomUser instance of the owner.

own_jid

real jid of the owner (client using this class).

room_jid

room jid of the owner.

subject

current subject of the room.

users

dictionary of users in the room. Nicknames are the keys.