There are 2 ways to receive group chat subject, handle both. Fixes #1332
This commit is contained in:
parent
e2caefeaea
commit
e0b5b420b5
|
@ -395,7 +395,7 @@ class Connection:
|
||||||
msgtxt, tim))
|
msgtxt, tim))
|
||||||
elif mtype == 'groupchat':
|
elif mtype == 'groupchat':
|
||||||
if subject:
|
if subject:
|
||||||
self.dispatch('GC_SUBJECT', (frm, subject))
|
self.dispatch('GC_SUBJECT', (frm, subject, msgtxt))
|
||||||
else:
|
else:
|
||||||
if not msg.getTag('body'): #no <body>
|
if not msg.getTag('body'): #no <body>
|
||||||
return
|
return
|
||||||
|
|
|
@ -765,14 +765,18 @@ class Interface:
|
||||||
self.remote_ctrl.raise_signal('GCMessage', (account, array))
|
self.remote_ctrl.raise_signal('GCMessage', (account, array))
|
||||||
|
|
||||||
def handle_event_gc_subject(self, account, array):
|
def handle_event_gc_subject(self, account, array):
|
||||||
#('GC_SUBJECT', account, (jid, subject))
|
#('GC_SUBJECT', account, (jid, subject, body))
|
||||||
jids = array[0].split('/', 1)
|
jids = array[0].split('/', 1)
|
||||||
jid = jids[0]
|
jid = jids[0]
|
||||||
gc_control = gajim.interface.msg_win_mgr.get_control(jid)
|
gc_control = gajim.interface.msg_win_mgr.get_control(jid)
|
||||||
if not gc_control:
|
if not gc_control:
|
||||||
return
|
return
|
||||||
gc_control.set_subject(array[1])
|
gc_control.set_subject(array[1])
|
||||||
if len(jids) > 1:
|
# We can receive a subject with a body that contains "X has set the subject to Y" ...
|
||||||
|
if array[2]:
|
||||||
|
gc_control.print_conversation(array[2])
|
||||||
|
# ... Or the message comes from the occupant who set the subject
|
||||||
|
elif len(jids) > 1:
|
||||||
gc_control.print_conversation('%s has set the subject to %s' % (jids[1], array[1]))
|
gc_control.print_conversation('%s has set the subject to %s' % (jids[1], array[1]))
|
||||||
|
|
||||||
def handle_event_gc_config(self, account, array):
|
def handle_event_gc_config(self, account, array):
|
||||||
|
|
Loading…
Reference in New Issue