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

Commits:

10 changed files:

Changes:

  • gajim/common/modules/discovery.py
    ... ... @@ -234,7 +234,7 @@ def disco_muc(self,
    234 234
             app.nec.push_incoming_event(NetworkEvent(
    
    235 235
                 'muc-disco-update',
    
    236 236
                 account=self._account,
    
    237
    -            room_jid=result.info.jid))
    
    237
    +            jid=result.info.jid))
    
    238 238
     
    
    239 239
             yield result
    
    240 240
     
    

  • gajim/common/modules/message.py
    ... ... @@ -160,11 +160,6 @@ def _message_received(self, _con, stanza, properties):
    160 160
             parse_oob(properties, additional_data)
    
    161 161
             parse_xhtml(properties, additional_data)
    
    162 162
     
    
    163
    -        app.nec.push_incoming_event(NetworkEvent('update-client-info',
    
    164
    -                                                 account=self._account,
    
    165
    -                                                 jid=jid,
    
    166
    -                                                 resource=resource))
    
    167
    -
    
    168 163
             if properties.is_encrypted:
    
    169 164
                 additional_data['encrypted'] = properties.encrypted.additional_data
    
    170 165
             else:
    

  • gajim/common/modules/muc.py
    ... ... @@ -190,7 +190,7 @@ def _on_disco_result(self, task):
    190 190
                 app.nec.push_incoming_event(
    
    191 191
                     NetworkEvent('muc-join-failed',
    
    192 192
                                  account=self._account,
    
    193
    -                             room_jid=error.jid.bare,
    
    193
    +                             jid=error.jid.bare,
    
    194 194
                                  error=error))
    
    195 195
                 return
    
    196 196
     
    
    ... ... @@ -269,7 +269,7 @@ def _on_room_config(self, task):
    269 269
                 app.nec.push_incoming_event(NetworkEvent(
    
    270 270
                     'muc-configuration-failed',
    
    271 271
                     account=self._account,
    
    272
    -                room_jid=error.jid,
    
    272
    +                jid=error.jid,
    
    273 273
                     error=error))
    
    274 274
                 return
    
    275 275
     
    
    ... ... @@ -302,7 +302,7 @@ def _on_config_result(self, task):
    302 302
                 app.nec.push_incoming_event(NetworkEvent(
    
    303 303
                     'muc-configuration-failed',
    
    304 304
                     account=self._account,
    
    305
    -                room_jid=error.jid,
    
    305
    +                jid=error.jid,
    
    306 306
                     error=error))
    
    307 307
                 return
    
    308 308
     
    
    ... ... @@ -338,7 +338,7 @@ def _on_disco_result_after_config(self, task):
    338 338
             app.nec.push_incoming_event(NetworkEvent(
    
    339 339
                 'muc-configuration-finished',
    
    340 340
                 account=self._account,
    
    341
    -            room_jid=jid))
    
    341
    +            jid=jid))
    
    342 342
     
    
    343 343
         def update_presence(self):
    
    344 344
             mucs = self._manager.get_mucs_with_state([MUCJoinedState.JOINED,
    
    ... ... @@ -382,7 +382,7 @@ def _on_error_presence(self, _con, _stanza, properties):
    382 382
                         app.nec.push_incoming_event(
    
    383 383
                             NetworkEvent('muc-join-failed',
    
    384 384
                                          account=self._account,
    
    385
    -                                     room_jid=room_jid,
    
    385
    +                                     jid=room_jid,
    
    386 386
                                          error=properties.error))
    
    387 387
     
    
    388 388
             elif muc_data.state == MUCJoinedState.CREATING:
    
    ... ... @@ -390,14 +390,14 @@ def _on_error_presence(self, _con, _stanza, properties):
    390 390
                 app.nec.push_incoming_event(
    
    391 391
                     NetworkEvent('muc-creation-failed',
    
    392 392
                                  account=self._account,
    
    393
    -                             room_jid=room_jid,
    
    393
    +                             jid=room_jid,
    
    394 394
                                  error=properties.error))
    
    395 395
     
    
    396 396
             elif muc_data.state == MUCJoinedState.CAPTCHA_REQUEST:
    
    397 397
                 app.nec.push_incoming_event(
    
    398 398
                     NetworkEvent('muc-captcha-error',
    
    399 399
                                  account=self._account,
    
    400
    -                             room_jid=room_jid,
    
    400
    +                             jid=room_jid,
    
    401 401
                                  error_text=to_user_string(properties.error)))
    
    402 402
                 self._manager.set_state(room_jid, MUCJoinedState.CAPTCHA_FAILED)
    
    403 403
                 self._manager.set_state(room_jid, MUCJoinedState.NOT_JOINED)
    
    ... ... @@ -572,7 +572,7 @@ def _raise_muc_event(self, event_name, properties):
    572 572
             app.nec.push_incoming_event(
    
    573 573
                 NetworkEvent(event_name,
    
    574 574
                              account=self._account,
    
    575
    -                         room_jid=properties.jid.bare,
    
    575
    +                         jid=properties.jid.bare,
    
    576 576
                              properties=properties))
    
    577 577
             self._log_muc_event(event_name, properties)
    
    578 578
     
    
    ... ... @@ -654,7 +654,7 @@ def _handle_subject_change(self, room_jid, subject, nickname, timestamp):
    654 654
             app.nec.push_incoming_event(
    
    655 655
                 NetworkEvent('muc-subject',
    
    656 656
                              account=self._account,
    
    657
    -                         room_jid=room_jid,
    
    657
    +                         jid=room_jid,
    
    658 658
                              subject=subject,
    
    659 659
                              nickname=nickname,
    
    660 660
                              user_timestamp=timestamp,
    
    ... ... @@ -666,7 +666,7 @@ def _handle_subject_change(self, room_jid, subject, nickname, timestamp):
    666 666
                 app.nec.push_incoming_event(
    
    667 667
                     NetworkEvent('muc-joined',
    
    668 668
                                  account=self._account,
    
    669
    -                             room_jid=muc_data.jid))
    
    669
    +                             jid=muc_data.jid))
    
    670 670
     
    
    671 671
         def _room_join_complete(self, muc_data):
    
    672 672
             self._remove_join_timeout(muc_data.jid)
    
    ... ... @@ -697,7 +697,7 @@ def _on_voice_request(self, _con, _stanza, properties):
    697 697
             app.nec.push_incoming_event(
    
    698 698
                 NetworkEvent('muc-voice-request',
    
    699 699
                              account=self._account,
    
    700
    -                         room_jid=str(properties.muc_jid),
    
    700
    +                         jid=str(properties.muc_jid),
    
    701 701
                              voice_request=properties.voice_request))
    
    702 702
             raise nbxmpp.NodeProcessed
    
    703 703
     
    
    ... ... @@ -734,7 +734,7 @@ def _on_captcha_challenge(self, _con, _stanza, properties):
    734 734
             app.nec.push_incoming_event(
    
    735 735
                 NetworkEvent('muc-captcha-challenge',
    
    736 736
                              account=self._account,
    
    737
    -                         room_jid=properties.jid.bare,
    
    737
    +                         jid=properties.jid.bare,
    
    738 738
                              form=properties.captcha.form))
    
    739 739
             raise nbxmpp.NodeProcessed
    
    740 740
     
    
    ... ... @@ -767,7 +767,7 @@ def _on_captcha_result(self, task):
    767 767
                 app.nec.push_incoming_event(
    
    768 768
                     NetworkEvent('muc-captcha-error',
    
    769 769
                                  account=self._account,
    
    770
    -                             room_jid=str(error.jid),
    
    770
    +                             jid=str(error.jid),
    
    771 771
                                  error_text=to_user_string(error)))
    
    772 772
     
    
    773 773
         def _on_config_change(self, _con, _stanza, properties):
    
    ... ... @@ -780,7 +780,7 @@ def _on_config_change(self, _con, _stanza, properties):
    780 780
             app.nec.push_incoming_event(
    
    781 781
                 NetworkEvent('muc-config-changed',
    
    782 782
                              account=self._account,
    
    783
    -                         room_jid=room_jid,
    
    783
    +                         jid=room_jid,
    
    784 784
                              status_codes=properties.muc_status_codes))
    
    785 785
             raise nbxmpp.NodeProcessed
    
    786 786
     
    

  • gajim/groupchat_control.py
    ... ... @@ -460,8 +460,6 @@ def _get_current_page(self):
    460 460
             return self.xml.stack.get_visible_child_name()
    
    461 461
     
    
    462 462
         def _on_muc_disco_update(self, _event):
    
    463
    -        if self.parent_win is None:
    
    464
    -            return
    
    465 463
             self.update_actions()
    
    466 464
             self.draw_banner_text()
    
    467 465
     
    
    ... ... @@ -765,10 +763,12 @@ def draw_banner_text(self):
    765 763
             """
    
    766 764
             self.xml.banner_name_label.set_text(self.room_name)
    
    767 765
     
    
    768
    -    @event_filter(['jid=room_jid'])
    
    769
    -    def _on_update_room_avatar(self, event):
    
    766
    +    def _on_update_room_avatar(self, _event):
    
    770 767
             self._update_avatar()
    
    771 768
     
    
    769
    +    def _on_update_gc_avatar(self, event):
    
    770
    +        self.roster.process_avatar_update(event)
    
    771
    +
    
    772 772
         def _on_bookmarks_received(self, _event):
    
    773 773
             self.draw_banner_text()
    
    774 774
     
    

  • gajim/gtk/chat_list_stack.py
    ... ... @@ -161,9 +161,5 @@ def process_event(self, event):
    161 161
             if event.name not in HANDLED_EVENTS:
    
    162 162
                 return
    
    163 163
     
    
    164
    -        if hasattr(event, 'jid'):
    
    165
    -            jid = event.jid
    
    166
    -        else:
    
    167
    -            jid = event.room_jid
    
    168
    -        chat_list = self._find_chat(event.account, jid)
    
    164
    +        chat_list = self._find_chat(event.account, event.jid)
    
    169 165
             chat_list.process_event(event)

  • gajim/gtk/chat_stack.py
    ... ... @@ -89,9 +89,5 @@ def clear(self):
    89 89
             self.set_visible_child_name('empty')
    
    90 90
     
    
    91 91
         def process_event(self, event):
    
    92
    -        if hasattr(event, 'jid'):
    
    93
    -            jid = event.jid
    
    94
    -        else:
    
    95
    -            jid = event.room_jid
    
    96
    -        control = self.get_control(event.account, jid)
    
    92
    +        control = self.get_control(event.account, event.jid)
    
    97 93
             control.process_event(event)

  • gajim/gtk/groupchat_roster.py
    ... ... @@ -102,7 +102,6 @@ def __init__(self, account, room_jid, control):
    102 102
     
    
    103 103
             self.register_events([
    
    104 104
                 ('theme-update', ged.GUI2, self._on_theme_update),
    
    105
    -            ('update-gc-avatar', ged.GUI1, self._on_avatar_update),
    
    106 105
             ])
    
    107 106
     
    
    108 107
         @staticmethod
    
    ... ... @@ -458,8 +457,7 @@ def get_role(self, nick):
    458 457
         def _on_theme_update(self, _event):
    
    459 458
             self.redraw()
    
    460 459
     
    
    461
    -    @event_filter(['room_jid'])
    
    462
    -    def _on_avatar_update(self, event):
    
    460
    +    def process_avatar_update(self, event):
    
    463 461
             self.draw_avatar(event.contact)
    
    464 462
     
    
    465 463
         def clear(self):
    

  • gajim/gtk/main.py
    ... ... @@ -72,7 +72,6 @@ def __init__(self):
    72 72
                 ('activity-received', ged.GUI1, self._on_event),
    
    73 73
                 ('tune-received', ged.GUI1, self._on_event),
    
    74 74
                 ('location-received', ged.GUI1, self._on_event),
    
    75
    -            ('update-client-info', ged.GUI1, self._on_event),
    
    76 75
                 ('chatstate-received', ged.GUI1, self._on_event),
    
    77 76
                 ('caps-update', ged.GUI1, self._on_event),
    
    78 77
                 ('message-sent', ged.OUT_POSTCORE, self._on_event),
    
    ... ... @@ -82,8 +81,9 @@ def __init__(self):
    82 81
                 ('receipt-received', ged.GUI1, self._on_event),
    
    83 82
                 ('displayed-received', ged.GUI1, self._on_event),
    
    84 83
                 ('message-error', ged.GUI1, self._on_event),
    
    85
    -            ('zeroconf-error', ged.GUI1, self._on_event),
    
    86 84
                 ('update-roster-avatar', ged.GUI1, self._on_event),
    
    85
    +            ('update-room-avatar', ged.GUI1, self._on_event),
    
    86
    +            ('update-gc-avatar', ged.GUI1, self._on_event),
    
    87 87
                 ('muc-creation-failed', ged.GUI1, self._on_event),
    
    88 88
                 ('muc-joined', ged.GUI1, self._on_event),
    
    89 89
                 ('muc-join-failed', ged.GUI1, self._on_event),
    
    ... ... @@ -106,8 +106,6 @@ def __init__(self):
    106 106
                 ('muc-disco-update', ged.GUI1, self._on_event),
    
    107 107
                 ('muc-configuration-finished', ged.GUI1, self._on_event),
    
    108 108
                 ('muc-configuration-failed', ged.GUI1, self._on_event),
    
    109
    -            ('update-room-avatar', ged.GUI1, self._on_event),
    
    110
    -            ('message-error', ged.GUI1, self._on_event),
    
    111 109
             ])
    
    112 110
     
    
    113 111
             self.show_all()
    
    ... ... @@ -299,22 +297,13 @@ def _on_edit_workspace_clicked(self, _button):
    299 297
                         workspace_id=self.get_active_workspace())
    
    300 298
     
    
    301 299
         def _on_event(self, event):
    
    302
    -        if hasattr(event, 'jid'):
    
    303
    -            jid = event.jid
    
    304
    -        else:
    
    305
    -            jid = event.room_jid
    
    306
    -
    
    307 300
             if event.name == 'caps-update':
    
    308 301
                 #TODO
    
    309 302
                 return
    
    310 303
     
    
    311
    -        if event.name == 'update-client-info':
    
    312
    -            #TODO
    
    313
    -            return
    
    314
    -
    
    315
    -        if not self.chat_exists(event.account, jid):
    
    304
    +        if not self.chat_exists(event.account, event.jid):
    
    316 305
                 if event.name == 'message-received':
    
    317
    -                self.add_chat(event.account, jid, 'contact')
    
    306
    +                self.add_chat(event.account, event.jid, 'contact')
    
    318 307
                 else:
    
    319 308
                     # No chat is open, dont handle any gui events
    
    320 309
                     return
    

  • gajim/gui_interface.py
    ... ... @@ -1855,8 +1855,9 @@ def update_avatar(self, account=None, jid=None,
    1855 1855
                     NetworkEvent('update-roster-avatar', account=account, jid=jid))
    
    1856 1856
             else:
    
    1857 1857
                 app.nec.push_incoming_event(NetworkEvent('update-gc-avatar',
    
    1858
    +                                                     account=account,
    
    1858 1859
                                                          contact=contact,
    
    1859
    -                                                     room_jid=contact.room_jid))
    
    1860
    +                                                     jid=contact.room_jid))
    
    1860 1861
     
    
    1861 1862
         def save_avatar(self, data):
    
    1862 1863
             return self.avatar_storage.save_avatar(data)
    

  • gajim/message_window.py
    ... ... @@ -162,9 +162,9 @@ def __init__(self, acct, type_, parent_window=None, parent_paned=None):
    162 162
             self.notebook.set_show_border(app.settings.get('tabs_border'))
    
    163 163
             self.show_icon()
    
    164 164
     
    
    165
    -        self.register_events([
    
    166
    -            ('muc-disco-update', ged.GUI1, self._on_muc_disco_update),
    
    167
    -        ])
    
    165
    +        # self.register_events([
    
    166
    +        #     ('muc-disco-update', ged.GUI1, self._on_muc_disco_update),
    
    167
    +        # ])
    
    168 168
     
    
    169 169
         def _add_actions(self):
    
    170 170
             actions = [