Mercurial > libervia-backend
comparison src/core/xmpp.py @ 538:2c4016921403
core, frontends, bridgen plugins: fixed methods which were unproperly managing multi-profiles
- added profile argument to askConfirmation, actionResult, actionResultExt, entityDataUpdated, confirmationAnswer, getProgress
- core, frontends: fixed calls/signals according to new bridge API
- user of proper profile namespace for progression indicators and dialogs
- memory: getParam* now return bool when param type is bool
- memory: added getStringParam* to return string instead of typed value
- core, memory, storage, quick_frontend: getHistory now manage properly multi-profiles
- plugins XEP-0047, XEP-0054, XEP-0065, XEP-0077, XEP-0096; multi-profiles proper handling
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 10 Nov 2012 16:38:16 +0100 |
parents | 9a3913fb0a6c |
children | 2c5ef983f2ef |
comparison
equal
deleted
inserted
replaced
537:28cddc96c4ed | 538:2c4016921403 |
---|---|
35 self.__connected=False | 35 self.__connected=False |
36 self.profile = profile | 36 self.profile = profile |
37 self.host_app = host_app | 37 self.host_app = host_app |
38 self.client_initialized = defer.Deferred() | 38 self.client_initialized = defer.Deferred() |
39 self.conn_deferred = defer.Deferred() | 39 self.conn_deferred = defer.Deferred() |
40 self._waiting_conf = {} #callback called when a confirmation is received | |
41 self._progress_cb_map = {} #callback called when a progress is requested (key = progress id) | |
42 | |
40 | 43 |
41 def getConnectionDeferred(self): | 44 def getConnectionDeferred(self): |
42 """Return a deferred which fire when the client is connected""" | 45 """Return a deferred which fire when the client is connected""" |
43 return self.conn_deferred | 46 return self.conn_deferred |
44 | 47 |
358 debug (u"iqFallback: xml = [%s]" % (iq.toXml())) | 361 debug (u"iqFallback: xml = [%s]" % (iq.toXml())) |
359 generic.FallbackHandler.iqFallback(self, iq) | 362 generic.FallbackHandler.iqFallback(self, iq) |
360 | 363 |
361 class RegisteringAuthenticator(xmlstream.ConnectAuthenticator): | 364 class RegisteringAuthenticator(xmlstream.ConnectAuthenticator): |
362 | 365 |
363 def __init__(self, host, jabber_host, user_login, user_pass, email, answer_id): | 366 def __init__(self, host, jabber_host, user_login, user_pass, email, answer_id, profile): |
364 xmlstream.ConnectAuthenticator.__init__(self, jabber_host) | 367 xmlstream.ConnectAuthenticator.__init__(self, jabber_host) |
365 self.host = host | 368 self.host = host |
366 self.jabber_host = jabber_host | 369 self.jabber_host = jabber_host |
367 self.user_login = user_login | 370 self.user_login = user_login |
368 self.user_pass = user_pass | 371 self.user_pass = user_pass |
369 self.user_email = email | 372 self.user_email = email |
370 self.answer_id = answer_id | 373 self.answer_id = answer_id |
374 self.profile = profile | |
371 print _("Registration asked for"),user_login, user_pass, jabber_host | 375 print _("Registration asked for"),user_login, user_pass, jabber_host |
372 | 376 |
373 def connectionMade(self): | 377 def connectionMade(self): |
374 print "connectionMade" | 378 print "connectionMade" |
375 | 379 |
390 | 394 |
391 def registrationAnswer(self, answer): | 395 def registrationAnswer(self, answer): |
392 debug (_("registration answer: %s") % answer.toXml()) | 396 debug (_("registration answer: %s") % answer.toXml()) |
393 answer_type = "SUCCESS" | 397 answer_type = "SUCCESS" |
394 answer_data={"message":_("Registration successfull")} | 398 answer_data={"message":_("Registration successfull")} |
395 self.host.bridge.actionResult(answer_type, self.answer_id, answer_data) | 399 self.host.bridge.actionResult(answer_type, self.answer_id, answer_data, self.profile) |
396 self.xmlstream.sendFooter() | 400 self.xmlstream.sendFooter() |
397 | 401 |
398 def registrationFailure(self, failure): | 402 def registrationFailure(self, failure): |
399 info (_("Registration failure: %s") % str(failure.value)) | 403 info (_("Registration failure: %s") % str(failure.value)) |
400 answer_type = "ERROR" | 404 answer_type = "ERROR" |
403 answer_data['reason'] = 'conflict' | 407 answer_data['reason'] = 'conflict' |
404 answer_data={"message":_("Username already exists, please choose an other one")} | 408 answer_data={"message":_("Username already exists, please choose an other one")} |
405 else: | 409 else: |
406 answer_data['reason'] = 'unknown' | 410 answer_data['reason'] = 'unknown' |
407 answer_data={"message":_("Registration failed (%s)") % str(failure.value.condition)} | 411 answer_data={"message":_("Registration failed (%s)") % str(failure.value.condition)} |
408 self.host.bridge.actionResult(answer_type, self.answer_id, answer_data) | 412 self.host.bridge.actionResult(answer_type, self.answer_id, answer_data, self.profile) |
409 self.xmlstream.sendFooter() | 413 self.xmlstream.sendFooter() |
410 | 414 |
411 class SatVersionHandler(generic.VersionHandler): | 415 class SatVersionHandler(generic.VersionHandler): |
412 | 416 |
413 def getDiscoInfo(self, requestor, target, node): | 417 def getDiscoInfo(self, requestor, target, node): |