From 4a590d1497e332da8b85a6807ad0ba9f277e2cbe Mon Sep 17 00:00:00 2001
From: Lance Stout <lancestout@gmail.com>
Date: Sun, 26 May 2013 14:53:28 -0700
Subject: Simplify stream method unregistration process

---
 sleekxmpp/plugins/xep_0095/stream_initiation.py | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

(limited to 'sleekxmpp/plugins')

diff --git a/sleekxmpp/plugins/xep_0095/stream_initiation.py b/sleekxmpp/plugins/xep_0095/stream_initiation.py
index b72c840f..927248a5 100644
--- a/sleekxmpp/plugins/xep_0095/stream_initiation.py
+++ b/sleekxmpp/plugins/xep_0095/stream_initiation.py
@@ -73,15 +73,16 @@ class XEP_0095(BasePlugin):
             pass
 
     def register_method(self, method, plugin_name, order=50):
-        self._methods[method] = plugin_name
+        self._methods[method] = (plugin_name, order)
         self._methods_order.append((order, method, plugin_name))
         self._methods_order.sort()
 
-    def unregister_method(self, method, plugin_name, order):
+    def unregister_method(self, method):
         if method in self._methods:
+            plugin_name, order = self._methods[method]
             del self._methods[method]
-        self._methods_order.remove((order, method, plugin_name))
-        self._methods_order.sort()
+            self._methods_order.remove((order, method, plugin_name))
+            self._methods_order.sort()
 
     def _handle_request(self, iq):
         profile = iq['si']['profile']
@@ -173,7 +174,7 @@ class XEP_0095(BasePlugin):
         if ifrom is None:
             ifrom = self.xmpp.boundjid
 
-        method_plugin = self._methods[stream['method']]
+        method_plugin = self._methods[stream['method']][0]
         self.xmpp[method_plugin].api['preauthorize_sid'](ifrom, sid, jid)
 
         self.api['del_pending'](ifrom, sid, jid)
-- 
cgit v1.2.3