diff --git a/src/common/config.py b/src/common/config.py
index 0d9babc1f233136a8f9d17ef80688d58bc570a1b..928912f9edcb537b80767bd4553e33122df5ae4a 100644
--- a/src/common/config.py
+++ b/src/common/config.py
@@ -477,6 +477,8 @@ class Config:
             }, {}),
             'rooms': ({
                     'speller_language': [ opt_str, '', _('Language for which we want to check misspelled words')],
+                    'muc_restore_lines': [opt_int, -2, _('How many lines to request from server when entering a groupchat. -1 means no limit, -2 means global value')],
+                    'muc_restore_timeout': [opt_int, -2, _('How many minutes back to request logs when a entering a groupchat. -1 means no limit, -2 means global value')],
             }, {}),
             'plugins': ({
                 'active': [opt_bool, False, _('State whether plugins should be activated on startup (this is saved on Gajim exit). This option SHOULD NOT be used to (de)activate plug-ins. Use GUI instead.')],
diff --git a/src/common/connection.py b/src/common/connection.py
index c2dfe9985a0e35249239067d510fb522da1ff68d..06e9bded060a3bf1cdd6cf8b3e5ad6b2856d4a1b 100644
--- a/src/common/connection.py
+++ b/src/common/connection.py
@@ -2380,10 +2380,9 @@ class Connection(CommonConnection, ConnectionHandlers):
             tags = {}
             timeout = gajim.config.get_per('room', room_jid,
                 'muc_restore_timeout')
-            if timeout is None:
-                timeout = gajim.config.get('muc_restore_timeout') * 60
-            else:
-                timeout *= 60
+            if timeout is None or timeout == -2:
+                timeout = gajim.config.get('muc_restore_timeout')
+            timeout *= 60
             if timeout >= 0:
                 last_date = self.last_history_time[room_jid]
                 if last_date == 0:
@@ -2394,7 +2393,7 @@ class Connection(CommonConnection, ConnectionHandlers):
                     last_date))
                 tags['since'] = last_date
             nb = gajim.config.get_per('room', room_jid, 'muc_restore_lines')
-            if nb is None:
+            if nb is None or nb == -2:
                 nb = gajim.config.get('muc_restore_lines')
             if nb >= 0:
                 tags['maxstanzas'] = nb