multi-profile/subscription misc fixes
This commit is contained in:
parent
534612084c
commit
6cfa6a1413
4 changed files with 21 additions and 23 deletions
|
|
@ -281,9 +281,9 @@ class QuickApp():
|
|||
# this is a subscriptionn request, we have to ask for user confirmation
|
||||
answer = self.showDialog(_("The contact %s wants to subscribe to your presence.\nDo you accept ?") % entity.short, _('Subscription confirmation'), 'yes/no')
|
||||
if answer:
|
||||
self.bridge.subscription("subscribed", entity.short)
|
||||
self.bridge.subscription("subscribed", entity.short, profile_key = profile)
|
||||
else:
|
||||
self.bridge.subscribed("unsubscribed", entity.short)
|
||||
self.bridge.subscription("unsubscribed", entity.short, profile_key = profile)
|
||||
|
||||
def showDialog(self, message, title, type="info"):
|
||||
raise NotImplementedError
|
||||
|
|
|
|||
|
|
@ -118,6 +118,7 @@ class MainWindow(wx.Frame, QuickApp):
|
|||
|
||||
def plug_profile(self, profile_key='@DEFAULT@'):
|
||||
"""Hide profile panel then plug profile"""
|
||||
debug (_('plugin profile %s' % profile_key))
|
||||
self.profile_pan.Hide()
|
||||
self.contactList.Show()
|
||||
self.sizer.Layout()
|
||||
|
|
@ -330,7 +331,7 @@ class MainWindow(wx.Frame, QuickApp):
|
|||
def __updateStatus(self):
|
||||
show = filter(lambda x:x[1] == self.statusBox.GetValue(), const_STATUS)[0][0]
|
||||
status = self.statusTxt.GetValue()
|
||||
self.bridge.setPresence(show=show, statuses={'default':status}) #FIXME: manage multilingual statuses
|
||||
self.bridge.setPresence(show=show, statuses={'default':status}, profile_key=self.profile) #FIXME: manage multilingual statuses
|
||||
|
||||
def onStatusChange(self, e):
|
||||
debug(_("Status change request"))
|
||||
|
|
@ -352,7 +353,7 @@ class MainWindow(wx.Frame, QuickApp):
|
|||
if dlg.ShowModal() == wx.ID_OK:
|
||||
jid=JID(dlg.GetValue())
|
||||
if jid.is_valid():
|
||||
self.bridge.addContact(jid.short)
|
||||
self.bridge.addContact(jid.short, profile_key=self.profile)
|
||||
else:
|
||||
error (_("'%s' is an invalid JID !"), jid)
|
||||
#TODO: notice the user
|
||||
|
|
@ -378,7 +379,7 @@ class MainWindow(wx.Frame, QuickApp):
|
|||
|
||||
if dlg.ShowModal() == wx.ID_YES:
|
||||
info(_("Unsubscribing %s presence"), target.short)
|
||||
self.bridge.delContact(target.short)
|
||||
self.bridge.delContact(target.short, profile_key=self.profile)
|
||||
|
||||
dlg.Destroy()
|
||||
|
||||
|
|
@ -393,7 +394,7 @@ class MainWindow(wx.Frame, QuickApp):
|
|||
dlg.ShowModal()
|
||||
dlg.Destroy()
|
||||
return
|
||||
id = self.bridge.getCard(target.short)
|
||||
id = self.bridge.getCard(target.short, profile_key=self.profile)
|
||||
self.current_action_ids.add(id)
|
||||
self.current_action_ids_cb[id] = self.onProfileReceived
|
||||
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ class Param(wx.Frame):
|
|||
panel=wx.Panel(self.notebook)
|
||||
panel.sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
|
||||
cat_dom = minidom.parseString(self.host.bridge.getParamsForCategory(category).encode('utf-8'))
|
||||
cat_dom = minidom.parseString(self.host.bridge.getParamsForCategory(category, profile_key = self.host.profile).encode('utf-8'))
|
||||
|
||||
for param in cat_dom.documentElement.getElementsByTagName("param"):
|
||||
name = param.getAttribute("name")
|
||||
|
|
@ -115,7 +115,7 @@ class Param(wx.Frame):
|
|||
|
||||
def __save_parameters(self):
|
||||
for param in self.modified:
|
||||
self.host.bridge.setParam(param[0], self.modified[param], param[1])
|
||||
self.host.bridge.setParam(param[0], self.modified[param], param[1], profile_key = self.host.profile)
|
||||
self.modified.clear()
|
||||
|
||||
def onClose(self, event):
|
||||
|
|
|
|||
|
|
@ -133,12 +133,12 @@ class ProfileManager(wx.Panel):
|
|||
wx.MessageDialog(self, _("A profile name can't start with a @"), _("Bad profile name"), wx.ICON_ERROR).ShowModal()
|
||||
return
|
||||
profile = self.host.bridge.getProfileName(name)
|
||||
if not profile:
|
||||
debug(_("The profile is new, we create it"))
|
||||
assert(profile)
|
||||
old_jid = self.host.bridge.getParamA("JabberID", "Connection", profile_key=profile)
|
||||
old_pass = self.host.bridge.getParamA("Password", "Connection", profile_key=profile)
|
||||
new_jid = self.login_jid.GetValue()
|
||||
new_pass = self.login_pass.GetValue()
|
||||
print "old: %s, new: %s, old_pass: %s, new_pass: %s" % (old_jid, new_jid, old_pass, new_pass)
|
||||
if old_jid != new_jid:
|
||||
debug(_('Saving new JID and server'))
|
||||
self.host.bridge.setParam("JabberID", new_jid, "Connection", profile)
|
||||
|
|
@ -146,5 +146,5 @@ class ProfileManager(wx.Panel):
|
|||
if old_pass != new_pass:
|
||||
debug(_('Saving new password'))
|
||||
self.host.bridge.setParam("Password", new_pass, "Connection", profile)
|
||||
self.host.plug_profile(name)
|
||||
self.host.plug_profile(profile)
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue