Fix the iq.send() function, and a bunch of places where it is called

This is a big-and-dirty commit with a bunch of cleanup, maybe breaking a few
things, and not fixing all iq.send() calls yet.
This commit is contained in:
Florent Le Coz
2014-07-30 17:52:59 +02:00
parent 2e571ac950
commit ab03ad54aa
22 changed files with 267 additions and 395 deletions
+1 -16
View File
@@ -9,7 +9,6 @@
import logging
import hashlib
import base64
import threading
from slixmpp import __version__
from slixmpp.stanza import StreamFeatures, Presence, Iq
@@ -65,8 +64,7 @@ class XEP_0115(BasePlugin):
self.xmpp.add_filter('out', self._filter_add_caps)
self.xmpp.add_event_handler('entity_caps', self._process_caps,
threaded=True)
self.xmpp.add_event_handler('entity_caps', self._process_caps)
if not self.xmpp.is_component:
self.xmpp.register_feature('caps',
@@ -90,9 +88,6 @@ class XEP_0115(BasePlugin):
disco.assign_verstring = self.assign_verstring
disco.get_verstring = self.get_verstring
self._processing_lock = threading.Lock()
self._processing = set()
def plugin_end(self):
self.xmpp['xep_0030'].del_feature(feature=stanza.Capabilities.namespace)
self.xmpp.del_filter('out', self._filter_add_caps)
@@ -164,13 +159,6 @@ class XEP_0115(BasePlugin):
except XMPPError:
return
# Only lookup the same caps once at a time.
with self._processing_lock:
if ver in self._processing:
log.debug('Already processing verstring %s' % ver)
return
self._processing.add(ver)
log.debug("New caps verification string: %s", ver)
try:
node = '%s#%s' % (pres['caps']['node'], ver)
@@ -185,9 +173,6 @@ class XEP_0115(BasePlugin):
except XMPPError:
log.debug("Could not retrieve disco#info results for caps for %s", node)
with self._processing_lock:
self._processing.remove(ver)
def _validate_caps(self, caps, hash, check_verstring):
# Check Identities
full_ids = caps.get_identities(dedupe=False)