always reply to incoming resource. see #5227

This commit is contained in:
Yann Leboulanger 2009-09-09 10:38:26 +02:00
parent bad4297952
commit 377a777823
3 changed files with 13 additions and 2 deletions

View File

@ -1199,7 +1199,7 @@ class Connection(ConnectionHandlers):
msgenc = ''
if session:
fjid = str(session.jid)
fjid = session.get_to()
if keyID and self.USE_GPG:
xhtml = None

View File

@ -54,6 +54,7 @@ class StanzaSession(object):
self.conn = conn
self.jid = jid
self.type = type_
self.resource = None
if thread_id:
self.received_thread_id = True
@ -75,6 +76,12 @@ class StanzaSession(object):
def is_loggable(self):
return self.loggable and gajim.config.should_log(self.conn.name, self.jid)
def get_to(self):
to = str(self.jid)
if self.resource:
to += '/' + self.resource
return to
def remove_events(self, types):
'''
Remove events associated with this session from the queue.
@ -107,7 +114,7 @@ class StanzaSession(object):
if self.thread_id:
msg.NT.thread = self.thread_id
msg.setAttr('to', self.jid)
msg.setAttr('to', self.get_to())
self.conn.send_stanza(msg)
if isinstance(msg, xmpp.Message):

View File

@ -86,6 +86,10 @@ class ChatControlSession(stanza_session.EncryptedStanzaSession):
'''dispatch a received <message> stanza'''
msg_type = msg.getType()
subject = msg.getSubject()
if self.jid != full_jid_with_resource:
self.resource = gajim.get_nick_from_fjid(full_jid_with_resource)
if self.control:
self.control.resource = self.resource
if not msg_type or msg_type not in ('chat', 'groupchat', 'error'):
msg_type = 'normal'