Author: asterix Date: 2007-01-27 19:43:28 +0100 (Sat, 27 Jan 2007) New Revision: 7904
Modified: trunk/src/roster_window.py Log: Do not remove resource from jid when using Actions -> Start chat. fixes #2942
Modified: trunk/src/roster_window.py =================================================================== --- trunk/src/roster_window.py 2007-01-27 10:19:53 UTC (rev 7903) +++ trunk/src/roster_window.py 2007-01-27 18:43:28 UTC (rev 7904) @@ -398,7 +398,7 @@ model = self.tree.get_model() model.set_value(iter, 1 , gobject.markup_escape_text(text))
- def add_to_not_in_the_roster(self, account, jid, nick = ''): + def add_to_not_in_the_roster(self, account, jid, nick = '', resource = ''): ''' add jid to group "not in the roster", he MUST not be in roster yet, return contact ''' keyID = '' @@ -406,10 +406,9 @@ 'attached_gpg_keys').split() if jid in attached_keys: keyID = attached_keys[attached_keys.index(jid) + 1] - contact = gajim.contacts.create_contact(jid = jid, - name = nick, groups = [_('Not in Roster')], - show = 'not in roster', status = '', sub = 'none', - keyID = keyID) + contact = gajim.contacts.create_contact(jid = jid, name = nick, + groups = [_('Not in Roster')], show = 'not in roster', status = '', + sub = 'none', resource = resource, keyID = keyID) gajim.contacts.add_contact(account, contact) self.add_contact_to_roster(contact.jid, account) return contact @@ -3052,22 +3051,27 @@ # We call this here to avoid race conditions with widget validation chat_control.read_queue()
- def new_chat_from_jid(self, account, jid): - jid = gajim.get_jid_without_resource(jid) - contact = gajim.contacts.get_contact_with_highest_priority(account, jid) + def new_chat_from_jid(self, account, fjid): + jid, resource = gajim.get_room_and_nick_from_fjid(fjid) + if resource: + contact = gajim.contacts.get_contact(account, jid, resource) + else: + contact = gajim.contacts.get_contact_with_highest_priority(account, + jid) added_to_roster = False if not contact: added_to_roster = True - contact = self.add_to_not_in_the_roster(account, jid) + contact = self.add_to_not_in_the_roster(account, jid, + resource = resource)
- if not gajim.interface.msg_win_mgr.has_window(contact.jid, account): - self.new_chat(contact, account) - mw = gajim.interface.msg_win_mgr.get_window(contact.jid, account) - mw.set_active_tab(jid, account) + if not gajim.interface.msg_win_mgr.has_window(fjid, account): + self.new_chat(contact, account, resource = resource) + mw = gajim.interface.msg_win_mgr.get_window(fjid, account) + mw.set_active_tab(fjid, account) mw.window.present() # For JEP-0172 if added_to_roster: - mc = mw.get_control(jid, account) + mc = mw.get_control(fjid, account) mc.user_nick = gajim.nicks[account]
def new_room(self, room_jid, nick, account):