Package libxml2dom :: Module xmpp :: Class Session
[show private | hide private]
[frames | no frames]

Class Session


An XMPP session.

Method Summary
  __init__(self, address, timeout, bufsize, encoding)
Initialise an XMPP session using the given 'address': a tuple of the form (hostname, port).
  connect(self, host)
  createAuth(self)
  createIq(self)
  createMessage(self)
  createPresence(self)
  createStanza(self, namespaceURI, localName)
  read(self)
Read as much as possible from the server.
  receive(self, timeout)
Wait for an incoming stanza, or as long as 'timeout' (in milliseconds), or forever if 'timeout' is omitted or set to None, returning either a stanza document (fragment) or None if nothing was received.
  send(self, stanza)
Send the 'stanza' to the server, returning a response stanza if an immediate response was provided, or None otherwise.
  write(self, s)
Write the plain string 's' to the server.
  _ready(self, timeout)
Return whether data can be read from the server, waiting as long as the specified 'timeout' (forever if set to None).
  _receive(self)
Return a stanza for data read from the server.

Class Variable Summary
str connect_str = '<?xml version="1.0"?>\n<stream:stream to=...
str disconnect_str = '</stream:stream>'

Method Details

__init__(self, address, timeout=500, bufsize=1024, encoding='utf-8')
(Constructor)

Initialise an XMPP session using the given 'address': a tuple of the
form (hostname, port). The optional 'timeout' (in milliseconds) is used
for polling the connection for new data, and the optional 'encoding'
specifies the character encoding employed in the communications.

read(self)

Read as much as possible from the server.

receive(self, timeout=None)

Wait for an incoming stanza, or as long as 'timeout' (in milliseconds),
or forever if 'timeout' is omitted or set to None, returning either a
stanza document (fragment) or None if nothing was received.

send(self, stanza)

Send the 'stanza' to the server, returning a response stanza if an
immediate response was provided, or None otherwise.

write(self, s)

Write the plain string 's' to the server.

_ready(self, timeout)

Return whether data can be read from the server, waiting as long as the
specified 'timeout' (forever if set to None).

_receive(self)

Return a stanza for data read from the server.

Class Variable Details

connect_str

Type:
str
Value:
'''<?xml version="1.0"?>
<stream:stream to=\'%s\' xmlns=\'jabber:client\' xmlns:stream=\'http:/\
/etherx.jabber.org/streams\' version=\'1.0\'>'''                       

disconnect_str

Type:
str
Value:
'</stream:stream>'                                                     

Generated by Epydoc 2.1 on Tue Sep 18 23:37:02 2007 http://epydoc.sf.net