Philipp Hörist pushed to branch master at gajim / gajim


Commits:
eef27894 by Daniel Brötzmann at 2019-12-06T21:48:56Z
ChatControl: Make allow_shutdown more precise

On closing a control this checks if logs are enabled for the contact/account
and displays the appropriate message.

- - - - -


1 changed file:

- gajim/chat_control.py


Changes:

=====================================
gajim/chat_control.py
=====================================
@@ -1136,14 +1136,24 @@ class ChatControl(ChatControlBase):
 
     def allow_shutdown(self, method, on_yes, on_no, _on_minimize):
         time_ = app.last_message_time[self.account][self.get_full_jid()]
+        # 2 seconds
         if time.time() - time_ < 2:
-            # 2 seconds
+            no_log_for = app.config.get_per(
+                'accounts', self.account, 'no_log_for').split()
+            more = ''
+            if self.contact.jid in no_log_for:
+                more = _('Note: Chat history is disabled for this contact.')
+            if self.account in no_log_for:
+                more = _('Note: Chat history is disabled for this account.')
+            text = _('You just received a new message from %s.\n'
+                     'Do you want to close this tab?') % 
self.contact.get_shown_name()
+            if more:
+                text += '\n' + more
+
             NewConfirmationDialog(
                 _('Close'),
-                _('You just received a new message '
-                  'from %s') % self.contact.jid,
-                _('If you close this tab while having chat history disabled, '
-                  'this message will be lost.'),
+                _('New Message'),
+                text,
                 [DialogButton.make('Cancel',
                                    callback=lambda: on_no(self)),
                  DialogButton.make('Remove',



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/commit/eef27894bff0235be3598b3bd9c14ca6d6f59cc3

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/commit/eef27894bff0235be3598b3bd9c14ca6d6f59cc3
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to