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

Commits:

3 changed files:

Changes:

  • gajim/common/modules/chat_markers.py
    ... ... @@ -91,8 +91,14 @@ def _send_marker(self, contact, marker, id_, type_):
    91 91
                 jid = app.get_jid_without_resource(contact.jid)
    
    92 92
     
    
    93 93
             if type_ in ('gc', 'pm'):
    
    94
    +            disco_info = app.storage.cache.get_last_disco_info(jid)
    
    95
    +
    
    96
    +            context = 'public'
    
    97
    +            if disco_info is not None and disco_info.muc_is_members_only:
    
    98
    +                context = 'private'
    
    99
    +
    
    94 100
                 if not app.settings.get_group_chat_setting(
    
    95
    -                    self._account, jid, 'send_marker'):
    
    101
    +                    self._account, jid, 'send_marker', context=context):
    
    96 102
                     return
    
    97 103
             else:
    
    98 104
                 if not app.settings.get_contact_setting(
    

  • gajim/common/settings.py
    ... ... @@ -678,11 +678,13 @@ def set_group_chat_setting(self,
    678 678
     
    
    679 679
         def set_group_chat_settings(self,
    
    680 680
                                     setting: str,
    
    681
    -                                value: SETTING_TYPE) -> None:
    
    681
    +                                value: SETTING_TYPE,
    
    682
    +                                context: str = None) -> None:
    
    682 683
     
    
    683 684
             for account in self._account_settings:
    
    684 685
                 for jid in self._account_settings[account]['group_chat']:
    
    685
    -                self.set_group_chat_setting(account, jid, setting, value)
    
    686
    +                self.set_group_chat_setting(
    
    687
    +                    account, jid, setting, value, context)
    
    686 688
     
    
    687 689
         def get_contact_setting(self,
    
    688 690
                                 account: str,
    

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