Update a few outdated comments.
This commit is contained in:
parent
33fe53ff7d
commit
213fd5a8ed
3 changed files with 8 additions and 16 deletions
|
@ -1824,7 +1824,6 @@ class ChatControl(ChatControlBase):
|
||||||
self._schedule_activity_timers()
|
self._schedule_activity_timers()
|
||||||
|
|
||||||
def _on_sent(id_, contact, message, encrypted, xhtml):
|
def _on_sent(id_, contact, message, encrypted, xhtml):
|
||||||
# XXX: Once we have fallback to disco, remove notexistant check
|
|
||||||
if contact.supports(NS_RECEIPTS) and gajim.config.get_per('accounts',
|
if contact.supports(NS_RECEIPTS) and gajim.config.get_per('accounts',
|
||||||
self.account, 'request_receipt'):
|
self.account, 'request_receipt'):
|
||||||
xep0184_id = id_
|
xep0184_id = id_
|
||||||
|
|
|
@ -29,10 +29,6 @@ Module containing all XEP-115 (Entity Capabilities) related classes
|
||||||
Basic Idea:
|
Basic Idea:
|
||||||
CapsCache caches features to hash relationships. The cache is queried
|
CapsCache caches features to hash relationships. The cache is queried
|
||||||
through ClientCaps objects which are hold by contact instances.
|
through ClientCaps objects which are hold by contact instances.
|
||||||
|
|
||||||
ClientCaps represent the client of contacts. It is set on the receive
|
|
||||||
of a presence. The respective jid is then queried with a disco if the advertised
|
|
||||||
client/hash is unknown.
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import gajim
|
import gajim
|
||||||
|
@ -42,12 +38,12 @@ from common.xmpp import NS_XHTML_IM, NS_RECEIPTS, NS_ESESSION, NS_CHATSTATES
|
||||||
# Features where we cannot safely assume that the other side supports them
|
# Features where we cannot safely assume that the other side supports them
|
||||||
FEATURE_BLACKLIST = [NS_CHATSTATES, NS_XHTML_IM, NS_RECEIPTS, NS_ESESSION]
|
FEATURE_BLACKLIST = [NS_CHATSTATES, NS_XHTML_IM, NS_RECEIPTS, NS_ESESSION]
|
||||||
|
|
||||||
|
|
||||||
class AbstractClientCaps(object):
|
class AbstractClientCaps(object):
|
||||||
'''
|
'''
|
||||||
Base class representing a client and its capabilities as advertised by
|
Base class representing a client and its capabilities as advertised by
|
||||||
a caps tag in a presence
|
a caps tag in a presence.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
def __init__(self, caps_hash, node):
|
def __init__(self, caps_hash, node):
|
||||||
self._hash = caps_hash
|
self._hash = caps_hash
|
||||||
self._node = node
|
self._node = node
|
||||||
|
@ -108,6 +104,7 @@ class OldClientCaps(AbstractClientCaps):
|
||||||
def _is_hash_valid(self, identities, features, dataforms):
|
def _is_hash_valid(self, identities, features, dataforms):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
class NullClientCaps(AbstractClientCaps):
|
class NullClientCaps(AbstractClientCaps):
|
||||||
'''
|
'''
|
||||||
This is a NULL-Object to streamline caps handling if a client has not
|
This is a NULL-Object to streamline caps handling if a client has not
|
||||||
|
@ -128,13 +125,13 @@ class NullClientCaps(AbstractClientCaps):
|
||||||
def _is_hash_valid(self, identities, features, dataforms):
|
def _is_hash_valid(self, identities, features, dataforms):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
class CapsCache(object):
|
class CapsCache(object):
|
||||||
'''
|
'''
|
||||||
This object keeps the mapping between caps data and real disco
|
This object keeps the mapping between caps data and real disco
|
||||||
features they represent, and provides simple way to query that info.
|
features they represent, and provides simple way to query that info.
|
||||||
'''
|
'''
|
||||||
def __init__(self, logger=None):
|
def __init__(self, logger=None):
|
||||||
''' Create a cache for entity capabilities. '''
|
|
||||||
# our containers:
|
# our containers:
|
||||||
# __cache is a dictionary mapping: pair of hash method and hash maps
|
# __cache is a dictionary mapping: pair of hash method and hash maps
|
||||||
# to CapsCacheItem object
|
# to CapsCacheItem object
|
||||||
|
@ -199,7 +196,6 @@ class CapsCache(object):
|
||||||
identities = property(_get_identities, _set_identities)
|
identities = property(_get_identities, _set_identities)
|
||||||
|
|
||||||
def update(self, identities, features):
|
def update(self, identities, features):
|
||||||
# NOTE: self refers to CapsCache object, not to CacheItem
|
|
||||||
self.identities = identities
|
self.identities = identities
|
||||||
self.features = features
|
self.features = features
|
||||||
self._logger.add_caps_entry(self.hash_method, self.hash,
|
self._logger.add_caps_entry(self.hash_method, self.hash,
|
||||||
|
@ -238,9 +234,10 @@ class CapsCache(object):
|
||||||
return x
|
return x
|
||||||
|
|
||||||
def query_client_of_jid_if_unknown(self, connection, jid, client_caps):
|
def query_client_of_jid_if_unknown(self, connection, jid, client_caps):
|
||||||
''' Preload data about (node, ver, exts) caps using disco
|
'''
|
||||||
query to jid using proper connection. Don't query if
|
Start a disco query to determine caps (node, ver, exts).
|
||||||
the data is already in cache. '''
|
Won't query if the data is already in cache.
|
||||||
|
'''
|
||||||
lookup_cache_item = client_caps.get_cache_lookup_strategy()
|
lookup_cache_item = client_caps.get_cache_lookup_strategy()
|
||||||
q = lookup_cache_item(self)
|
q = lookup_cache_item(self)
|
||||||
|
|
||||||
|
@ -258,13 +255,11 @@ class ConnectionCaps(object):
|
||||||
'''
|
'''
|
||||||
This class highly depends on that it is a part of Connection class.
|
This class highly depends on that it is a part of Connection class.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
def _capsPresenceCB(self, con, presence):
|
def _capsPresenceCB(self, con, presence):
|
||||||
'''
|
'''
|
||||||
Handle incoming presence stanzas... This is a callback for xmpp
|
Handle incoming presence stanzas... This is a callback for xmpp
|
||||||
registered in connection_handlers.py
|
registered in connection_handlers.py
|
||||||
'''
|
'''
|
||||||
|
|
||||||
# we will put these into proper Contact object and ask
|
# we will put these into proper Contact object and ask
|
||||||
# for disco... so that disco will learn how to interpret
|
# for disco... so that disco will learn how to interpret
|
||||||
# these caps
|
# these caps
|
||||||
|
|
|
@ -1299,8 +1299,6 @@ class Connection(ConnectionHandlers):
|
||||||
# please note that the only valid tag inside a message containing a <body>
|
# please note that the only valid tag inside a message containing a <body>
|
||||||
# tag is the active event
|
# tag is the active event
|
||||||
if chatstate is not None:
|
if chatstate is not None:
|
||||||
# XXX: Once we have fallback to disco,
|
|
||||||
# remove notexistant check
|
|
||||||
if ((composing_xep == 'XEP-0085' or not composing_xep) \
|
if ((composing_xep == 'XEP-0085' or not composing_xep) \
|
||||||
and composing_xep != 'asked_once') or \
|
and composing_xep != 'asked_once') or \
|
||||||
contact.supports(common.xmpp.NS_CHATSTATES):
|
contact.supports(common.xmpp.NS_CHATSTATES):
|
||||||
|
|
Loading…
Add table
Reference in a new issue