comparison src/core/xmpp.py @ 336:953536246d9d

core: added email in registerNewAccount
author Goffi <goffi@goffi.org>
date Wed, 25 May 2011 17:18:05 +0200
parents 698cbc6ebec8
children 9eebdc655b8b
comparison
equal deleted inserted replaced
335:99206631503e 336:953536246d9d
234 debug (u"iqFallback: xml = [%s]" % (iq.toXml())) 234 debug (u"iqFallback: xml = [%s]" % (iq.toXml()))
235 generic.FallbackHandler.iqFallback(self, iq) 235 generic.FallbackHandler.iqFallback(self, iq)
236 236
237 class RegisteringAuthenticator(xmlstream.ConnectAuthenticator): 237 class RegisteringAuthenticator(xmlstream.ConnectAuthenticator):
238 238
239 def __init__(self, host, jabber_host, user_login, user_pass, answer_id): 239 def __init__(self, host, jabber_host, user_login, user_pass, email, answer_id):
240 xmlstream.ConnectAuthenticator.__init__(self, jabber_host) 240 xmlstream.ConnectAuthenticator.__init__(self, jabber_host)
241 self.host = host 241 self.host = host
242 self.jabber_host = jabber_host 242 self.jabber_host = jabber_host
243 self.user_login = user_login 243 self.user_login = user_login
244 self.user_pass = user_pass 244 self.user_pass = user_pass
245 self.user_email = email
245 self.answer_id = answer_id 246 self.answer_id = answer_id
246 print _("Registration asked for"),user_login, user_pass, jabber_host 247 print _("Registration asked for"),user_login, user_pass, jabber_host
247 248
248 def connectionMade(self): 249 def connectionMade(self):
249 print "connectionMade" 250 print "connectionMade"
256 query = iq.addElement(('jabber:iq:register', 'query')) 257 query = iq.addElement(('jabber:iq:register', 'query'))
257 _user = query.addElement('username') 258 _user = query.addElement('username')
258 _user.addContent(self.user_login) 259 _user.addContent(self.user_login)
259 _pass = query.addElement('password') 260 _pass = query.addElement('password')
260 _pass.addContent(self.user_pass) 261 _pass.addContent(self.user_pass)
262 if self.user_email:
263 _email = query.addElement('email')
264 _email.addContent(self.user_email)
265 print iq.toXml()
261 reg = iq.send(self.jabber_host).addCallbacks(self.registrationAnswer, self.registrationFailure) 266 reg = iq.send(self.jabber_host).addCallbacks(self.registrationAnswer, self.registrationFailure)
262 267
263 def registrationAnswer(self, answer): 268 def registrationAnswer(self, answer):
264 debug (_("registration answer: %s") % answer.toXml()) 269 debug (_("registration answer: %s") % answer.toXml())
265 answer_type = "SUCCESS" 270 answer_type = "SUCCESS"