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

Commits:

5 changed files:

Changes:

  • gajim/common/app.py
    ... ... @@ -58,6 +58,7 @@
    58 58
         from gajim.gui.application import GajimApplication
    
    59 59
         from gajim.common.storage.cache import CacheStorage
    
    60 60
         from gajim.common.storage.archive import MessageArchiveStorage
    
    61
    +    from gajim.common.cert_store import CertificateStore
    
    61 62
     
    
    62 63
     
    
    63 64
     interface = cast(types.InterfaceT, None)
    
    ... ... @@ -111,7 +112,7 @@ def __init__(self):
    111 112
     
    
    112 113
     proxy65_manager = None
    
    113 114
     
    
    114
    -cert_store = None
    
    115
    +cert_store = cast('CertificateStore', None)
    
    115 116
     
    
    116 117
     task_manager = None
    
    117 118
     
    

  • gajim/gtk/chat_list_stack.py
    ... ... @@ -26,24 +26,24 @@
    26 26
     from nbxmpp import JID
    
    27 27
     
    
    28 28
     from gajim.common import app
    
    29
    -from gajim.common.events import ApplicationEvent
    
    29
    +from gajim.common import events
    
    30 30
     
    
    31 31
     from . import structs
    
    32 32
     from .chat_filter import ChatFilter
    
    33 33
     from .chat_list import ChatList
    
    34 34
     from .chat_list import ChatRow
    
    35 35
     
    
    36
    -HANDLED_EVENTS = [
    
    37
    -    'message-received',
    
    38
    -    'mam-message-received',
    
    39
    -    'gc-message-received',
    
    40
    -    'message-updated',
    
    41
    -    'presence-received',
    
    42
    -    'message-sent',
    
    43
    -    'chatstate-received',
    
    44
    -    'jingle-request-received',
    
    45
    -    'file-request-received'
    
    46
    -]
    
    36
    +
    
    37
    +HANDLED_EVENTS = (
    
    38
    +    events.MessageReceived,
    
    39
    +    events.MamMessageReceived,
    
    40
    +    events.GcMessageReceived,
    
    41
    +    events.MessageUpdated,
    
    42
    +    events.PresenceReceived,
    
    43
    +    events.MessageSent,
    
    44
    +    events.JingleRequestReceived,
    
    45
    +    events.FileRequestReceivedEvent
    
    46
    +)
    
    47 47
     
    
    48 48
     
    
    49 49
     class ChatListStack(Gtk.Stack):
    
    ... ... @@ -296,11 +296,13 @@ def mark_as_read(self, account: str, jid: JID) -> None:
    296 296
             for chat_list in self._chat_lists.values():
    
    297 297
                 chat_list.mark_as_read(account, jid)
    
    298 298
     
    
    299
    -    def process_event(self, event: ApplicationEvent) -> None:
    
    300
    -        if event.name not in HANDLED_EVENTS:
    
    299
    +    def process_event(self, event: events.ApplicationEvent) -> None:
    
    300
    +        if not isinstance(event, HANDLED_EVENTS):
    
    301 301
                 return
    
    302 302
     
    
    303
    -        chat_list = self.find_chat(event.account, event.jid)
    
    303
    +        jid = JID.from_string(event.jid)
    
    304
    +
    
    305
    +        chat_list = self.find_chat(event.account, jid)
    
    304 306
             if chat_list is None:
    
    305 307
                 return
    
    306 308
             chat_list.process_event(event)

  • gajim/gtk/groupchat_inviter.py
    ... ... @@ -13,12 +13,13 @@
    13 13
     # along with Gajim. If not, see <http://www.gnu.org/licenses/>.
    
    14 14
     
    
    15 15
     from __future__ import annotations
    
    16
    +
    
    16 17
     from typing import List
    
    17 18
     from typing import Optional
    
    18 19
     
    
    19 20
     import locale
    
    20 21
     
    
    21
    -from gi.repository import Gdk
    
    22
    +from gi.repository import Gdk, GdkPixbuf
    
    22 23
     from gi.repository import GLib
    
    23 24
     from gi.repository import GObject
    
    24 25
     from gi.repository import Gtk
    
    ... ... @@ -110,6 +111,7 @@ def _get_avatar_image(self,
    110 111
     
    
    111 112
             scale = self.get_scale_factor()
    
    112 113
             surface = contact.get_avatar(AvatarSize.ROSTER, scale)
    
    114
    +        assert not isinstance(surface, GdkPixbuf.Pixbuf)
    
    113 115
             return Gtk.Image.new_from_surface(surface)
    
    114 116
     
    
    115 117
         def update_jid(self, jid: str) -> None:
    
    ... ... @@ -233,10 +235,10 @@ def _on_invitee_removed(self,
    233 235
                 client = app.get_client(account)
    
    234 236
                 contact = client.get_module('Contacts').get_contact(jid)
    
    235 237
                 row = ContactRow(account,
    
    236
    -                            contact,
    
    237
    -                            str(contact.jid),
    
    238
    -                            contact.name,
    
    239
    -                            show_account)
    
    238
    +                             contact,
    
    239
    +                             str(contact.jid),
    
    240
    +                             contact.name,
    
    241
    +                             show_account)
    
    240 242
                 self._ui.contacts_listbox.add(row)
    
    241 243
             self._ui.search_entry.grab_focus()
    
    242 244
             self.emit('listbox-changed', flowbox.has_contacts())
    

  • gajim/remote_control.py
    ... ... @@ -295,16 +295,9 @@ def __init__(self):
    295 295
                 self.on_account_created)
    
    296 296
             app.ged.register_event_handler('vcard-received', ged.POSTGUI,
    
    297 297
                 self.on_vcard_received)
    
    298
    -        app.ged.register_event_handler('chatstate-received', ged.POSTGUI,
    
    299
    -            self.on_chatstate_received)
    
    300 298
             app.ged.register_event_handler('message-sent', ged.POSTGUI,
    
    301 299
                 self.on_message_sent)
    
    302 300
     
    
    303
    -    def on_chatstate_received(self, event):
    
    304
    -        self.raise_signal(
    
    305
    -            'ChatState',
    
    306
    -            (event.account, [event.contact.jid, event.contact.chatstate]))
    
    307
    -
    
    308 301
         def on_message_sent(self, obj):
    
    309 302
             try:
    
    310 303
                 chatstate = obj.chatstate
    

  • pyrightconfig.json
    ... ... @@ -19,6 +19,7 @@
    19 19
             "gajim/gtk/account_page.py",
    
    20 20
             "gajim/gtk/app_side_bar.py",
    
    21 21
             "gajim/gtk/chat_filter.py",
    
    22
    +        "gajim/gtk/chat_list_stack.py",
    
    22 23
             "gajim/gtk/chat_page.py",
    
    23 24
             "gajim/gtk/conversation/code_widget.py",
    
    24 25
             "gajim/gtk/conversation/jump_to_end_button.py",
    
    ... ... @@ -36,10 +37,15 @@
    36 37
             "gajim/gtk/conversation/rows/scroll_hint.py",
    
    37 38
             "gajim/gtk/conversation/rows/widgets.py",
    
    38 39
             "gajim/gtk/conversation/scrolled.py",
    
    40
    +        "gajim/gtk/groupchat_invitation.py",
    
    41
    +        "gajim/gtk/groupchat_inviter.py",
    
    42
    +        "gajim/gtk/groupchat_nick.py",
    
    43
    +        "gajim/gtk/groupchat_state.py",
    
    39 44
             "gajim/gtk/main_stack.py",
    
    40 45
             "gajim/gtk/notification.py",
    
    41 46
             "gajim/gtk/structs.py",
    
    42 47
             "gajim/gtk/sidebar_switcher.py",
    
    48
    +        "gajim/gtk/ssl_error_dialog.py",
    
    43 49
             "gajim/gtk/status_icon.py",
    
    44 50
             "gajim/gtk/status_message_selector.py",
    
    45 51
             "gajim/gtk/status_selector.py",