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
This commit is contained in:
Goffi 2012-11-10 16:38:16 +01:00
commit fa38394401
2 changed files with 570 additions and 400 deletions

View file

@ -265,7 +265,7 @@ class Chat(wx.Frame, QuickChat):
else:
full_jid = self.target
id = self.host.bridge.sendFile(full_jid, filename, {}, self.host.profile)
self.host.waitProgress(id, _("File Transfer"), _("Copying %s") % os.path.basename(filename))
self.host.waitProgress(id, _("File Transfer"), _("Copying %s") % os.path.basename(filename), self.host.profile)
def onStartTarot(self, e):
debug (_("Starting Tarot game"))

View file

@ -223,11 +223,13 @@ class MainWindow(wx.Frame, QuickApp):
self.tools.Disable()
return
def askConfirmation(self, type, id, data):
def askConfirmation(self, confirmation_type, confirmation_id, data, profile):
#TODO: refactor this in QuickApp
if not self.check_profile(profile):
return
debug (_("Confirmation asked"))
answer_data={}
if type == "FILE_TRANSFER":
if confirmation_type == "FILE_TRANSFER":
debug (_("File transfer confirmation asked"))
dlg = wx.MessageDialog(self, _("The contact %(jid)s wants to send you the file %(filename)s\nDo you accept ?") % {'jid':data["from"], 'filename':data["filename"]},
_('File Request'),
@ -238,16 +240,16 @@ class MainWindow(wx.Frame, QuickApp):
filename = wx.FileSelector(_("Where do you want to save the file ?"), flags = wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)
if filename:
answer_data["dest_path"] = filename
self.bridge.confirmationAnswer(id, True, answer_data)
self.waitProgress(id, _("File Transfer"), _("Copying %s") % os.path.basename(filename))
self.bridge.confirmationAnswer(confirmation_id, True, answer_data, profile)
self.waitProgress(confirmation_id, _("File Transfer"), _("Copying %s") % os.path.basename(filename), profile)
else:
answer = wx.ID_NO
if answer==wx.ID_NO:
self.bridge.confirmationAnswer(id, False, answer_data)
self.bridge.confirmationAnswer(confirmation_id, False, answer_data, profile)
dlg.Destroy()
elif type == "YES/NO":
elif confirmation_type == "YES/NO":
debug (_("Yes/No confirmation asked"))
dlg = wx.MessageDialog(self, data["message"],
_('Confirmation'),
@ -255,13 +257,15 @@ class MainWindow(wx.Frame, QuickApp):
)
answer=dlg.ShowModal()
if answer==wx.ID_YES:
self.bridge.confirmationAnswer(id, True, {})
self.bridge.confirmationAnswer(confirmation_id, True, {}, profile)
if answer==wx.ID_NO:
self.bridge.confirmationAnswer(id, False, {})
self.bridge.confirmationAnswer(confirmation_id, False, {}, profile)
dlg.Destroy()
def actionResult(self, type, id, data):
def actionResult(self, type, id, data, profile):
if not self.check_profile(profile):
return
debug (_("actionResult: type = [%(type)s] id = [%(id)s] data = [%(data)s]") % {'type':type, 'id':id, 'data':data})
if not id in self.current_action_ids:
debug (_('unknown id, ignoring'))
@ -313,8 +317,8 @@ class MainWindow(wx.Frame, QuickApp):
def progressCB(self, id, title, message):
data = self.bridge.getProgress(id)
def progressCB(self, progress_id, title, message, profile):
data = self.bridge.getProgress(progress_id, profile)
if data:
if not self.pbar:
#first answer, we must construct the bar
@ -327,11 +331,11 @@ class MainWindow(wx.Frame, QuickApp):
self.pbar.Update(self.pbar.finish_value)
return
wx.CallLater(10, self.progressCB, id, title, message)
wx.CallLater(10, self.progressCB, progress_id, title, message, profile)
def waitProgress (self, id, title, message):
def waitProgress (self, progress_id, title, message, profile):
self.pbar = None
wx.CallLater(10, self.progressCB, id, title, message)
wx.CallLater(10, self.progressCB, progress_id, title, message, profile)