pyxmpp.jabber.client.JabberClient

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

# Class JabberClient

source code

    client.Client --+
                    |
                   JabberClient

Base class for a Jabber client.

Instance Methods | [hide private]
__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``'`) Initialize a JabberClient object. | source code
connect(self, register=False) Connect to the server and set up the stream. | source code
register_feature(self, feature_name) Register a feature to be announced by Service Discovery. | source code
unregister_feature(self, feature_name) Unregister a feature to be announced by Service Discovery. | source code
submit_registration_form(self, form) Submit a registration form | source code
__disco_info(self, iq) Handle a disco#info request. | source code
__disco_items(self, iq) Handle a disco#items request. | source code
_session_started(self) Called when session is started. | source code
authorized(self) Handle "authorized" event. | source code
DiscoInfo |
disco_get_info(self, node, iq) Return Disco#info data for a node. | source code
DiscoInfo |
disco_get_items(self, node, iq) Return Disco#items data for a node. | source code
process_registration_form(self, stanza, form) Fill-in the registration form provided by the server. | source code
Inherited from `client.Client`: `authenticated`, `connected`, `disconnect`, `disconnected`, `get_socket`, `get_stream`, `idle`, `loop`, `request_roster`, `request_session`, `roster_updated`, `session_started`, `stream_closed`, `stream_created`, `stream_error`, `stream_state_changed`

Instance Variables | [hide private]
| disco_identity : default identity of the default disco_info.
: DiscoInfo | disco_info : default Disco#info reply for a query to an empty node -- provides information about the client and its supported fetures.
: DiscoItems | disco_items : default Disco#items reply for a query to an empty node.
: `bool` | register : when `True` than registration will be started instead of authentication.
Inherited from `client.Client`: `auth_methods`, `interface_providers`, `jid`, `keepalive`, `lock`, `password`, `port`, `roster`, `server`, `session_established`, `state_changed`, `stream`

Method Details | [hide private]

### __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) | source code
Initialize a JabberClient object. Parameters: `jid` (: pyxmpp.JID) - : user full JID for the connection. `password` (: `unicode`) - : user password. `server` (: `unicode`) - : server to use. If not given then address will be derived form the JID. `port` (: `int`) - : port number to use. If not given then address will be derived form the JID. `auth_methods` (: sequence of `str`) - : sallowed authentication methods. SASL authentication mechanisms in the list should be prefixed with "sasl:" string. `tls_settings` (: pyxmpp.TLSSettings) - : settings for StartTLS -- TLSSettings instance. `keepalive` (: `int`) - : keepalive output interval. 0 to disable. `disco_name` (: `unicode`) - : name of the client identity in the disco#info replies. `disco_category` (: `unicode`) - : 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` (: `unicode`) - : type of the client identity in the disco#info replies. Use the types registered by Jabber Registrar Overrides: client.Client.__init__

### connect(self, register=False) | source code
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: client.Client.connect

### register_feature(self, feature_name) | source code
Register a feature to be announced by Service Discovery. Parameters: `feature_name` (: `unicode`) - : feature namespace or name.

### unregister_feature(self, feature_name) | source code
Unregister a feature to be announced by Service Discovery. Parameters: `feature_name` (: `unicode`) - : feature namespace or name.

### submit_registration_form(self, form) | source code
Submit a registration form Parameters: `form` (: pyxmpp.jabber.dataforms.Form) - : the form to submit

### __disco_info(self, iq) | source code
Handle a disco#info request. self.disco_get_info method will be used to prepare the query response. Parameters: `iq` (: pyxmpp.iq.Iq) - : the IQ stanza received.

### __disco_items(self, iq) | source code
Handle a disco#items request. self.disco_get_items method will be used to prepare the query response. Parameters: `iq` (: pyxmpp.iq.Iq) - : the IQ stanza received.

### _session_started(self) | source code
Called when session is started. Activates objects from `self.interface_provides` by installing their disco features. Overrides: client.Client._session_started

### authorized(self) | source code
Handle "authorized" event. May be overriden in derived classes. By default: request an IM session and setup Disco handlers. Overrides: client.Client.authorized

### disco_get_info(self, node, iq) | source code
Return Disco#info data for a node. Parameters: `node` (: `unicode`) - : the node queried. `iq` (: pyxmpp.iq.Iq) - : the request stanza received. Returns: DiscoInfo self.disco_info if `node` is empty or `None` otherwise.

### disco_get_items(self, node, iq) | source code
Return Disco#items data for a node. Parameters: `node` (: `unicode`) - : the node queried. `iq` (: pyxmpp.iq.Iq) - : the request stanza received. Returns: DiscoInfo self.disco_info if `node` is empty or `None` otherwise.

### process_registration_form(self, stanza, form) | source code
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` (: pyxmpp.iq.Iq) - : the stanza received. `form` (: pyxmpp.jabber.dataforms.Form) - : the registration form.