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.

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

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.
  configure_room(self, form)
Configure the room using the provided data.
  get_nick(self)
Get own nick.
  get_room_jid(self, nick)
Get own room JID or a room JID for given `nick`.
  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.
  request_configuration_form(self)
Request a configuration form for the room.
  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.

Method Details

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

Initialize a `MucRoomState` object.

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

change_nick(self, new_nick)

Send a nick change request to the room.

:Parameters:
    - `new_nick`: the new nickname requested.
:Types:
    - `new_nick`: `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.
:Types:
    - `form`: `Form`

:return: id of the request stanza or `None` if a 'cancel' form was provieded.
:returntype: `unicode`

get_nick(self)

Get own nick.

:return: own nick.
:returntype: `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.
:Types:
    - `nick`: `unicode`

:return: the room JID.
:returntype: `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.
    - `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.
:Types:
    - `nick_or_jid`: `unicode` or `JID`
    - `create`: `bool`

:return: the named user or `None`
:returntype: `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.
    - `history_maxchars`: limit of the total number of characters in
      history.
    - `history_maxstanzas`: limit of the total number of messages in
      history.
    - `history_seconds`: send only messages received in the last
      `history_seconds` seconds.
    - `history_since`: Send only the messages received since the
      dateTime specified (UTC).
:Types:
    - `password`: `unicode`
    - `history_maxchars`: `int`
    - `history_maxstanzas`: `int`
    - `history_seconds`: `int`
    - `history_since`: `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.
:Types:
    - `stanza`: `MucPresence`

process_configuration_error(self, stanza)

Process error response for a room configuration request.

:Parameters:
    - `stanza`: the stanza received.
:Types:
    - `stanza`: `Presence`

process_configuration_form_error(self, stanza)

Process error response for a room configuration form request.

:Parameters:
    - `stanza`: the stanza received.
:Types:
    - `stanza`: `Presence`

process_configuration_form_success(self, stanza)

Process successful result of a room configuration form request.

:Parameters:
    - `stanza`: the stanza received.
:Types:
    - `stanza`: `Presence`

process_configuration_success(self, stanza)

Process success response for a room configuration request.

:Parameters:
    - `stanza`: the stanza received.
:Types:
    - `stanza`: `Presence`

process_error_message(self, stanza)

Process <message type="error"/> received from the room.

:Parameters:
    - `stanza`: the stanza received.
:Types:
    - `stanza`: `Message`

process_error_presence(self, stanza)

Process <presence type="error"/> received from the room.

:Parameters:
    - `stanza`: the stanza received.
:Types:
    - `stanza`: `Presence`

process_groupchat_message(self, stanza)

Process <message type="groupchat"/> received from the room.

:Parameters:
    - `stanza`: the stanza received.
:Types:
    - `stanza`: `Message`

process_unavailable_presence(self, stanza)

Process <presence type="unavailable"/> received from the room.

:Parameters:
    - `stanza`: the stanza received.
:Types:
    - `stanza`: `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.

:return: id of the request stanza.
:returntype: `unicode`

request_instant_room(self)

Request an "instant room" -- the default configuration for a MUC room.

:return: id of the request stanza.
:returntype: `unicode`

send_message(self, body)

Send a message to the room.

:Parameters:
    - `body`: the message body.
:Types:
    - `body`: `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.
:Types:
    - `stream`: `pyxmpp.stream.Stream`

set_subject(self, subject)

Send a subject change request to the room.

:Parameters:
    - `subject`: the new subject.
:Types:
    - `subject`: `unicode`

Generated by Epydoc 2.1 on Wed May 31 22:36:59 2006 http://epydoc.sf.net