diff --git a/Core/core.py b/Core/core.py index 8090da5b5..d8a70be48 100644 --- a/Core/core.py +++ b/Core/core.py @@ -429,7 +429,7 @@ class GajimCore: elif typ == 'subscribed': jid = prs.getFrom() self.hub.sendPlugin('SUBSCRIBED', self.connexions[con],\ - (jid.getStripped(), jid.getNode(), jid.getResource())) + (jid.getStripped(), jid.getResource())) self.hub.queueIn.put(('UPDUSER', self.connexions[con], \ (jid.getStripped(), jid.getNode(), ['general']))) #BE CAREFUL : no con.updateRosterItem() in a callback diff --git a/plugins/gtkgui/dialogs.py b/plugins/gtkgui/dialogs.py index 97a4c010c..2c3eb5c46 100644 --- a/plugins/gtkgui/dialogs.py +++ b/plugins/gtkgui/dialogs.py @@ -360,8 +360,8 @@ class addContact_Window: def on_subscribe(self, widget): """When Subscribe button is clicked""" textview_sub = self.xml.get_widget("textview_sub") - entry_who = self.xml.get_widget('entry_who') - who = entry_who.get_text() + who = self.xml.get_widget('entry_who').get_text() + pseudo = self.xml.get_widget('entry_pseudo').get_text() if not who: return if who.find('@') < 0: @@ -371,7 +371,7 @@ class addContact_Window: start_iter = buf.get_start_iter() end_iter = buf.get_end_iter() txt = buf.get_text(start_iter, end_iter, 0) - self.plugin.roster.req_sub(self, who, txt, self.account) + self.plugin.roster.req_sub(self, who, txt, self.account, pseudo) widget.get_toplevel().destroy() def fill_who(self): @@ -379,7 +379,8 @@ class addContact_Window: model = cb.get_model() index = cb.get_active() str = self.xml.get_widget('entry_login').get_text() - str = str.replace("@", "%") + if index > 0: + str = str.replace("@", "%") agent = model[index][1] if agent: str += "@" + agent @@ -403,15 +404,25 @@ class addContact_Window: cb.set_active(self.agents.index('ICQ')) return cb.set_active(0) + + def set_pseudo(self): + login = self.xml.get_widget('entry_login').get_text() + pseudo = self.xml.get_widget('entry_pseudo').get_text() + if pseudo == self.old_login_value: + self.xml.get_widget('entry_pseudo').set_text(login) def on_entry_login_changed(self, widget): - self.guess_agent() #It changes the cb so automatically call fill_who() + self.guess_agent() + self.set_pseudo() + self.fill_who() + self.old_login_value = self.xml.get_widget('entry_login').get_text() def __init__(self, plugin, account, jid=None): self.plugin = plugin self.account = account self.xml = gtk.glade.XML(GTKGUI_GLADE, 'Add', APP) self.window = self.xml.get_widget('Add') + self.old_login_value = '' liststore = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING) liststore.append(['Jabber', '']) self.agents = ['Jabber'] diff --git a/plugins/gtkgui/gtkgui.glade b/plugins/gtkgui/gtkgui.glade index 3f02826bd..e6ca74ef9 100644 --- a/plugins/gtkgui/gtkgui.glade +++ b/plugins/gtkgui/gtkgui.glade @@ -2172,7 +2172,7 @@ on the server. True - 3 + 4 3 False 5 @@ -2221,26 +2221,6 @@ on the server. - - - True - gtk-add - 4 - 0.5 - 0.5 - 0 - 0 - - - 0 - 1 - 0 - 3 - fill - fill - - - True @@ -2328,6 +2308,71 @@ on the server. fill + + + + True + gtk-add + 4 + 0.5 + 0.5 + 0 + 0 + + + 0 + 1 + 0 + 4 + fill + fill + + + + + + True + Pseudo : + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + + + 1 + 2 + 3 + 4 + fill + + + + + + + True + True + True + True + 0 + + True + * + False + + + 2 + 3 + 3 + 4 + + + 10 diff --git a/plugins/gtkgui/gtkgui.py b/plugins/gtkgui/gtkgui.py index 2bd002d11..ea65f2de2 100644 --- a/plugins/gtkgui/gtkgui.py +++ b/plugins/gtkgui/gtkgui.py @@ -1681,11 +1681,13 @@ class roster_Window: """Authorize a user""" self.plugin.send('AUTH', account, jid) - def req_sub(self, widget, jid, txt, account): + def req_sub(self, widget, jid, txt, account, pseudo=None): """Request subscription to a user""" + if not pseudo: + pseudo = jid self.plugin.send('SUB', account, (jid, txt)) if not self.contacts[account].has_key(jid): - user1 = user(jid, jid, ['general'], 'requested', \ + user1 = user(jid, pseudo, ['general'], 'requested', \ 'requested', 'none', 'subscribe', '', 0, '') self.contacts[account][jid] = [user1] self.add_user_to_roster(jid, account) @@ -2687,21 +2689,21 @@ class plugin: authorize_Window(self, array[0], array[1], account) def handle_event_subscribed(self, account, array): - #('SUBSCRIBED', account, (jid, nom, resource)) + #('SUBSCRIBED', account, (jid, resource)) jid = array[0] if self.roster.contacts[account].has_key(jid): u = self.roster.contacts[account][jid][0] - u.name = array[1] - u.resource = array[2] + u.resource = array[1] self.roster.remove_user(u, account) if 'not in list' in u.groups: u.groups.remove('not in list') if len(u.groups) == 0: u.groups = ['general'] self.roster.add_user_to_roster(u.jid, account) + self.send('UPDUSER', account, (u.jid, u.name, u.groups)) else: user1 = user(jid, jid, ['general'], 'online', \ - 'online', 'to', '', array[2], 0, '') + 'online', 'to', '', array[1], 0, '') self.roster.contacts[account][jid] = [user1] self.roster.add_user_to_roster(jid, account) warning_Window(_("You are now authorized by %s") % jid) @@ -2823,9 +2825,8 @@ class plugin: return for user in users: name = array[1] - if not name: - name = jid - user.name = name + if name: + user.name = name user.sub = array[2] user.ask = array[3] user.groups = array[4]