Package pyxmpp :: Package jabber :: Module muc :: Class MucRoomState
[hide private]

Class MucRoomState

source code

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

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

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

get_user(self, nick_or_jid, create=False)

source code 
Get a room user with given nick or JID.
Parameters:
  • nick_or_jid (unicode or JID) - the nickname or room JID of the user requested.
  • create (bool) - 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.
Returns: MucRoomUser
the named user or None

set_stream(self, stream)

source code 

Called when current stream changes.

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

Parameters:

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

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

send_message(self, body)

source code 
Send a message to the room.
Parameters:
  • body (unicode) - the message body.

set_subject(self, subject)

source code 
Send a subject change request to the room.
Parameters:
  • subject (unicode) - the new subject.

change_nick(self, new_nick)

source code 
Send a nick change request to the room.
Parameters:
  • new_nick (unicode) - the new nickname requested.

get_room_jid(self, nick=None)

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

get_nick(self)

source code 
Get own nick.
Returns: unicode
own nick.

process_available_presence(self, stanza)

source code 
Process <presence/> received from the room.
Parameters:

process_unavailable_presence(self, stanza)

source code 
Process <presence type="unavailable"/> received from the room.
Parameters:

process_groupchat_message(self, stanza)

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

process_error_message(self, stanza)

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

process_error_presence(self, stanza)

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

process_configuration_form_success(self, stanza)

source code 
Process successful result of a room configuration form request.
Parameters:
  • stanza (Presence) - the stanza received.

process_configuration_form_error(self, stanza)

source code 
Process error response for a room configuration form request.
Parameters:
  • stanza (Presence) - the stanza received.

request_configuration_form(self)

source code 

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: unicode
id of the request stanza.

process_configuration_success(self, stanza)

source code 
Process success response for a room configuration request.
Parameters:
  • stanza (Presence) - the stanza received.

process_configuration_error(self, stanza)

source code 
Process error response for a room configuration request.
Parameters:
  • stanza (Presence) - the stanza received.

configure_room(self, form)

source code 
Configure the room using the provided data. Do nothing if the provided form is of type 'cancel'.
Parameters:
  • form (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.
Returns: unicode
id of the request stanza or None if a 'cancel' form was provieded.

request_instant_room(self)

source code 
Request an "instant room" -- the default configuration for a MUC room.
Returns: unicode
id of the request stanza.

Instance Variable Details [hide private]

users

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