Package src :: Module jabber_lib :: Class JabberClient
[hide private]
[frames] | no frames]

Class JabberClient

source code


Instance Methods [hide private]
 
__init__(self, *args, **kwargs)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
_auth_dispatch(self, stanza) source code
 
_build_stanza(self, stanza)
Builds one stanza according to the handlers we have registered via registerHandler or registerProtocol
source code
 
_check_signature(self, stanza, actions=None) source code
 
_check_signature_from_message(self, stanza, actions) source code
 
_create_signature(self, jid, action) source code
 
_fix_jid(self, jid) source code
 
_header_string(self) source code
 
_orig_dispatch(self, stanza) source code
 
_presence_callback(self, client, stanza)
If the roster is enabled, presence stanzas with type="subscribed" should never be received - the server will initiate a roster push instead
source code
 
_roster_callback(self, client, stanza) source code
 
_setupComms(self) source code
 
_strip_resource(self, jid) source code
 
_waitForResponse(self, ID, timeout=300) source code
 
add_trusted_cert(self, trusted_cert) source code
 
auth(self, username, password, resource, register=1)
Try to authenticate the username with the specified password If the authentication fails, try to register the user.
source code
 
cancel_subscription(self, jids) source code
 
connect(self)
Attempt to connect to specified host
source code
 
disconnect(self)
Safely disconnects from the connected server
source code
 
disconnectHandler(self, conn)
Called when a Network Error or disconnection occurs.
source code
 
fileno(self) source code
 
get_one_stanza(self, timeout=None)
Returns one stanza (or None if timeout is set)
source code
 
get_unique_id(self) source code
 
header(self) source code
 
jid_available(self, jid) source code
 
match_stanza_tags(self, stanza, tag_name, namespace=None)
Get the matching (child) tags of this stanza, possibly with the specified namespace
source code
 
process(self, timeout=None)
Receives incoming data (if any) and processes it.
source code
 
process_loop_hook(self) source code
 
read(self)
Reads incoming data.
source code
 
register(self, username, password) source code
 
retrieve_roster(self)
Request the roster.
source code
 
send(self, stanza)
Sends a jabber protocol element (Node) to the server
source code
 
send_message(self, jid, action) source code
 
send_presence(self, jid=None, type=None, xid=None) source code
 
set_jid_available(self, jid) source code
 
set_jid_unavailable(self, jid) source code
 
ssl_verify_callback(self, conn, cert, errnum, depth, ok) source code
 
subscribe_to_presence(self, jids)
Subscribe to these nodes' presence The subscription in jabber works like this:
source code
 
verify_peer(self, ssl) source code
 
waitForResponse(self, ID, timeout=300)
Blocks untils a protocol element with the given id is received.
source code

Inherited from jabber.jabber.Client: addRosterItem, deregister, discoverInfo, discoverItems, getRegInfo, getRoster, removeRosterItem, requestAgents, requestRegInfo, requestRoster, sendInitPresence, sendPresence, sendRegInfo, setRegInfo, updateRosterItem

Inherited from jabber.jabber.Client (private): _IqAgentsResult, _IqRegisterResult, _IqRosterManage, _discover, _presenceHandler

Inherited from jabber.jabber.Connection: SendAndWaitForResponse, dispatch, getAnID, registerHandler, registerProtocol, setDisconnectHandler, setIqHandler, setMessageHandler, setPresenceHandler

Inherited from jabber.jabber.Connection (private): _expectedIqHandler

Inherited from jabber.xmlstream.Client: getSocket

Inherited from jabber.xmlstream.Stream: disconnected, getIncomingID, getOutgoingID, log, timestampLog, write

Inherited from jabber.xmlstream.NodeBuilder: DEBUG, getDom, handle_data, unknown_endtag, unknown_starttag

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

Class Variables [hide private]
  BLOCK_SIZE = 1024
  _seq = 0
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, *args, **kwargs)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

_setupComms(self)

source code 
Overrides: jabber.xmlstream.Client._setupComms

auth(self, username, password, resource, register=1)

source code 

Try to authenticate the username with the specified password If the authentication fails, try to register the user. If that fails as well, then JabberQualifiedError is raised

Overrides: jabber.jabber.Client.auth

connect(self)

source code 

Attempt to connect to specified host

Overrides: jabber.xmlstream.Stream.connect

disconnect(self)

source code 

Safely disconnects from the connected server

Overrides: jabber.xmlstream.Stream.disconnect
(inherited documentation)

disconnectHandler(self, conn)

source code 

Called when a Network Error or disconnection occurs. Designed to be overidden

Overrides: jabber.xmlstream.Stream.disconnectHandler
(inherited documentation)

header(self)

source code 
Overrides: jabber.jabber.Connection.header

process(self, timeout=None)

source code 

Receives incoming data (if any) and processes it. Waits for data no more than timeout seconds.

Overrides: jabber.xmlstream.Stream.process
(inherited documentation)

read(self)

source code 

Reads incoming data. Blocks until done. Calls self.disconnected(self) if appropriate.

Overrides: jabber.xmlstream.Stream.read
(inherited documentation)

retrieve_roster(self)

source code 

Request the roster. Will register the roster callback, but the call will wait for the roster to be properly populated

send(self, stanza)

source code 

Sends a jabber protocol element (Node) to the server

Overrides: jabber.jabber.Connection.send
(inherited documentation)

subscribe_to_presence(self, jids)

source code 
Subscribe to these nodes' presence
The subscription in jabber works like this:

Contact 1    State Contact 1     State Contact 2   Contact 2
----------+-------------------+------------------+----------
subscribe  -> [ none + ask ]
                                 [ from ]       <- subscribed
              [ to ]
                                 [ from + ask ] <- subscribe
subscribed -> [ both ]
                                 [ both ]
----------+-------------------+------------------+----------

Enclosed in square brackets is the state when the communication took
place.

waitForResponse(self, ID, timeout=300)

source code 

Blocks untils a protocol element with the given id is received. If an error is received, waitForResponse returns None and self.lastErr and self.lastErrCode is set to the received error. If the operation times out (which only happens if a timeout value is given), waitForResponse will return None and self.lastErr will be set to "Timeout". Changed default from timeout=0 to timeout=300 to avoid hangs in scripts and such. If you _really_ want no timeout, just set it to 0

Overrides: jabber.jabber.Connection.waitForResponse
(inherited documentation)