Package common :: Module caps_cache
[hide private]
[frames] | no frames]

Module caps_cache

source code

Module containing all XEP-115 (Entity Capabilities) related classes

Basic Idea: CapsCache caches features to hash relationships. The cache is queried through ClientCaps objects which are hold by contact instances.

Classes [hide private]
  AbstractClientCaps
Base class representing a client and its capabilities as advertised by a caps tag in a presence
  ClientCaps
The current XEP-115 implementation
  OldClientCaps
Old XEP-115 implemtation.
  NullClientCaps
This is a NULL-Object to streamline caps handling if a client has not advertised any caps or has advertised them in an improper way
  CapsCache
This object keeps the mapping between caps data and real disco features they represent, and provides simple way to query that info
Functions [hide private]
 
initialize(logger)
Initialize this module
source code
 
client_supports(client_caps, requested_feature) source code
 
create_suitable_client_caps(node, caps_hash, hash_method)
Create and return a suitable ClientCaps object for the given node, caps_hash, hash_method combination.
source code
 
compute_caps_hash(identities, features, dataforms=[], hash_method='sha-1')
Compute caps hash according to XEP-0115, V1.5
source code
Variables [hide private]
  log = logging.getLogger('gajim.c.caps_cache')
  FEATURE_BLACKLIST = ['http://jabber.org/protocol/chatstates', ...
  NEW = 0
  QUERIED = 1
  CACHED = 2
  FAKED = 3
  capscache = None

Imports: base64, hashlib, logging, NS_XHTML_IM, NS_RECEIPTS, NS_ESESSION, NS_CHATSTATES, NS_JINGLE_ICE_UDP, NS_JINGLE_RTP_AUDIO, NS_JINGLE_RTP_VIDEO, NS_CAPS


Function Details [hide private]

initialize(logger)

source code 
Initialize this module

client_supports(client_caps, requested_feature)

source code 

create_suitable_client_caps(node, caps_hash, hash_method)

source code 
Create and return a suitable ClientCaps object for the given node, caps_hash, hash_method combination.

compute_caps_hash(identities, features, dataforms=[], hash_method='sha-1')

source code 

Compute caps hash according to XEP-0115, V1.5

dataforms are xmpp.DataForms objects as common.dataforms don't allow several values without a field type list-multi


Variables Details [hide private]

log

Value:
logging.getLogger('gajim.c.caps_cache')

FEATURE_BLACKLIST

Value:
['http://jabber.org/protocol/chatstates',
 'http://jabber.org/protocol/xhtml-im',
 'urn:xmpp:receipts',
 'http://www.xmpp.org/extensions/xep-0116.html#ns',
 'urn:xmpp:jingle:transports:ice-udp:1',
 'urn:xmpp:jingle:apps:rtp:audio',
 'urn:xmpp:jingle:apps:rtp:video']

NEW

Value:
0

QUERIED

Value:
1

CACHED

Value:
2

FAKED

Value:
3

capscache

Value:
None