Daniel Brötzmann pushed to branch chat_markers at gajim / gajim


Commits:
a21d8fdc by wurstsalat at 2020-10-24T18:44:42+02:00
Improvements 2

- - - - -


3 changed files:

- gajim/common/modules/chat_markers.py
- gajim/common/settings.py
- gajim/gtk/accounts.py


Changes:

=====================================
gajim/common/modules/chat_markers.py
=====================================
@@ -91,8 +91,14 @@ def _send_marker(self, contact, marker, id_, type_):
             jid = app.get_jid_without_resource(contact.jid)
 
         if type_ in ('gc', 'pm'):
+            disco_info = app.storage.cache.get_last_disco_info(jid)
+
+            context = 'public'
+            if disco_info is not None and disco_info.muc_is_members_only:
+                context = 'private'
+
             if not app.settings.get_group_chat_setting(
-                    self._account, jid, 'send_marker'):
+                    self._account, jid, 'send_marker', context=context):
                 return
         else:
             if not app.settings.get_contact_setting(


=====================================
gajim/common/settings.py
=====================================
@@ -678,11 +678,13 @@ def set_group_chat_setting(self,
 
     def set_group_chat_settings(self,
                                 setting: str,
-                                value: SETTING_TYPE) -> None:
+                                value: SETTING_TYPE,
+                                context: str = None) -> None:
 
         for account in self._account_settings:
             for jid in self._account_settings[account]['group_chat']:
-                self.set_group_chat_setting(account, jid, setting, value)
+                self.set_group_chat_setting(
+                    account, jid, setting, value, context)
 
     def get_contact_setting(self,
                             account: str,


=====================================
gajim/gtk/accounts.py
=====================================
@@ -720,7 +720,7 @@ def __init__(self, account):
                            'button-style': 'destructive-action',
                            'button-callback': self._reset_gc_send_chatstate}),
 
-             Setting(SettingKind.SWITCH,
+            Setting(SettingKind.SWITCH,
                     _('Send Read Markers'),
                     SettingType.VALUE,
                     app.settings.get_account_setting(
@@ -761,7 +761,8 @@ def _send_read_marker(self, state, _data):
     def _reset_send_read_marker(self, button):
         button.set_sensitive(False)
         app.settings.set_contact_settings('send_marker', None)
-        # app.settings.set_group_chat_settings('send_marker', None)
+        app.settings.set_group_chat_settings(
+            'send_marker', None, context='private')
         for ctrl in app.interface.msg_win_mgr.get_controls(acct=self._account):
             ctrl.update_actions()
 



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

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


_______________________________________________
Commits mailing list
Commits@gajim.org
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to