catch the resource when we get a message from an unknown contact
This commit is contained in:
parent
fe19a1c645
commit
bd941ea8bf
2 changed files with 6 additions and 5 deletions
|
@ -385,6 +385,7 @@ class Interface:
|
|||
def handle_event_msg(self, account, array):
|
||||
#('MSG', account, (jid, msg, time, encrypted, msg_type, subject, chatstate))
|
||||
jid = gajim.get_jid_without_resource(array[0])
|
||||
resource = gajim.get_resource_from_jid(array[0])
|
||||
msg_type = array[4]
|
||||
chatstate = array[6]
|
||||
if jid.find('@') <= 0:
|
||||
|
@ -399,8 +400,8 @@ class Interface:
|
|||
show_notification = True
|
||||
|
||||
if self.windows[account]['gc'].has_key(jid): # it's a Private Message
|
||||
nick = array[0].split('/', 1)[1]
|
||||
fjid = jid + '/' + nick
|
||||
nick = get_nick_from_fjid(array[0])
|
||||
fjid = array[0]
|
||||
if not self.windows[account]['chats'].has_key(fjid) and \
|
||||
not gajim.awaiting_messages[account].has_key(fjid):
|
||||
if show_notification:
|
||||
|
@ -459,7 +460,7 @@ class Interface:
|
|||
|
||||
# array : (contact, msg, time, encrypted, msg_type, subject)
|
||||
self.roster.on_message(jid, array[1], array[2], account, array[3],
|
||||
msg_type, array[5])
|
||||
msg_type, array[5], resource)
|
||||
if gajim.config.get_per('soundevents', 'first_message_received',
|
||||
'enabled') and first:
|
||||
helpers.play_sound('first_message_received')
|
||||
|
|
|
@ -1494,7 +1494,7 @@ _('If "%s" accepts this request you will know his status.') %jid)
|
|||
groupchat_window.GroupchatWindow(jid, nick, self.plugin, account)
|
||||
|
||||
def on_message(self, jid, msg, tim, account, encrypted = False,\
|
||||
msg_type = '', subject = None):
|
||||
msg_type = '', subject = None, resource = ''):
|
||||
'''when we receive a message'''
|
||||
if not gajim.contacts[account].has_key(jid):
|
||||
keyID = ''
|
||||
|
@ -1504,7 +1504,7 @@ _('If "%s" accepts this request you will know his status.') %jid)
|
|||
keyID = attached_keys[attached_keys.index(jid) + 1]
|
||||
user1 = Contact(jid = jid, name = jid.split('@')[0],
|
||||
groups = [_('not in the roster')], show = 'not in the roster',
|
||||
status = '', ask = 'none', keyID = keyID)
|
||||
status = '', ask = 'none', keyID = keyID, resource = resource)
|
||||
gajim.contacts[account][jid] = [user1]
|
||||
self.add_contact_to_roster(jid, account)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue