Do not ignore empty topics

This commit is contained in:
Florent Le Coz 2014-10-16 10:43:57 +02:00
parent 088c6c6a0b
commit d4590949f7

View file

@ -960,18 +960,21 @@ def on_groupchat_subject(self, message):
room_from = message.getMucroom() room_from = message.getMucroom()
tab = self.get_tab_by_name(room_from, tabs.MucTab) tab = self.get_tab_by_name(room_from, tabs.MucTab)
subject = message['subject'] subject = message['subject']
if not subject or not tab: if subject is None or not tab:
return return
if nick_from: if subject != tab.topic:
tab.add_message(_("\x19%(info_col)s}%(nick)s set the subject to: %(subject)s") % # Do not display the message if the subject did not change or if we
{'info_col': dump_tuple(get_theme().COLOR_INFORMATION_TEXT), 'nick':nick_from, 'subject':subject}, # receive an empty topic when joining the room.
time=None, if nick_from:
typ=2) tab.add_message(_("\x19%(info_col)s}%(nick)s set the subject to: %(subject)s") %
else: {'info_col': dump_tuple(get_theme().COLOR_INFORMATION_TEXT), 'nick':nick_from, 'subject':subject},
tab.add_message(_("\x19%(info_col)s}The subject is: %(subject)s") % time=None,
{'subject':subject, 'info_col': dump_tuple(get_theme().COLOR_INFORMATION_TEXT)}, typ=2)
time=None, else:
typ=2) tab.add_message(_("\x19%(info_col)s}The subject is: %(subject)s") %
{'subject':subject, 'info_col': dump_tuple(get_theme().COLOR_INFORMATION_TEXT)},
time=None,
typ=2)
tab.topic = subject tab.topic = subject
tab.topic_from = nick_from tab.topic_from = nick_from
if self.get_tab_by_name(room_from, tabs.MucTab) is self.current_tab(): if self.get_tab_by_name(room_from, tabs.MucTab) is self.current_tab():