From 90c653b83a3b9bdd1de56b6fe6c918eb85f15cff Mon Sep 17 00:00:00 2001 From: red-agent Date: Thu, 8 Oct 2009 15:21:18 +0300 Subject: [PATCH] Fixed resource extraction from jid. Fixes #5310 --- src/common/gajim.py | 8 ++++---- src/session.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/common/gajim.py b/src/common/gajim.py index 9a2ff9528..3511fe2d9 100644 --- a/src/common/gajim.py +++ b/src/common/gajim.py @@ -212,10 +212,10 @@ def get_server_from_jid(jid): pos = jid.find('@') + 1 # after @ return jid[pos:] -def get_nick_from_fjid(jid): - # fake jid is the jid for a contact in a room - # gaim@conference.jabber.no/nick/nick-continued - return jid.split('/', 1)[1] +def get_resource_from_jid(jid): + tokens = jid.split('/', 1) + if len(tokens) > 1: + return tokens[1] def get_name_and_server_from_jid(jid): name = get_nick_from_jid(jid) diff --git a/src/session.py b/src/session.py index 7d8f5576f..dec454c18 100644 --- a/src/session.py +++ b/src/session.py @@ -86,7 +86,7 @@ class ChatControlSession(stanza_session.EncryptedStanzaSession): '''dispatch a received stanza''' msg_type = msg.getType() subject = msg.getSubject() - resource = gajim.get_nick_from_fjid(full_jid_with_resource) + resource = gajim.get_resource_from_jid(full_jid_with_resource) if self.resource != resource: self.resource = resource if self.control and self.control.resource: