Mercurial > libervia-backend
changeset 89:23caf1051099
multi-profile/subscription misc fixes
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 13 May 2010 16:27:48 +0930 |
parents | 59f181e8433a |
children | 4020931569b8 |
files | frontends/quick_frontend/quick_app.py frontends/wix/main_window.py frontends/wix/param.py frontends/wix/profile_manager.py plugins/plugin_misc_tarot.py sat.tac sat_bridge/DBus.py |
diffstat | 7 files changed, 21 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/frontends/quick_frontend/quick_app.py Wed May 12 11:55:18 2010 +0930 +++ b/frontends/quick_frontend/quick_app.py Thu May 13 16:27:48 2010 +0930 @@ -281,9 +281,9 @@ # 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
--- a/frontends/wix/main_window.py Wed May 12 11:55:18 2010 +0930 +++ b/frontends/wix/main_window.py Thu May 13 16:27:48 2010 +0930 @@ -118,6 +118,7 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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
--- a/frontends/wix/param.py Wed May 12 11:55:18 2010 +0930 +++ b/frontends/wix/param.py Thu May 13 16:27:48 2010 +0930 @@ -57,7 +57,7 @@ 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 @@ 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):
--- a/frontends/wix/profile_manager.py Wed May 12 11:55:18 2010 +0930 +++ b/frontends/wix/profile_manager.py Thu May 13 16:27:48 2010 +0930 @@ -133,12 +133,12 @@ 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 @@ 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)
--- a/plugins/plugin_misc_tarot.py Wed May 12 11:55:18 2010 +0930 +++ b/plugins/plugin_misc_tarot.py Thu May 13 16:27:48 2010 +0930 @@ -102,7 +102,6 @@ del(deck[:]) for player in players: - print "envoi de main a",player self.host.sendMessage(room_jid+"/"+player, "/hand: %s" % str(hand[player])) self.host.bridge.tarotGameNew(room_jid, hand[players[0]], profile)
--- a/sat.tac Wed May 12 11:55:18 2010 +0930 +++ b/sat.tac Thu May 13 16:27:48 2010 +0930 @@ -382,16 +382,14 @@ def connect(self, profile_key = '@DEFAULT@'): """Connect to jabber server""" - profile = self.memory.getProfileName(profile_key) if not profile_key: error (_('Trying to connect a non-exsitant profile')) return - if (self.isConnected()): + if (self.isConnected(profile)): info(_("already connected !")) return - print "connecting..." current = self.profiles[profile] = SatXMPPClient(self, profile, jid.JID(self.memory.getParamA("JabberID", "Connection", profile_key = profile_key), profile), self.memory.getParamA("Password", "Connection", profile_key = profile_key), @@ -604,23 +602,23 @@ to_jid = jid.JID(to) if to else None self.profiles[profile].presence.available(to_jid, show, statuses, priority) - def subscription(self, type, raw_jid, profile_key='@DEFAULT@'): + def subscription(self, subs_type, raw_jid, profile_key='@DEFAULT@'): """Called to manage subscription""" profile = self.memory.getProfileName(profile_key) assert(profile) to_jid = jid.JID(raw_jid) - debug (_('subsciption request [%(type)s] for %(jid)s') % {'type':type, 'jid':to_jid.full()}) - if type=="subscribe": + debug (_('subsciption request [%(subs_type)s] for %(jid)s') % {'subs_type':subs_type, 'jid':to_jid.full()}) + if subs_type=="subscribe": self.profiles[profile].presence.subscribe(to_jid) - elif type=="subscribed": - self.profiles[profile].subscribed(to_jid) + elif subs_type=="subscribed": + self.profiles[profile].presence.subscribed(to_jid) contact = self.memory.getContact(to_jid) if not contact or not bool(contact['to']): #we automatically subscribe to 'to' presence debug(_('sending automatic "to" subscription request')) self.subscription('subscribe', to_jid.userhost()) - elif type=="unsubscribe": + elif subs_type=="unsubscribe": self.profiles[profile].presence.unsubscribe(to_jid) - elif type=="unsubscribed": + elif subs_type=="unsubscribed": self.profiles[profile].presence.unsubscribed(to_jid)
--- a/sat_bridge/DBus.py Wed May 12 11:55:18 2010 +0930 +++ b/sat_bridge/DBus.py Thu May 13 16:27:48 2010 +0930 @@ -138,7 +138,7 @@ in_signature='s', out_signature='') def connect(self, profile_key='@DEFAULT@'): info ("Connection asked") - return self.cb["connect"]() + return self.cb["connect"](profile_key) @dbus.service.method(const_INT_PREFIX+const_COMM_SUFFIX, in_signature='s', out_signature='')