Package pyxmpp2 :: Module presence :: Class Presence
[hide private]

Class Presence


<presence /> stanza.
Instance Methods [hide private]
 
__init__(self, element=None, from_jid=None, to_jid=None, stanza_type=None, stanza_id=None, error=None, error_cond=None, return_path=None, language=None, show=None, status=None, priority=None)
Initialize a Presence object.
 
_decode_subelements(self)
Decode the stanza subelements.
ElementTree.Element
as_xml(self)
Return the XML stanza representation.
Presence
copy(self)
Create a deep copy of the stanza.
Presence
make_accept_response(self)
Create "accept" response for the "subscribe" / "subscribed" / "unsubscribe" / "unsubscribed" presence stanza.
Presence
make_deny_response(self)
Create "deny" response for the "subscribe" / "subscribed" / "unsubscribe" / "unsubscribed" presence stanza.
Presence
make_error_response(self, cond)
Create error response for the any non-error presence stanza.

Inherited from stanza.Stanza: add_payload, decode_payload, get_all_payload, get_payload, get_xml, mark_dirty, serialize, set_payload

Inherited from stanza.Stanza (private): _decode_attributes, _decode_error

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Methods [hide private]

Inherited from stanza.Stanza: gen_id

Class Variables [hide private]
  element_name = 'presence'

Inherited from stanza.Stanza: last_id

Instance Variables [hide private]

Inherited from stanza.Stanza (private): _error, _namespace, _payload, _return_path

Properties [hide private]
unicode show
Presence status type.
unicode status
Presence status message.
unicode priority
Presence priority.

Inherited from stanza.Stanza: error, from_jid, return_path, stanza_id, stanza_type, to_jid

Inherited from object: __class__

Method Details [hide private]

__init__(self, element=None, from_jid=None, to_jid=None, stanza_type=None, stanza_id=None, error=None, error_cond=None, return_path=None, language=None, show=None, status=None, priority=None)
(Constructor)

 
Initialize a Presence object.
Parameters:
  • element (ElementTree.Element) - XML element
  • from_jid (JID) - sender JID.
  • to_jid (JID) - recipient JID.
  • stanza_type (unicode) - staza type: one of: None, "available", "unavailable", "subscribe", "subscribed", "unsubscribe", "unsubscribed" or "error". "available" is automaticaly changed to None.
  • stanza_id (unicode) - stanza id -- value of stanza's "id" attribute
  • language (unicode) - default language for the stanza content
  • show (unicode) - "show" field of presence stanza. One of: None, "away", "xa", "dnd", "chat".
  • status (unicode) - descriptive text for the presence stanza.
  • priority (int) - presence priority.
  • error_cond (unicode) - error condition name. Ignored if stanza_type is not "error"
Overrides: object.__init__

as_xml(self)

 

Return the XML stanza representation.

Always return an independent copy of the stanza XML representation, which can be freely modified without affecting the stanza.

Returns: ElementTree.Element
Overrides: stanza.Stanza.as_xml

copy(self)

 
Create a deep copy of the stanza.
Returns: Presence
Overrides: stanza.Stanza.copy

make_accept_response(self)

 
Create "accept" response for the "subscribe" / "subscribed" / "unsubscribe" / "unsubscribed" presence stanza.
Returns: Presence
new stanza.

make_deny_response(self)

 
Create "deny" response for the "subscribe" / "subscribed" / "unsubscribe" / "unsubscribed" presence stanza.
Returns: Presence
new presence stanza.

make_error_response(self, cond)

 
Create error response for the any non-error presence stanza.
Parameters:
  • cond (unicode) - error condition name, as defined in XMPP specification.
Returns: Presence
new presence stanza.

Property Details [hide private]

show

Presence status type.
Get Method:
unreachable.show(self) - Presence status type.
Set Method:
unreachable.show(self, show)
Type:
unicode

status

Presence status message.
Get Method:
unreachable.status(self) - Presence status message.
Set Method:
unreachable.status(self, status)
Type:
unicode

priority

Presence priority.
Get Method:
unreachable.priority(self) - Presence priority.
Set Method:
unreachable.priority(self, priority)
Type:
unicode