From e0b5b420b5f2cb33af4a212ba904dfd9edad2b71 Mon Sep 17 00:00:00 2001
From: Yann Leboulanger <asterix@lagaule.org>
Date: Sun, 15 Jan 2006 13:35:29 +0000
Subject: [PATCH] There are 2 ways to receive group chat subject, handle both.
 Fixes #1332

---
 src/common/connection.py | 2 +-
 src/gajim.py             | 8 ++++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/common/connection.py b/src/common/connection.py
index 58168f7ca9..dd4947e025 100644
--- a/src/common/connection.py
+++ b/src/common/connection.py
@@ -395,7 +395,7 @@ class Connection:
 				msgtxt, tim))
 		elif mtype == 'groupchat':
 			if subject:
-				self.dispatch('GC_SUBJECT', (frm, subject))
+				self.dispatch('GC_SUBJECT', (frm, subject, msgtxt))
 			else:
 				if not msg.getTag('body'): #no <body>
 					return
diff --git a/src/gajim.py b/src/gajim.py
index db02212400..b53e510879 100755
--- a/src/gajim.py
+++ b/src/gajim.py
@@ -765,14 +765,18 @@ class Interface:
 			self.remote_ctrl.raise_signal('GCMessage', (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)
 		jid = jids[0]
 		gc_control = gajim.interface.msg_win_mgr.get_control(jid)
 		if not gc_control:
 			return
 		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]))
 
 	def handle_event_gc_config(self, account, array):
-- 
GitLab