Package pyxmpp :: Package jabber :: Module client :: Class JabberClient
[show private | hide private]
[frames | no frames]

Class JabberClient

Client --+
         |
        JabberClient


Base class for a Jabber client.

:Ivariables:
    - `disco_items`: default Disco#items reply for a query to an empty node.
    - `disco_info`: default Disco#info reply for a query to an empty node --
      provides information about the client and its supported fetures.
    - `disco_identity`: default identity of the default `disco_info`.
    - `register`: when `True` than registration will be started instead of authentication.
:Types:
    - `disco_items`: `DiscoItems`
    - `disco_info`: `DiscoInfo`
    - `register`: `bool`

Method Summary
  __init__(self, jid, password, server, port, auth_methods, tls_settings, keepalive, disco_name, disco_category, disco_type)
Initialize a JabberClient object.
  authorized(self)
Handle "authorized" event.
  connect(self, register)
Connect to the server and set up the stream.
  disco_get_info(self, node, iq)
Return Disco#info data for a node.
  disco_get_items(self, node, iq)
Return Disco#items data for a node.
  process_registration_form(self, stanza, form)
Fill-in the registration form provided by the server.
  register_feature(self, feature_name)
Register a feature to be announced by Service Discovery.
  submit_registration_form(self, form)
Submit a registration form...
  unregister_feature(self, feature_name)
Unregister a feature to be announced by Service Discovery.
  __disco_info(self, iq)
Handle a disco#info request.
  __disco_items(self, iq)
Handle a disco#items request.
    Inherited from Client
  authenticated(self)
Handle "authenticated" event.
  connected(self)
Handle "connected" event.
  disconnect(self)
Disconnect from the server.
  disconnected(self)
Handle "disconnected" event.
  get_socket(self)
Get the socket object of the active connection.
  get_stream(self)
Get the connected stream object.
  idle(self)
Do some "housekeeping" work like cache expiration or timeout handling.
  loop(self, timeout)
Simple "main loop" for the client.
  request_roster(self)
Request the user's roster.
  request_session(self)
Request an IM session.
  roster_updated(self, item)
Handle roster update event.
  session_started(self)
Handle session started event.
  stream_closed(self, stream)
Handle stream closure event.
  stream_created(self, stream)
Handle stream creation event.
  stream_error(self, err)
Handle stream error received.
  stream_state_changed(self, state, arg)
Handle any stream state change.

Method Details

__init__(self, jid=None, password=None, server=None, port=5222, auth_methods=('sasl:DIGEST-MD5', 'digest'), tls_settings=None, keepalive=0, disco_name=u'pyxmpp based Jabber client', disco_category=u'client', disco_type=u'pc')
(Constructor)

Initialize a JabberClient object.

:Parameters:
    - `jid`: user full JID for the connection.
    - `password`: user password.
    - `server`: server to use. If not given then address will be derived form the JID.
    - `port`: port number to use. If not given then address will be derived form the JID.
    - `auth_methods`: sallowed authentication methods. SASL authentication mechanisms
      in the list should be prefixed with "sasl:" string.
    - `tls_settings`: settings for StartTLS -- `TLSSettings` instance.
    - `keepalive`: keepalive output interval. 0 to disable.
    - `disco_name`: name of the client identity in the disco#info
      replies.
    - `disco_category`: category of the client identity in the disco#info
      replies. The default of u'client' should be the right choice in
      most cases.
    - `disco_type`: type of the client identity in the disco#info
      replies. Use `the types registered by Jabber Registrar <http://www.jabber.org/registrar/disco-categories.html>`__
:Types:
    - `jid`: `pyxmpp.JID`
    - `password`: `unicode`
    - `server`: `unicode`
    - `port`: `int`
    - `auth_methods`: sequence of `str`
    - `tls_settings`: `pyxmpp.TLSSettings`
    - `keepalive`: `int`
    - `disco_name`: `unicode`
    - `disco_category`: `unicode`
    - `disco_type`: `unicode`
Overrides:
pyxmpp.client.Client.__init__

authorized(self)

Handle "authorized" event. May be overriden in derived classes.
By default: request an IM session and setup Disco handlers.
Overrides:
pyxmpp.client.Client.authorized

connect(self, register=False)

Connect to the server and set up the stream.

Set `self.stream` and notify `self.state_changed` when connection
succeeds. Additionally, initialize Disco items and info of the client.
Overrides:
pyxmpp.client.Client.connect

disco_get_info(self, node, iq)

Return Disco#info data for a node.

:Parameters:
    - `node`: the node queried.
    - `iq`: the request stanza received.
:Types:
    - `node`: `unicode`
    - `iq`: `pyxmpp.iq.Iq`

:return: self.disco_info if `node` is empty or `None` otherwise.
:returntype: `DiscoInfo`

disco_get_items(self, node, iq)

Return Disco#items data for a node.

:Parameters:
    - `node`: the node queried.
    - `iq`: the request stanza received.
:Types:
    - `node`: `unicode`
    - `iq`: `pyxmpp.iq.Iq`

:return: self.disco_info if `node` is empty or `None` otherwise.
:returntype: `DiscoInfo`

process_registration_form(self, stanza, form)

Fill-in the registration form provided by the server.

This default implementation fills-in "username" and "passwords"
fields only and instantly submits the form.

:Parameters:
    - `stanza`: the stanza received.
    - `form`: the registration form.
:Types:
    - `stanza`: `pyxmpp.iq.Iq`
    - `form`: `pyxmpp.jabber.dataforms.Form`

register_feature(self, feature_name)

Register a feature to be announced by Service Discovery.

:Parameters:
    - `feature_name`: feature namespace or name.
:Types:
    - `feature_name`: `unicode`

submit_registration_form(self, form)

Submit a registration form

:Parameters:
    - `form`: the form to submit
:Types:
    - `form`: `pyxmpp.jabber.dataforms.Form`

unregister_feature(self, feature_name)

Unregister a feature to be announced by Service Discovery.

:Parameters:
    - `feature_name`: feature namespace or name.
:Types:
    - `feature_name`: `unicode`

__disco_info(self, iq)

Handle a disco#info request.

`self.disco_get_info` method will be used to prepare the query response.

:Parameters:
    - `iq`: the IQ stanza received.
:Types:
    - `iq`: `pyxmpp.iq.Iq`

__disco_items(self, iq)

Handle a disco#items request.

`self.disco_get_items` method will be used to prepare the query response.

:Parameters:
    - `iq`: the IQ stanza received.
:Types:
    - `iq`: `pyxmpp.iq.Iq`

Generated by Epydoc 2.1 on Wed May 31 22:37:00 2006 http://epydoc.sf.net