Home | Trees | Index | Help |
|
---|
Package pyxmpp :: Module client :: Class Client |
|
JabberClient
Base class for an XMPP-IM client. This class does not provide any JSF extensions to the XMPP protocol, including legacy authentication methods. :Ivariables: - `jid`: configured JID of the client (current actual JID is avialable as `self.stream.jid`). - `password`: authentication password. - `server`: server to use if non-standard and not discoverable by SRV lookups. - `port`: port number on the server to use if non-standard and not discoverable by SRV lookups. - `auth_methods`: methods allowed for stream authentication. SASL mechanism names should be preceded with "sasl:" prefix. - `keepalive`: keepalive interval for the stream or 0 when keepalive is disabled. - `stream`: current stream when the client is connected, `None` otherwise. - `roster`: user's roster or `None` if the roster is not yet retrieved. - `session_established`: `True` when an IM session is established. - `lock`: lock for synchronizing `Client` attributes access. - `state_changed`: condition notified the the object state changes (stream becomes connected, session established etc.). :Types: - `jid`: `pyxmpp.JID` - `password`: `unicode` - `server`: `unicode` - `port`: `int` - `auth_methods`: `list` of `str` - `keepalive`: `int` - `stream`: `pyxmpp.ClientStream` - `roster`: `pyxmpp.Roster` - `session_established`: `bool` - `lock`: `threading.RLock` - `state_changed`: `threading.Condition`
Method Summary | |
---|---|
Initialize a Client object. | |
Handle "authenticated" event. | |
Handle "authorized" event. | |
Connect to the server and set up the stream. | |
Handle "connected" event. | |
Disconnect from the server. | |
Handle "disconnected" event. | |
Get the socket object of the active connection. | |
Get the connected stream object. | |
Do some "housekeeping" work like cache expiration or timeout handling. | |
Simple "main loop" for the client. | |
Request the user's roster. | |
Request an IM session. | |
Handle roster update event. | |
Handle session started event. | |
Handle stream closure event. | |
Handle stream creation event. | |
Handle stream error received. | |
Handle any stream state change. |
Method Details |
---|
__init__(self,
jid=None,
password=None,
server=None,
port=5222,
auth_methods=('sasl:DIGEST-MD5',),
tls_settings=None,
keepalive=0)
|
authenticated(self)Handle "authenticated" event. May be overriden in derived classes. This one does nothing. |
authorized(self)Handle "authorized" event. May be overriden in derived classes. This one requests an IM session. |
connect(self, register=False)Connect to the server and set up the stream. Set `self.stream` and notify `self.state_changed` when connection succeeds. |
connected(self)Handle "connected" event. May be overriden in derived classes. This one does nothing. |
disconnect(self)Disconnect from the server. |
disconnected(self)Handle "disconnected" event. May be overriden in derived classes. This one does nothing. |
get_socket(self)Get the socket object of the active connection. :return: socket used by the stream. :returntype: `socket.socket` |
get_stream(self)Get the connected stream object. :return: stream object or `None` if the client is not connected. :returntype: `pyxmpp.ClientStream` |
idle(self)Do some "housekeeping" work like cache expiration or timeout handling. Should be called periodically from the application main loop. May be overriden in derived classes. |
loop(self, timeout=1)Simple "main loop" for the client. By default just call the `pyxmpp.Stream.loop_iter` method of `self.stream`, which handles stream input and `self.idle` for some "housekeeping" work until the stream is closed. This usually will be replaced by something more sophisticated. E.g. handling of other input sources. |
request_roster(self)Request the user's roster. |
request_session(self)Request an IM session. |
roster_updated(self, item=None)Handle roster update event. May be overriden in derived classes. This one does nothing. :Parameters: - `item`: the roster item changed or `None` if whole roster was received. :Types: - `item`: `pyxmpp.RosterItem` |
session_started(self)Handle session started event. May be overriden in derived classes. This one requests the user's roster and sends the initial presence. |
stream_closed(self, stream)Handle stream closure event. May be overriden in derived classes. This one does nothing. :Parameters: - `stream`: the new stream. :Types: - `stream`: `pyxmpp.ClientStream` |
stream_created(self, stream)Handle stream creation event. May be overriden in derived classes. This one does nothing. :Parameters: - `stream`: the new stream. :Types: - `stream`: `pyxmpp.ClientStream` |
stream_error(self, err)Handle stream error received. May be overriden in derived classes. This one passes an error messages to logging facilities. :Parameters: - `err`: the error element received. :Types: - `err`: `pyxmpp.error.StreamErrorNode` |
stream_state_changed(self, state, arg)Handle any stream state change. May be overriden in derived classes. This one does nothing. :Parameters: - `state`: the new state. - `arg`: state change argument. :Types: - `state`: `str` |
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.1 on Wed May 31 22:36:58 2006 | http://epydoc.sf.net |