comparison plugins/plugin_xep_0077.py @ 102:94011f553cd0

misc bugfixes - wix: added forgotten profile in gateways management - xml_tools: removed XMLClass to the 2 methods as a direct methods - plugin_xep_100 (gateways discovery): added error callback
author Goffi <goffi@goffi.org>
date Tue, 22 Jun 2010 13:58:53 +0800
parents 783e9d6980ec
children 6be927a465ed
comparison
equal deleted inserted replaced
101:783e9d6980ec 102:94011f553cd0
22 from logging import debug, info, error 22 from logging import debug, info, error
23 from twisted.words.protocols.jabber import client, jid 23 from twisted.words.protocols.jabber import client, jid
24 from twisted.words.protocols.jabber import error as jab_error 24 from twisted.words.protocols.jabber import error as jab_error
25 from twisted.words.protocols.jabber.xmlstream import IQ 25 from twisted.words.protocols.jabber.xmlstream import IQ
26 from twisted.internet import reactor 26 from twisted.internet import reactor
27 from tools.xml_tools import XMLTools 27 from tools.xml_tools import dataForm2xml
28 import pdb 28 import pdb
29 29
30 from wokkel import data_form 30 from wokkel import data_form
31 31
32 NS_REG = 'jabber:iq:register' 32 NS_REG = 'jabber:iq:register'
65 answer_type = "ERROR" 65 answer_type = "ERROR"
66 self.host.bridge.actionResult(answer_type, answer['id'], answer_data) 66 self.host.bridge.actionResult(answer_type, answer['id'], answer_data)
67 return 67 return
68 68
69 form = data_form.Form.fromElement(x_elem) 69 form = data_form.Form.fromElement(x_elem)
70 xml_data = XMLTools.dataForm2xml(form) 70 xml_data = dataForm2xml(form)
71 self.host.bridge.actionResult("FORM", answer['id'], {"target":answer["from"], "type":"registration", "xml":xml_data}) 71 self.host.bridge.actionResult("FORM", answer['id'], {"target":answer["from"], "type":"registration", "xml":xml_data})
72 72
73 def reg_err(self, failure): 73 def reg_err(self, failure):
74 """Called when something is wrong with registration""" 74 """Called when something is wrong with registration"""
75 info (_("Registration failure: %s") % str(failure.value)) 75 info (_("Registration failure: %s") % str(failure.value))
76 answer_data = {} 76 answer_data = {}
77 answer_data['reason'] = 'unknown' 77 answer_data['reason'] = 'unknown'
78 answer_data={"message":"%s [code: %s]" % (failure.value.condition, failure.value.code)} 78 answer_data={"message":"%s [code: %s]" % (failure.value.condition, unicode(failure.value))}
79 answer_type = "ERROR" 79 answer_type = "ERROR"
80 self.host.bridge.actionResult(answer_type, failure.value.stanza['id'], answer_data) 80 self.host.bridge.actionResult(answer_type, failure.value.stanza['id'], answer_data)
81 81
82 def unregistrationAnswer(self, answer): 82 def unregistrationAnswer(self, answer):
83 debug (_("registration answer: %s") % answer.toXml()) 83 debug (_("registration answer: %s") % answer.toXml())