diff plugins/plugin_xep_0077.py @ 33:b9bb5d8e0cc7

In-band-registration: data form 2 xml conversion
author Goffi <goffi@goffi.org>
date Tue, 08 Dec 2009 09:54:44 +0100
parents d6b613764dd7
children c45deebb40a5
line wrap: on
line diff
--- a/plugins/plugin_xep_0077.py	Tue Dec 08 08:13:12 2009 +0100
+++ b/plugins/plugin_xep_0077.py	Tue Dec 08 09:54:44 2009 +0100
@@ -23,8 +23,11 @@
 from twisted.words.protocols.jabber import client, jid, xmlstream, error
 from twisted.words.protocols.jabber.xmlstream import IQ
 from twisted.internet import reactor
+from tools.xml_tools import XMLTools
 import pdb
 
+from wokkel import data_form
+
 NS_REG = 'jabber:iq:register'
 
 PLUGIN_INFO = {
@@ -46,6 +49,9 @@
     def reg_ok(self, answer):
         """Called after the first get IQ"""
         print "answer:",answer
+        form = data_form.Form.fromElement(answer.firstChildElement().firstChildElement())
+        xml_data = XMLTools.dataForm2xml(form)
+        self.host.bridge.actionResult("FORM", answer['id'], {"type":"registration", "xml":xml_data})
 
     def reg_err(self, failure):
         """Called when something is wrong with registration"""