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

Commits:

3 changed files:

Changes:

  • gajim/common/modules/contacts.py
    ... ... @@ -147,10 +147,6 @@ def get_resource(self, resource):
    147 147
                 contact = self.add_resource(resource)
    
    148 148
             return contact
    
    149 149
     
    
    150
    -    # @property
    
    151
    -    # def groups(self):
    
    152
    -    #     return self._module('Roster').get_groups(self._jid)
    
    153
    -
    
    154 150
         @property
    
    155 151
         def is_available(self):
    
    156 152
             return any([contact.is_available for contact in self._resources.values()])
    
    ... ... @@ -333,7 +329,7 @@ def update_avatar(self, *args):
    333 329
     
    
    334 330
         def set_not_joined(self):
    
    335 331
             for contact in self._resources.values():
    
    336
    -            contact.update_presence(UNKNOWN_MUC_PRESENCE)
    
    332
    +            contact.update_presence(UNKNOWN_MUC_PRESENCE, notify=False)
    
    337 333
     
    
    338 334
         def get_user_nicknames(self):
    
    339 335
             client = app.get_client(self._account)
    
    ... ... @@ -411,7 +407,11 @@ def get_avatar(self,
    411 407
             return app.interface.avatar_storage.get_surface(
    
    412 408
                 self, size, scale, show, style=style)
    
    413 409
     
    
    414
    -    def update_presence(self, presence, *args):
    
    410
    +    def update_presence(self, presence, *args, notify=True):
    
    411
    +        if not notify:
    
    412
    +            self._presence = presence
    
    413
    +            return
    
    414
    +
    
    415 415
             if not self._presence.available and presence.available:
    
    416 416
                 self._presence = presence
    
    417 417
                 self.notify('user-joined', *args)
    
    ... ... @@ -443,7 +443,7 @@ def set_state(self, state, presence):
    443 443
     
    
    444 444
         def update_avatar(self, *args):
    
    445 445
             app.interface.avatar_storage.invalidate_cache(self._jid)
    
    446
    -        self.notify('avatar-update')
    
    446
    +        self.notify('user-avatar-update')
    
    447 447
     
    
    448 448
     
    
    449 449
     def get_instance(*args: Any, **kwargs: Any) -> Tuple[Contacts, str]:
    

  • gajim/common/modules/muc.py
    ... ... @@ -261,6 +261,7 @@ def leave(self, room_jid, reason=None):
    261 261
             self._manager.set_state(room_jid, MUCJoinedState.NOT_JOINED)
    
    262 262
             room = self._get_contact(room_jid)
    
    263 263
             room.set_not_joined()
    
    264
    +        room.notify('room-left')
    
    264 265
     
    
    265 266
         def configure_room(self, room_jid):
    
    266 267
             self._nbxmpp('MUC').request_config(room_jid,
    
    ... ... @@ -825,8 +826,9 @@ def reset_state(self):
    825 826
             for muc in self._mucs.values():
    
    826 827
                 self.set_state(muc.jid, MUCJoinedState.NOT_JOINED)
    
    827 828
                 self._joined_users.pop(muc.jid, None)
    
    828
    -            contact = client.get_module('Contacts').get_contact(muc.jid)
    
    829
    -            contact.set_not_joined()
    
    829
    +            room = client.get_module('Contacts').get_contact(muc.jid)
    
    830
    +            room.set_not_joined()
    
    831
    +            room.notify('room-left')
    
    830 832
     
    
    831 833
         def __contains__(self, room_jid):
    
    832 834
             return room_jid in self._mucs
    

  • gajim/gui_interface.py
    ... ... @@ -186,8 +186,7 @@ def _response(account, answer):
    186 186
                                    args=[obj, 'yes'])]).show()
    
    187 187
     
    
    188 188
         def handle_event_iq_error(self, event):
    
    189
    -        ctrl = self.msg_win_mgr.get_control(event.properties.jid.bare,
    
    190
    -                                            event.account)
    
    189
    +        ctrl = app.window.get_control(event.account, event.properties.jid.bare)
    
    191 190
             if ctrl and ctrl.is_groupchat:
    
    192 191
                 ctrl.add_info_message('Error: %s' % event.properties.error)
    
    193 192