diff --git a/gajim/common/config.py b/gajim/common/config.py
index ba49e256c..41627bccc 100644
--- a/gajim/common/config.py
+++ b/gajim/common/config.py
@@ -296,6 +296,7 @@ class Config:
'threshold_options': [opt_str, '1, 2, 4, 10, 0', _('Options in days which can be chosen in the sync threshold menu'), True],
'public_room_sync_threshold': [opt_int, 1, _('Maximum history in days we request from a public room archive. 0: As much as possible')],
'private_room_sync_threshold': [opt_int, 0, _('Maximum history in days we request from a private room archive. 0: As much as possible')],
+ 'show_subject_on_join': [opt_bool, True, _('If the room subject is shown in chat on join')],
}, {}) # type: Tuple[Dict[str, List[Any]], Dict[Any, Any]]
__options_per_key = {
diff --git a/gajim/data/gui/preferences_window.ui b/gajim/data/gui/preferences_window.ui
index 9a09bef9a..075f57f29 100644
--- a/gajim/data/gui/preferences_window.ui
+++ b/gajim/data/gui/preferences_window.ui
@@ -401,7 +401,7 @@
0
- 5
+ 6
2
@@ -498,6 +498,21 @@
2
+
+
+
+ 0
+ 5
+ 2
+
+
diff --git a/gajim/groupchat_control.py b/gajim/groupchat_control.py
index bef332682..e87a5b077 100644
--- a/gajim/groupchat_control.py
+++ b/gajim/groupchat_control.py
@@ -297,6 +297,7 @@ class GroupchatControl(ChatControlBase):
self.force_non_minimizable = False
self.is_continued = is_continued
self.is_anonymous = True
+ self.join_time = 0
# Controls the state of autorejoin.
# None - autorejoin is neutral.
@@ -1546,7 +1547,10 @@ class GroupchatControl(ChatControlBase):
date = time.strftime('%d-%m-%Y %H:%M:%S',
time.localtime(event.timestamp))
text = '%s - %s' % (text, date)
- self.print_conversation(text)
+
+ just_joined = self.join_time > time.time() - 10
+ if app.config.get('show_subject_on_join') or not just_joined:
+ self.print_conversation(text)
if event.subject == '':
self.subject_button.hide()
@@ -1643,6 +1647,7 @@ class GroupchatControl(ChatControlBase):
app.gc_connected[self.account][self.room_jid] = value
def got_connected(self):
+ self.join_time = time.time()
# Make autorejoin stop.
if self.autorejoin:
GLib.source_remove(self.autorejoin)
diff --git a/gajim/gtk/preferences.py b/gajim/gtk/preferences.py
index 723f97d4a..f16f98255 100644
--- a/gajim/gtk/preferences.py
+++ b/gajim/gtk/preferences.py
@@ -142,6 +142,9 @@ class Preferences(Gtk.ApplicationWindow):
st = app.config.get('positive_184_ack')
self.xml.get_object('positive_184_ack_checkbutton').set_active(st)
+ st = app.config.get('show_subject_on_join')
+ self.xml.get_object('subject_on_join').set_active(st)
+
# Show avatar in tabs
st = app.config.get('show_avatar_in_tabs')
self.xml.get_object('show_avatar_in_tabs_checkbutton').set_active(st)
@@ -500,6 +503,9 @@ class Preferences(Gtk.ApplicationWindow):
return 'mixed'
return val
+ def on_subject_on_join_toggled(self, widget):
+ app.config.set('show_subject_on_join', widget.get_active())
+
def on_checkbutton_toggled(self, widget, config_name,
change_sensitivity_widgets=None):
app.config.set(config_name, widget.get_active())