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.TimeoutHandler: __metaclass__

Instance Methods [hide private]
 
__init__(self, jid, handlers, settings=None, main_loop=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_authenticated(self, event)
Handle the AuthenticatedEvent.
 
_stream_authorized(self, event)
Handle the AuthorizedEvent.
 
_stream_disconnected(self, event)
Handle stream disconnection event.
int
regular_tasks(self)
Do some housekeeping (cache expiration, timeout handling).
 
base_handlers_factory(self)
Default base client handlers factory.
 
roster_client_factory(self)
Creates the RosterClient instance for the roster_client attribute.

Inherited from stanzaprocessor.StanzaProcessor: check_to, clear_response_handlers, fix_in_stanza, fix_out_stanza, process_iq, process_message, process_presence, process_stanza, route_stanza, send, set_response_handlers, setup_stanza_handlers, uplink_receive

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]

Inherited from mainloop.interfaces.TimeoutHandler: __abstractmethods__

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).
main_loop.interfaces.MainLoop main_loop
the main loop object
RosterClient roster_client
the roster interface object
XMPPSettings settings
configuration settings
clientstream.ClientStream stream
the stream object when connected

Inherited from stanzaprocessor.StanzaProcessor: lock, me, peer, process_all_stanzas, uplink

Properties [hide private]
  roster
Current roster.

Inherited from object: __class__

Method Details [hide private]

__init__(self, jid, handlers, settings=None, main_loop=None)
(Constructor)

 
Initialize a Client object.
Parameters:
Overrides: object.__init__

run(self, timeout=None)

 

Call the main loop.

Convenience wrapper for self.main_loop.loop

_stream_authenticated(self, event)

 
Handle the AuthenticatedEvent.
Decorators:
  • @event_handler(AuthenticatedEvent)

_stream_authorized(self, event)

 
Handle the AuthorizedEvent.
Decorators:
  • @event_handler(AuthorizedEvent)

_stream_disconnected(self, event)

 
Handle stream disconnection event.
Decorators:
  • @event_handler(DisconnectedEvent)

regular_tasks(self)

 

Do some housekeeping (cache expiration, timeout handling).

This method should be called periodically from the application's main loop.

Returns: int
suggested delay (in seconds) before the next call to this method.
Decorators:
  • @timeout_handler(1)

base_handlers_factory(self)

 

Default base client handlers factory.

Subclasses can provide different behaviour by overriding this.

Returns:
list of handlers

roster_client_factory(self)

 

Creates the RosterClient instance for the roster_client attribute.

Subclasses can provide different behaviour by overriding this. The overriding method can return None if no roster client is needed.

Returns:
RosterClient

Property Details [hide private]

roster

Current roster.

Shortcut for self.roster_client.roster.

Get Method:
unreachable.roster(self) - Current roster.