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

Commits:

4 changed files:

Changes:

  • gajim/common/config.py
    ... ... @@ -235,8 +235,8 @@ class Config:
    235 235
             'show_location_in_roster': [opt_bool, True, '', True],
    
    236 236
             'avatar_position_in_roster': [opt_str, 'right', _('Define the position of the avatar in roster. Can be left or right'), True],
    
    237 237
             'print_status_in_chats': [opt_bool, False, _('If False, Gajim will no longer print status line in chats when a contact changes their status and/or their status message.')],
    
    238
    -        'print_join_leave_in_mucs': [opt_bool, False, _('Default Setting: Show a status message for every join or leave in a group chat')],
    
    239
    -        'print_status_in_mucs': [opt_bool, False, _('Default Setting: Show a status message for all status (away, dnd, etc.) changes of users in a group chat')],
    
    238
    +        'print_join_left_default': [opt_bool, False, _('Default Setting: Show a status message for every join or leave in a group chat')],
    
    239
    +        'print_status_muc_default': [opt_bool, False, _('Default Setting: Show a status message for all status (away, dnd, etc.) changes of users in a group chat')],
    
    240 240
             'log_contact_status_changes': [opt_bool, False],
    
    241 241
             'log_xhtml_messages': [opt_bool, False, _('Log XHTML messages instead of plain text messages.')],
    
    242 242
             'restored_messages_small': [opt_bool, True, _('If true, restored messages will use a smaller font than the default one.')],
    

  • gajim/common/modules/muc.py
    ... ... @@ -226,10 +226,16 @@ class MUC:
    226 226
                     # handled by the opened ChatControl
    
    227 227
                     break
    
    228 228
     
    
    229
    -            # We remove the contact from the MUC, but there could be
    
    230
    -            # a PrivateChatControl open, so we update the contacts presence
    
    231
    -            contact.presence = properties.type
    
    232
    -            app.contacts.remove_gc_contact(self._account, contact)
    
    229
    +            if contact is None:
    
    230
    +                # If contact is None, its probably that a user left from a not
    
    231
    +                # insync MUC, can happen on older servers
    
    232
    +                log.warning('Unknown contact left groupchat: %s',
    
    233
    +                            properties.jid)
    
    234
    +            else:
    
    235
    +                # We remove the contact from the MUC, but there could be
    
    236
    +                # a PrivateChatControl open, so we update the contacts presence
    
    237
    +                contact.presence = properties.type
    
    238
    +                app.contacts.remove_gc_contact(self._account, contact)
    
    233 239
                 log.info('User %s left', properties.jid)
    
    234 240
                 self._raise_muc_event('muc-user-left', properties)
    
    235 241
                 raise nbxmpp.NodeProcessed
    

  • gajim/groupchat_control.py
    ... ... @@ -397,7 +397,7 @@ class GroupchatControl(ChatControlBase):
    397 397
             act.connect('change-state', self._on_notify_on_all_messages)
    
    398 398
             self.parent_win.window.add_action(act)
    
    399 399
     
    
    400
    -        status_default = app.config.get('print_status_in_mucs')
    
    400
    +        status_default = app.config.get('print_status_muc_default')
    
    401 401
             value = app.config.get_per('rooms', self.contact.jid,
    
    402 402
                                        'print_status', status_default)
    
    403 403
     
    
    ... ... @@ -407,7 +407,7 @@ class GroupchatControl(ChatControlBase):
    407 407
             act.connect('change-state', self._on_print_status)
    
    408 408
             self.parent_win.window.add_action(act)
    
    409 409
     
    
    410
    -        join_default = app.config.get('print_join_leave_in_mucs')
    
    410
    +        join_default = app.config.get('print_join_left_default')
    
    411 411
             value = app.config.get_per('rooms', self.contact.jid,
    
    412 412
                                        'print_join_left', join_default)
    
    413 413
     
    
    ... ... @@ -2008,8 +2008,9 @@ class GroupchatControl(ChatControlBase):
    2008 2008
             #Group Chat: We have been removed from the room
    
    2009 2009
             message = _('{nick} has been removed from the room{by}{reason}')
    
    2010 2010
     
    
    2011
    +        join_default = app.config.get('print_join_left_default')
    
    2011 2012
             print_join_left = app.config.get_per(
    
    2012
    -            'rooms', self.room_jid, 'print_join_left')
    
    2013
    +            'rooms', self.room_jid, 'print_join_left', join_default)
    
    2013 2014
     
    
    2014 2015
             if StatusCode.REMOVED_ERROR in status_codes:
    
    2015 2016
                 # Handle 333 before 307, some MUCs add both
    
    ... ... @@ -2060,8 +2061,9 @@ class GroupchatControl(ChatControlBase):
    2060 2061
                 return
    
    2061 2062
     
    
    2062 2063
             nick = event.properties.muc_nickname
    
    2064
    +        join_default = app.config.get('print_join_left_default')
    
    2063 2065
             print_join_left = app.config.get_per(
    
    2064
    -            'rooms', self.room_jid, 'print_join_left')
    
    2066
    +            'rooms', self.room_jid, 'print_join_left', join_default)
    
    2065 2067
     
    
    2066 2068
             self.add_contact_to_roster(nick)
    
    2067 2069
     
    

  • gajim/gtk/preferences.py
    ... ... @@ -161,10 +161,10 @@ class Preferences(Gtk.ApplicationWindow):
    161 161
             self._ui.sync_threshold_combobox.set_id_column(0)
    
    162 162
             self._ui.sync_threshold_combobox.set_active_id(str(public_threshold))
    
    163 163
     
    
    164
    -        st = app.config.get('print_join_leave_in_mucs')
    
    164
    +        st = app.config.get('print_join_left_default')
    
    165 165
             self._ui.join_leave_checkbutton.set_active(st)
    
    166 166
     
    
    167
    -        st = app.config.get('print_status_in_mucs')
    
    167
    +        st = app.config.get('print_status_muc_default')
    
    168 168
             self._ui.status_change_checkbutton.set_active(st)
    
    169 169
     
    
    170 170
             # Displayed chat state notifications
    
    ... ... @@ -620,10 +620,10 @@ class Preferences(Gtk.ApplicationWindow):
    620 620
             app.config.set('public_room_sync_threshold', int(active))
    
    621 621
     
    
    622 622
         def _on_join_leave_toggled(self, widget):
    
    623
    -        self.on_checkbutton_toggled(widget, 'print_join_leave_in_mucs')
    
    623
    +        self.on_checkbutton_toggled(widget, 'print_join_left_default')
    
    624 624
     
    
    625 625
         def _on_status_change_toggled(self, widget):
    
    626
    -        self.on_checkbutton_toggled(widget, 'print_status_in_mucs')
    
    626
    +        self.on_checkbutton_toggled(widget, 'print_status_muc_default')
    
    627 627
     
    
    628 628
         def on_show_chatstate_in_tabs_toggled(self, widget):
    
    629 629
             self.on_checkbutton_toggled(widget, 'show_chatstate_in_tabs')