Package pyxmpp :: Module presence :: Class Presence
[show private | hide private]
[frames | no frames]

Class Presence

Stanza --+
         |
        Presence

Known Subclasses:
MucPresence

Wraper object for <presence /> stanzas.
Method Summary
  __init__(self, xmlnode, from_jid, to_jid, stanza_type, stanza_id, show, status, priority, error, error_cond)
Initialize a Presence object.
Presence copy(self)
Create a deep copy of the presence stanza.
int get_priority(self)
Get presence priority.
unicode get_show(self)
Get presence "show" field.
unicode get_status(self)
Get presence status description.
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.
  set_priority(self, priority)
Change presence priority.
  set_show(self, show)
Change presence "show" field.
  set_status(self, status)
Change presence status description.
    Inherited from Stanza
  __del__(self)
  __eq__(self, other)
  __ne__(self, other)
  add_content(self, content)
Add an XML node to the stanza's payload.
  add_new_content(self, ns_uri, name)
Add a new XML element to the stanza payload.
  free(self)
Free the node associated with this Stanza object.
pyxmpp.error.StanzaErrorNode get_error(self)
Get stanza error information.
unicode get_from(self)
Get "from" attribute of the stanza.
unicode get_from_jid(self)
Get "from" attribute of the stanza.
unicode get_id(self)
Get "id" attribute of the stanza.
libxml2.xmlNode get_node(self)
Return the XML node wrapped into self.
unicode get_stanza_id(self)
Get "id" attribute of the stanza.
unicode get_stanza_type(self)
Get "type" attribute of the stanza.
unicode get_to(self)
Get "to" attribute of the stanza.
unicode get_to_jid(self)
Get "to" attribute of the stanza.
unicode get_type(self)
Get "type" attribute of the stanza.
str serialize(self)
Serialize the stanza into an UTF-8 encoded XML string.
  set_content(self, content)
Set stanza content to an XML node.
  set_from(self, from_jid)
Set "from" attribute of the stanza.
  set_id(self, stanza_id)
Set "id" attribute of the stanza.
  set_new_content(self, ns_uri, name)
Set stanza payload to a new XML element.
  set_to(self, to_jid)
Set "to" attribute of the stanza.
  set_type(self, stanza_type)
Set "type" attribute of the stanza.
  xpath_eval(self, expr, namespaces)
Evaluate an XPath expression on the stanza XML node.

Instance Variable Summary
    Inherited from Stanza
libxml2.xmlNode xmlnode: stanza XML node.
pyxmpp.error.StanzaErrorNode _error: pyxmpp.error.StanzaErrorNode describing the error associated with the stanza of type "error".

Class Variable Summary
str stanza_type = 'presence'

Method Details

__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)
(Constructor)

Initialize a Presence object.
Parameters:
xmlnode - 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.
           (type=unicode or libxml2.xmlNode or Stanza)
from_jid - sender JID.
           (type=JID)
to_jid - recipient JID.
           (type=JID)
stanza_type - staza type: one of: None, "available", "unavailable", "subscribe", "subscribed", "unsubscribe", "unsubscribed" or "error". "available" is automaticaly changed to_jid None.
           (type=unicode)
stanza_id - stanza id -- value of stanza's "id" attribute
           (type=unicode)
show - "show" field of presence stanza. One of: None, "away", "xa", "dnd", "chat".
           (type=unicode)
status - descriptive text for the presence stanza.
           (type=unicode)
priority - presence priority.
           (type=unicode)
error_cond - error condition name. Ignored if stanza_type is not "error"
           (type=unicode)
Overrides:
pyxmpp.stanza.Stanza.__init__

copy(self)

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

get_priority(self)

Get presence priority.
Returns:
value of stanza's priority. 0 if the stanza doesn't contain <priority/> element.
           (type=int)

get_show(self)

Get presence "show" field.
Returns:
value of stanza's <show/> field.
           (type=unicode)

get_status(self)

Get presence status description.
Returns:
value of stanza's <status/> field.
           (type=unicode)

make_accept_response(self)

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

make_deny_response(self)

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

make_error_response(self, cond)

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

set_priority(self, priority)

Change presence priority.
Parameters:
priority - new presence priority.
           (type=int)

set_show(self, show)

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

set_status(self, status)

Change presence status description.
Parameters:
status - descriptive text for the presence stanza.
           (type=unicode)

Class Variable Details

stanza_type

Type:
str
Value:
'presence'