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

Class Presence

source code

stanza.Stanza --+
                |
               Presence
Known Subclasses:

Wraper object for <presence /> stanzas.
Instance Methods [hide private]
 
__init__(self, xmlnode=None, from_jid=None, to_jid=None, stanza_type=None, stanza_id=None, show=None, status=None, priority=0, error=None, error_cond=None, stream=None)
Initialize a Presence object.
source code
Presence
copy(self)
Create a deep copy of the presence stanza.
source code
int
get_priority(self)
Get presence priority.
source code
unicode
get_show(self)
Get presence "show" field.
source code
unicode
get_status(self)
Get presence status description.
source code
Presence
make_accept_response(self)
Create "accept" response for the "subscribe"/"subscribed"/"unsubscribe"/"unsubscribed" presence stanza.
source code
Presence
make_deny_response(self)
Create "deny" response for the "subscribe"/"subscribed"/"unsubscribe"/"unsubscribed" presence stanza.
source code
Presence
make_error_response(self, cond)
Create error response for the any non-error presence stanza.
source code
 
set_priority(self, priority)
Change presence priority.
source code
 
set_show(self, show)
Change presence "show" field.
source code
 
set_status(self, status)
Change presence status description.
source code

Inherited from stanza.Stanza: __del__, __eq__, __ne__, add_content, add_new_content, free, get_error, get_from, get_from_jid, get_id, get_node, get_stanza_id, get_stanza_type, get_to, get_to_jid, get_type, serialize, set_content, set_from, set_id, set_new_content, set_to, set_type, xpath_eval

Class Variables [hide private]
  stanza_type = 'presence'
Instance Variables [hide private]

Inherited from stanza.Stanza: stream, xmlnode

Inherited from stanza.Stanza (private): _error

Method Details [hide private]

__init__(self, xmlnode=None, from_jid=None, to_jid=None, stanza_type=None, stanza_id=None, show=None, status=None, priority=0, error=None, error_cond=None, stream=None)
(Constructor)

source code 
Initialize a Presence object.
Parameters:
  • xmlnode (: unicode or libxml2.xmlNode or Stanza) - : XML node to_jid be wrapped into the Presence object or other Presence object to be copied. If not given then new presence stanza is created using following parameters.
  • 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_jid None.
  • stanza_id (: unicode) - : stanza id -- value of stanza's "id" attribute
  • show (: unicode) - : "show" field of presence stanza. One of: None, "away", "xa", "dnd", "chat".
  • status (: unicode) - : descriptive text for the presence stanza.
  • priority (: unicode) - : presence priority.
  • error_cond (: unicode) - : error condition name. Ignored if stanza_type is not "error"
Overrides: stanza.Stanza.__init__

copy(self)

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

get_priority(self)

source code 
Get presence priority.
Returns: int
value of stanza's priority. 0 if the stanza doesn't contain <priority/> element.

get_show(self)

source code 
Get presence "show" field.
Returns: unicode
value of stanza's <show/> field.

get_status(self)

source code 
Get presence status description.
Returns: unicode
value of stanza's <status/> field.

make_accept_response(self)

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

make_deny_response(self)

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

make_error_response(self, cond)

source code 
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.

set_priority(self, priority)

source code 
Change presence priority.
Parameters:
  • priority (: int) - : new presence priority.

set_show(self, show)

source code 
Change presence "show" field.
Parameters:
  • show (: unicode) - : new value for the "show" field of presence stanza. One of: None, "away", "xa", "dnd", "chat".

set_status(self, status)

source code 
Change presence status description.
Parameters:
  • status (: unicode) - : descriptive text for the presence stanza.