| |
- xmlstream.Client
-
- Client
- JID
- Protocol
-
- Iq
- Message
- Presence
- Roster
class Client(xmlstream.Client) |
|
Class for managing a connection to a jabber server.
Inherits from the xmlstream Client class |
|
- DEBUG(self, txt) from xmlstream.Client
- SendAndWaitForResponse(self, obj, ID=None)
- Sends a protocol element object and blocks until a response with
the same ID is recieved
- __init__(self, host, port=5222, debug=0, log=0)
- _handle_data(self, data) from xmlstream.Client
- _unknown_endtag(self, tag) from xmlstream.Client
- _unknown_starttag(self, tag, attrs) from xmlstream.Client
- auth(self, username, passwd, resource)
- Authenticates and logs in to the specified jabber server
Automatically selects the 'best' authentication method
provided by the server.
Supports plain text, deigest and zero-k authentication
- connect(self)
- Attempts to connect to the specified jabber server.
Raises an IOError on failiure
- disconnect(self)
- Safely disconnects from the connected server
- disconnected(self)
- Called when a network error occurs - can be overidden
- dispatch(self, root_node)
- Called internally when a 'protocol element' is recieved.
builds the relevant jabber.py object and dispatches it
to a relevant function or callback.
Also does some processing for roster and authentication
helper fuctions
- getAnID(self)
- Returns a unique ID
- getRegInfo(self)
- Returns the last requested register dict.
- getRoster(self)
- Returns the current Roster() class instance. Does
not contect the server.
- getStreamID(self) from xmlstream.Client
- iqHandler(self, iq_obj)
- Called when an iq protocol element is recieved - can be
overidden
- log(self, data, inout='') from xmlstream.Client
- messageHandler(self, msg_obj)
- Called when a message protocol element is recieved - can be
overidden
- presenceHandler(self, pres_obj)
- Called when a pressence protocol element is recieved - can be
overidden
- process(self, timeout) from xmlstream.Client
- read(self) from xmlstream.Client
- removeRosterItem(self, jid)
- Removes an item with Jabber ID jid from both the
servers roster and the local interenal Roster()
instance
- requestAgents(self)
- Requests a list of available agents. returns a dict of
agents and info
- requestRegInfo(self, agent='')
- Requests registration info from the server.
returns a dict of required values.
- requestRoster(self)
- requests the roster from the server and returns a
Roster() class instance.
- send(self, what)
- Sends a jabber protocol element (Node) to the server
- sendInitPresence(self)
- Sends an empty presence protocol element to the
server. Used to 'tell' the server your online
- sendRegInfo(self, agent='')
- Sends the populated register dict back to the server
- setDisconnectHandler(self, func)
- Set the callback for a disconnect
- setIqHandler(self, func)
- Set the callback func for recieving iq's
- setMessageHandler(self, func)
- Set the callback func for recieving messages
- setPresenceHandler(self, func)
- Set the callback func for recieving presence
- setRegInfo(self, key, val)
- Sets a name/value attribute. Note: requestRegInfo must be
called before setting.
- waitForResponse(self, ID)
- Blocks untils a protocol element with ID id is recieved
- write(self, data_out='') from xmlstream.Client
|
class Iq(Protocol) |
|
Class for creating and managing jabber <iq> protocol
elements |
|
- __init__(self, to='', type=None, node=None)
- __repr__ = __str__(self) from Protocol
- __str__(self) from Protocol
- asNode(self) from Protocol
- getError(self)
- Returns the Iq's error string, if any
- getErrorCode(self)
- Returns the Iq's error code, if any
- getFrom(self) from Protocol
- getID(self) from Protocol
- getQuery(self)
- returns the query namespace
- getQueryNode(self)
- Returns any textual data contained by the query tag
- getQueryPayload(self)
- Returns the querys payload as a Node instance
- getTo(self) from Protocol
- getType(self) from Protocol
- getX(self) from Protocol
- getXNode(self) from Protocol
- getXPayload(self) from Protocol
- setError(self, val, code)
- Sets an Iq's error string and code
- setFrom(self, val) from Protocol
- setID(self, val) from Protocol
- setQuery(self, namespace)
- Sets a querys namespace, also inserts a query tag if
it doesn't already exist
- setQueryNode(self)
- Sets textual data contained by the query tag
- setQueryPayload(self, payload)
- Sets a Iq's query payload. Payload can be either a Node
structure or a valid xml document. The query tag is automatically
inserted if it doesn't already exist
- setTo(self, val) from Protocol
- setType(self, val) from Protocol
- setX(self, namespace) from Protocol
- setXNode(self, val='') from Protocol
- setXPayload(self, payload) from Protocol
|
class Message(Protocol) |
|
Builds on the Protocol class to provide an interface for sending
message protol elements |
|
- __init__(self, to=None, body=None, node=None)
- __repr__ = __str__(self) from Protocol
- __str__(self) from Protocol
- asNode(self) from Protocol
- build_reply(self, reply_txt='')
- Returns a new Message object as a reply to its self.self.
The reply message, has the to and type automatically
set.
- getBody(self)
- Returns the message body.
- getError(self)
- Returns the messgaes Error string, if any
- getErrorCode(self)
- Returns the messgaes Error Code, if any
- getFrom(self) from Protocol
- getID(self) from Protocol
- getSubject(self)
- Returns the messages subject.
- getThread(self)
- Returns the messages thread ID.
- getTimestamp(self)
- Not yet implemented
- getTo(self) from Protocol
- getType(self) from Protocol
- getX(self) from Protocol
- getXNode(self) from Protocol
- getXPayload(self) from Protocol
- setBody(self, val)
- Sets the message body text.
- setError(self, val, code)
- Sets the message error text
- setFrom(self, val) from Protocol
- setID(self, val) from Protocol
- setSubject(self, val)
- Sets the message subject text.
- setThread(self, val)
- Sets the message thread ID.
- setTimestamp(self, val)
- Not yet implemented
- setTo(self, val) from Protocol
- setType(self, val) from Protocol
- setX(self, namespace) from Protocol
- setXNode(self, val='') from Protocol
- setXPayload(self, payload) from Protocol
|
class Presence(Protocol) |
|
Class for creating and managing jabber <presence> protocol
elements |
|
- __init__(self, to=None, type=None, node=None)
- __repr__ = __str__(self) from Protocol
- __str__(self) from Protocol
- asNode(self) from Protocol
- getFrom(self) from Protocol
- getID(self) from Protocol
- getPriority(self)
- Returns the presence priority
- getShow(self)
- Returns the presence show
- getStatus(self)
- Returns the presence status
- getTo(self) from Protocol
- getType(self) from Protocol
- getX(self) from Protocol
- getXNode(self) from Protocol
- getXPayload(self) from Protocol
- setFrom(self, val) from Protocol
- setID(self, val) from Protocol
- setPriority(self, val)
- Sets the presence priority
- setShow(self, val)
- Sets the presence show
- setStatus(self, val)
- Sets the presence status
- setTo(self, val) from Protocol
- setType(self, val) from Protocol
- setX(self, namespace) from Protocol
- setXNode(self, val='') from Protocol
- setXPayload(self, payload) from Protocol
|
class Protocol |
|
Base class for jabber 'protocol elements' - messages, presences and iqs.
Implements methods that are common to all these |
|
- __init__(self)
- __repr__ = __str__(self)
- __str__(self)
- asNode(self)
- returns an xmlstreamnode representation of the protocol element
- getFrom(self)
- Returns a JID object of the from attribute of the element
- getID(self)
- Returns the ID attribute of the protocol element
- getTo(self)
- Returns a JID object of the to attr of the element
- getType(self)
- Returns the type attribute of the protocol element
- getX(self)
- returns the x namespace
- getXNode(self)
- Returns the x Node instance
- getXPayload(self)
- Returns the x tags payload as a Node instance
- setFrom(self, val)
- Sets the from JID of the protocol element
- setID(self, val)
- Sets the ID of the protocol element
- setTo(self, val)
- Sets the to JID of the protocol element
- setType(self, val)
- Sets the type attribute of the protocol element
- setX(self, namespace)
- Sets the name space of the x tag. It also creates the node
if it doesn't already exist
- setXNode(self, val='')
- Sets the x nodes data - just text
- setXPayload(self, payload)
- Sets the Child of the x tag. Can be a Node instance or a
XML document
|
class Roster |
|
A Class for simplifying roster management. Also tracks roster
items availability |
|
- __init__(self)
- _remove(self, jid)
- Used internally - private
- _set(self, jid, name, sub, ask)
- Used internally - private
- _setOnline(self, jid, val)
- Used internally - private
- _setShow(self, jid, val)
- Used internally - private
- _setStatus(self, jid, val)
- Used internally - private
- getAsk(self, jid)
- Gets the 'ask' status for a Roster item with JID jid
- getJIDs(self)
- Returns a list of JID instances of Roster entries
- getName(self, jid)
- Gets the 'name' for a Roster item with JID jid
- getOnline(self, jid)
- Gets the online status for a Roster item with JID jid
- getRaw(self)
- Returns the internal data representation of the roster
- getShow(self, jid)
- Gets the show for a Roster item with JID jid
- getStatus(self, jid)
- Gets the status for a Roster item with JID jid
- getSub(self, jid)
- Gets the subscription status for a Roster item with JID jid
- getSummary(self)
- Returns a list of basic ( no resource ) JID's with there
'availability' - online, offline, pending
- isOnline(self, jid)
- Returns TRUE if the jid is online, FALSE if not
| |