fix property code in caps.py
This commit is contained in:
parent
30f1a15efb
commit
67bd94dd55
|
@ -98,26 +98,8 @@ class CapsCache(object):
|
||||||
# cached into db
|
# cached into db
|
||||||
ciself.hash_method = hash_method
|
ciself.hash_method = hash_method
|
||||||
ciself.hash = hash
|
ciself.hash = hash
|
||||||
|
ciself._features = []
|
||||||
@property
|
ciself._identities = []
|
||||||
def features():
|
|
||||||
def fget(self):
|
|
||||||
return self.getAttr('features')
|
|
||||||
def fset(self, value):
|
|
||||||
list_ = []
|
|
||||||
for feature in value:
|
|
||||||
list_.append(self.__names.setdefault(feature, feature))
|
|
||||||
self.setAttr('features', list_)
|
|
||||||
|
|
||||||
@property
|
|
||||||
def identities():
|
|
||||||
def fget(self):
|
|
||||||
return self.getAttr('identities')
|
|
||||||
def fset(self, value):
|
|
||||||
list_ = []
|
|
||||||
for identity in value:
|
|
||||||
list_.append(self.__names.setdefault(identity, identity))
|
|
||||||
self.setAttr('identities', list_)
|
|
||||||
|
|
||||||
# not cached into db:
|
# not cached into db:
|
||||||
# have we sent the query?
|
# have we sent the query?
|
||||||
|
@ -126,6 +108,24 @@ class CapsCache(object):
|
||||||
# 2 == got the answer
|
# 2 == got the answer
|
||||||
ciself.queried = 0
|
ciself.queried = 0
|
||||||
|
|
||||||
|
def _get_features(ciself):
|
||||||
|
return ciself._features
|
||||||
|
def _set_features(ciself, value):
|
||||||
|
ciself._features = []
|
||||||
|
for feature in value:
|
||||||
|
ciself._features.append(self.__names.setdefault(feature,
|
||||||
|
feature))
|
||||||
|
features = property(ciself._get_features, ciself._set_features)
|
||||||
|
|
||||||
|
def _get_identities(ciself):
|
||||||
|
return ciself._identities
|
||||||
|
def _set_identities(ciself, value):
|
||||||
|
ciself._identities = []
|
||||||
|
for identity in value:
|
||||||
|
ciself._identities.append(self.__names.setdefault(identity,
|
||||||
|
identity))
|
||||||
|
identities = property(ciself._get_identities, ciself._set_identities)
|
||||||
|
|
||||||
def update(ciself, identities, features):
|
def update(ciself, identities, features):
|
||||||
# NOTE: self refers to CapsCache object, not to CacheItem
|
# NOTE: self refers to CapsCache object, not to CacheItem
|
||||||
ciself.identities=identities
|
ciself.identities=identities
|
||||||
|
@ -213,7 +213,7 @@ class ConnectionCaps(object):
|
||||||
contact.caps_hash_method = hash_method
|
contact.caps_hash_method = hash_method
|
||||||
contact.caps_hash = hash
|
contact.caps_hash = hash
|
||||||
|
|
||||||
def _capsDiscoCB(self, jid, node, identities, features, data):
|
def _capsDiscoCB(self, jid, node, identities, features, dataforms):
|
||||||
contact = gajim.contacts.get_contact_from_full_jid(self.name, jid)
|
contact = gajim.contacts.get_contact_from_full_jid(self.name, jid)
|
||||||
if not contact:
|
if not contact:
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue