pyxmpp2.client.Client

Package pyxmpp2 :: Module client :: Class Client |
[hide private]

# Class Client

Base class for an XMPP-IM client.

Joins the MainLoop, ClientStream and some basic handlers together, so a client application needs only to add its handlers.

Nested Classes | [hide private]
Inherited from `mainloop.interfaces.EventHandler`: `__metaclass__`

Instance Methods | [hide private]
__init__(self, jid, handlers, settings=None, mainloop=None) Initialize a Client object. |
__del__(self) |
connect(self) Schedule a new XMPP c2s connection. |
disconnect(self) Gracefully disconnect from the server. |
close_stream(self) Close the stream immediately. |
_close_stream(self) Same as close_stream but with the lock acquired. |
run(self, timeout=None) Call the main loop. |
_stream_disconnected(self, event) Handle stream disconnection event. |
Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Class Variables | [hide private]
Inherited from `mainloop.interfaces.EventHandler`: `__abstractmethods__` Inherited from `mainloop.interfaces.EventHandler` (private): `_abc_cache`, `_abc_negative_cache`, `_abc_negative_cache_version`, `_abc_registry`

Instance Variables | [hide private]
| _ml_handlers list of handlers installed by this object to at the main loop
| handlers stream and main loop handlers provided via the constructor
jid.JID | jid configured JID of the client (current full JID is avialable as `self.stream.jid`).
`threading.RLock` | lock lock protecting the object
mainloop.interfaces.MainLoop | mainloop the main loop object
XMPPSettings | settings configuration settings
clientstream.ClientStream | stream the stream object when connected

Properties | [hide private]
Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, jid, handlers, settings=None, mainloop=None) (Constructor) |
Initialize a Client object. Parameters: `jid` (jid.JID) - user JID for the connection. `settings` (settings.XMPPSettings) - client settings. `mainloop` (mainloop.interfaces.MainLoop) - Main event loop to attach to. If None, a loop will be created. Overrides: object.__init__

### run(self, timeout=None) |
Call the main loop. Convenience wrapper for `self.mainloop.loop`

### _stream_disconnected(self, event) |
Handle stream disconnection event. Decorators: `@event_handler(DisconnectedEvent)`