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


Commits:
890ec90b by wurstsalat at 2022-05-23T14:27:10+02:00
chore: Interface: Remove unused method

- - - - -
fa426918 by wurstsalat at 2022-05-23T14:37:21+02:00
chore: Interface: Move read-state-sync processing

- - - - -
569beefb by wurstsalat at 2022-05-23T14:48:32+02:00
perf: MessageInputTextView: Limit chars when applying styles

Part of #10828

- - - - -


3 changed files:

- gajim/gtk/main.py
- gajim/gtk/message_input.py
- gajim/gui_interface.py


Changes:

=====================================
gajim/gtk/main.py
=====================================
@@ -113,6 +113,7 @@ def __init__(self) -> None:
             ('message-moderated', ged.CORE, self._on_event),
             ('receipt-received', ged.GUI1, self._on_event),
             ('displayed-received', ged.GUI1, self._on_event),
+            ('read-state-sync', ged.GUI1, self._on_read_state_sync),
             ('message-error', ged.GUI1, self._on_event),
             ('muc-disco-update', ged.GUI1, self._on_event),
             ('jingle-request-received', ged.GUI1, self._on_jingle_request),
@@ -790,6 +791,21 @@ def _on_message_received(self, event: 
events.MessageReceived) -> None:
 
         self._main_stack.process_event(event)
 
+    def _on_read_state_sync(self, event: events.ReadStateSync) -> None:
+        if event.is_muc_pm:
+            jid = JID.from_string(event.jid.bare)
+        else:
+            jid = event.jid
+
+        control = self.get_control(event.account, jid)
+        if control is None:
+            return
+
+        if event.marker_id != control.last_msg_id:
+            return
+
+        self.mark_as_read(event.account, jid, send_marker=False)
+
     def _on_jingle_request(self, event: events.JingleRequestReceived) -> None:
         if not self.chat_exists(event.account, event.jid):
             for item in event.contents:


=====================================
gajim/gtk/message_input.py
=====================================
@@ -120,6 +120,11 @@ def _on_text_changed(self, buf: Gtk.TextBuffer) -> None:
             return
 
         self._clear_tags()
+
+        if len(text) > 20000:
+            # Limit message styling processing
+            return
+
         result = process(text)
         for block in result.blocks:
             if isinstance(block, PlainBlock):


=====================================
gajim/gui_interface.py
=====================================
@@ -132,7 +132,6 @@ def _create_core_handlers_list(self) -> None:
             'presence-received': [self.handle_event_presence],
             'message-sent': [self.handle_event_msgsent],
             'message-not-sent': [self.handle_event_msgnotsent],
-            'read-state-sync': [self.handle_event_read_state_sync],
         }
         # pylint: enable=line-too-long
 
@@ -209,23 +208,6 @@ def handle_event_msgnotsent(event):
             event.conn.name,
             msg_type='error')
 
-    @staticmethod
-    def handle_event_read_state_sync(event):
-        if event.type.is_groupchat:
-            jid = event.jid.bare
-        else:
-            jid = event.jid
-
-        control = app.window.get_control(event.account, jid)
-        if control is None:
-            log.warning('No ChatControl found')
-            return
-
-        if event.marker_id != control.last_msg_id:
-            return
-
-        app.window.mark_as_read(event.account, jid, send_marker=False)
-
     # Jingle File Transfer
     @staticmethod
     def handle_event_file_error(title: str, message: str) -> None:
@@ -609,19 +591,6 @@ def change_status(self,
 
             self._change_status(acc, status)
 
-    def change_account_status(self, account: str, status: str) -> None:
-        ask = ask_for_status_message(status)
-
-        client = app.get_client(account)
-        if status is None:
-            status = client.status
-
-        if ask:
-            app.window.show_account_page(account)
-            return
-
-        self._change_status(account, status)
-
     @staticmethod
     def _change_status(account: str, status: str) -> None:
         client = app.get_client(account)



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/compare/7682bd8f63a76ec1df8c9801f25805737c794fc8...569beefb3320ec5aca3ff7a1b1f4e2617c459137

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/compare/7682bd8f63a76ec1df8c9801f25805737c794fc8...569beefb3320ec5aca3ff7a1b1f4e2617c459137
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to