diff src/plugins/plugin_xep_0077.py @ 554:caad23285a38

plugin XEP-0077: misc fixes
author Goffi <goffi@goffi.org>
date Sun, 09 Dec 2012 23:24:53 +0100
parents 2c4016921403
children ca13633d3b6b
line wrap: on
line diff
--- a/src/plugins/plugin_xep_0077.py	Thu Dec 06 22:11:41 2012 +0100
+++ b/src/plugins/plugin_xep_0077.py	Sun Dec 09 23:24:53 2012 +0100
@@ -20,12 +20,9 @@
 """
 
 from logging import debug, info, error
-from twisted.words.protocols.jabber import client, jid
-from twisted.words.protocols.jabber import error as jab_error
+from twisted.words.protocols.jabber import jid
 from twisted.words.protocols.jabber.xmlstream import IQ
-from twisted.internet import reactor
 from sat.tools.xml_tools import dataForm2xml
-import pdb
 
 from wokkel import data_form
 
@@ -115,8 +112,8 @@
             answer_data['reason'] = 'unknown'
             answer_data={"message":_("Registration failed")}
         self.host.bridge.actionResult(answer_type, failure.value.stanza['id'], answer_data, profile)
-        if self.triggers.has_key(answer["from"]):
-            del self.triggers[answer["from"]]
+        if failure.value.stanza["from"] in self.triggers.has_key:
+            del self.triggers[failure.value.stanza["from"]]
 
     def in_band_submit(self, action, target, fields, profile):
         """Submit a form for registration, using data_form"""
@@ -138,6 +135,6 @@
         reg_request=IQ(client.xmlstream,'get')
         reg_request["from"]=client.jid.full()
         reg_request["to"] = to_jid.full()
-        query=reg_request.addElement('query', NS_REG)
-        reg_request.send(to_jid.full()).addCallbacks(self.reg_ok, self.reg_err, callbackArgs=[profile], errbackArgs=[profile])
+        reg_request.addElement('query', NS_REG)
+        reg_request.send(to_jid.full()).addCallbacks(self.reg_ok, self.reg_err, callbackArgs=[client.profile], errbackArgs=[client.profile])
         return reg_request["id"]