changeset a1edfd74d825 in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=a1edfd74d825
description: Correctly fake NullClientCaps: Assume we support everything instead of the blacklisted features.
diffstat:
src/common/caps_cache.py | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diffs (38 lines):
diff -r aec976f0a6b7 -r a1edfd74d825 src/common/caps_cache.py
--- a/src/common/caps_cache.py Mon Dec 28 20:58:34 2009 +0100
+++ b/src/common/caps_cache.py Mon Dec 28 21:29:51 2009 +0100
@@ -47,6 +47,7 @@
NEW = 0
QUERIED = 1
CACHED = 2 # got the answer
+FAKED = 3 # allow NullClientCaps to behave as it has a cached item
################################################################################
### Public API of this module
@@ -67,7 +68,7 @@
supported_features = cache_item.features
if requested_feature in supported_features:
return True
- elif supported_features == [] and cache_item.status in (NEW, QUERIED):
+ elif not supported_features and cache_item.status in (NEW, QUERIED, FAKED):
# assume feature is supported, if we don't know yet, what the client
# is capable of
return requested_feature not in FEATURE_BLACKLIST
@@ -262,7 +263,7 @@
# lookup something which does not exist to get a new CacheItem created
cache_item = caps_cache[('dummy', '')]
# Mark the item as cached so that protocol/caps.py does not update it
- cache_item.status = CACHED
+ cache_item.status = FAKED
return cache_item
def _discover(self, connection, jid):
@@ -354,7 +355,7 @@
Returns True if identities and features for this cache item
are known.
"""
- return self.status == CACHED
+ return self.status in (CACHED, FAKED)
self.__CacheItem = CacheItem
self.logger = logger
changeset 775b0b18efb1 in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=775b0b18efb1
description: Create index on the logs table on time instead of on kind.
That way we can search through all logs in constant time instead of having to perform a full table scan.
diffstat:
src/common/check_paths.py | 2 +-
src/common/defs.py | 2 +-
src/common/optparser.py | 23 +++++++++++++++++++++++
3 files changed, 25 insertions(+), 2 deletions(-)
diffs (62 lines):
diff -r 9bc4f60a4a17 -r 775b0b18efb1 src/common/check_paths.py
--- a/src/common/check_paths.py Sun Dec 27 16:23:31 2009 +0100
+++ b/src/common/check_paths.py Sun Dec 27 16:50:43 2009 +0100
@@ -79,7 +79,7 @@
subject TEXT
);
- CREATE INDEX idx_logs_jid_id_kind ON logs (jid_id, kind);
+ CREATE INDEX idx_logs_jid_id_time ON logs (jid_id, time DESC);
CREATE TABLE caps_cache (
hash_method TEXT,
diff -r 9bc4f60a4a17 -r 775b0b18efb1 src/common/defs.py
--- a/src/common/defs.py Sun Dec 27 16:23:31 2009 +0100
+++ b/src/common/defs.py Sun Dec 27 16:50:43 2009 +0100
@@ -27,7 +27,7 @@
basedir = '../'
localedir = '../po'
-version = '0.13.10.0-dev'
+version = '0.13.10.1-dev'
import sys, os.path
for base in ('.', 'common'):
diff -r 9bc4f60a4a17 -r 775b0b18efb1 src/common/optparser.py
--- a/src/common/optparser.py Sun Dec 27 16:23:31 2009 +0100
+++ b/src/common/optparser.py Sun Dec 27 16:50:43 2009 +0100
@@ -214,6 +214,8 @@
self.update_config_to_01258()
if old < [0, 13, 10, 0] and new >= [0, 13, 10, 0]:
self.update_config_to_013100()
+ if old < [0, 13, 10, 1] and new >= [0, 13, 10, 1]:
+ self.update_config_to_013101()
gajim.logger.init_vars()
gajim.config.set('version', new_version)
@@ -857,4 +859,25 @@
con.close()
gajim.config.set('version', '0.13.10.0')
+ def update_config_to_013101(self):
+ back = os.getcwd()
+ os.chdir(logger.LOG_DB_FOLDER)
+ con = sqlite.connect(logger.LOG_DB_FILE)
+ os.chdir(back)
+ cur = con.cursor()
+ try:
+ cur.executescript(
+ '''
+ DROP INDEX IF EXISTS idx_logs_jid_id_kind;
+
+ CREATE INDEX IF NOT EXISTS
+ idx_logs_jid_id_time ON logs (jid_id, time DESC);
+ '''
+ )
+ con.commit()
+ except sqlite.OperationalError:
+ pass
+ con.close()
+ gajim.config.set('version', '0.13.10.1')
+
# vim: se ts=3:
changeset 9bc4f60a4a17 in /home/hg/repos/gajim
details:http://hg.gajim.org/gajim?cmd=changeset;node=9bc4f60a4a17
description: Show warning if calculated and received caps hash are different.
diffstat:
src/common/caps_cache.py | 5 +++--
src/common/protocol/caps.py | 5 ++++-
2 files changed, 7 insertions(+), 3 deletions(-)
diffs (43 lines):
diff -r f6c4bf3a5767 -r 9bc4f60a4a17 src/common/caps_cache.py
--- a/src/common/caps_cache.py Tue Dec 22 21:31:11 2009 +0200
+++ b/src/common/caps_cache.py Sun Dec 27 16:23:31 2009 +0100
@@ -251,7 +251,8 @@
def _lookup_in_cache(self, caps_cache):
# lookup something which does not exist to get a new CacheItem created
cache_item = caps_cache[('dummy', '')]
- assert cache_item.status != CACHED
+ # Mark the item as cached so that protocol/caps.py does not update it
+ cache_item.status = CACHED
return cache_item
def _discover(self, connection, jid):
@@ -390,4 +391,4 @@
else:
q.update_last_seen()
-# vim: se ts=3:
\ No newline at end of file
+# vim: se ts=3:
diff -r f6c4bf3a5767 -r 9bc4f60a4a17 src/common/protocol/caps.py
--- a/src/common/protocol/caps.py Tue Dec 22 21:31:11 2009 +0200
+++ b/src/common/protocol/caps.py Sun Dec 27 16:23:31 2009 +0100
@@ -90,6 +90,8 @@
cache_item = lookup(self._capscache)
if cache_item.is_valid():
+ # we already know that the hash is fine and have already cached
+ # the identities and features
return
else:
validate = contact.client_caps.get_hash_validation_strategy()
@@ -101,8 +103,9 @@
node = caps_hash = hash_method = None
contact.client_caps = self._create_suitable_client_caps(node,
caps_hash, hash_method)
+ log.warn("Computed and retrieved caps hash differ." +
+ "Ignoring caps of contact %s" % contact.get_full_jid())
self._dispatch_event('CAPS_RECEIVED', (jid,))
-
# vim: se ts=3: