Do not remove resource from jid when using Actions -> Start chat. fixes #2942

This commit is contained in:
Yann Leboulanger 2007-01-27 18:43:28 +00:00
parent f450c0eb65
commit b4b2ecb41d

View file

@ -398,7 +398,7 @@ class RosterWindow:
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 @@ class RosterWindow:
'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 @@ class RosterWindow:
# 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):