Philipp Hörist pushed to branch master at gajim / gajim
Commits:
4 changed files:
Changes:
| ... | ... | @@ -19,6 +19,7 @@ ### Runtime Requirements |
| 19 | 19 | - [GtkSourceView](https://gitlab.gnome.org/GNOME/gtksourceview)
|
| 20 | 20 | - [Pango](https://gitlab.gnome.org/GNOME/pango) (>=1.50.0)
|
| 21 | 21 | - [libsoup](https://gitlab.gnome.org/GNOME/libsoup/)
|
| 22 | +- [sqlite](https://www.sqlite.org/) (>=3.33.0)
|
|
| 22 | 23 | |
| 23 | 24 | ### Optional Runtime Requirements
|
| 24 | 25 |
| ... | ... | @@ -797,7 +797,7 @@ def is_not_joined(self) -> bool: |
| 797 | 797 | |
| 798 | 798 | def set_not_joined(self) -> None:
|
| 799 | 799 | for contact in self._resources.values():
|
| 800 | - contact.update_presence(UNKNOWN_MUC_PRESENCE, notify=False)
|
|
| 800 | + contact.update_presence(UNKNOWN_MUC_PRESENCE)
|
|
| 801 | 801 | |
| 802 | 802 | def get_user_nicknames(self) -> list[str]:
|
| 803 | 803 | client = app.get_client(self._account)
|
| ... | ... | @@ -922,39 +922,8 @@ def get_avatar(self, |
| 922 | 922 | return app.app.avatar_storage.get_surface(
|
| 923 | 923 | self, size, scale, show, style=style)
|
| 924 | 924 | |
| 925 | - def update_presence(self,
|
|
| 926 | - presence: MUCPresenceData,
|
|
| 927 | - *args: Any,
|
|
| 928 | - notify: bool = True
|
|
| 929 | - ) -> None:
|
|
| 930 | - if not notify:
|
|
| 931 | - self._presence = presence
|
|
| 932 | - return
|
|
| 933 | - |
|
| 934 | - if not self._presence.available and presence.available:
|
|
| 935 | - self._presence = presence
|
|
| 936 | - self.notify('user-joined', *args)
|
|
| 937 | - return
|
|
| 938 | - |
|
| 939 | - if not presence.available:
|
|
| 940 | - self._presence = presence
|
|
| 941 | - self.notify('user-left', *args)
|
|
| 942 | - return
|
|
| 943 | - |
|
| 944 | - signals: list[str] = []
|
|
| 945 | - if self._presence.affiliation != presence.affiliation:
|
|
| 946 | - signals.append('user-affiliation-changed')
|
|
| 947 | - |
|
| 948 | - if self._presence.role != presence.role:
|
|
| 949 | - signals.append('user-role-changed')
|
|
| 950 | - |
|
| 951 | - if (self._presence.status != presence.status or
|
|
| 952 | - self._presence.show != presence.show):
|
|
| 953 | - signals.append('user-status-show-changed')
|
|
| 954 | - |
|
| 925 | + def update_presence(self, presence: MUCPresenceData) -> None:
|
|
| 955 | 926 | self._presence = presence
|
| 956 | - for signal in signals:
|
|
| 957 | - self.notify(signal, *args)
|
|
| 958 | 927 | |
| 959 | 928 | def update_avatar(self, *args: Any) -> None:
|
| 960 | 929 | app.app.avatar_storage.invalidate_cache(self._jid)
|
| ... | ... | @@ -61,6 +61,7 @@ |
| 61 | 61 | from gajim.common.modules.bits_of_binary import store_bob_data
|
| 62 | 62 | from gajim.common.modules.base import BaseModule
|
| 63 | 63 | from gajim.common.modules.contacts import GroupchatContact
|
| 64 | +from gajim.common.modules.contacts import GroupchatParticipant
|
|
| 64 | 65 | |
| 65 | 66 | log = logging.getLogger('gajim.c.m.muc')
|
| 66 | 67 | |
| ... | ... | @@ -587,7 +588,9 @@ def _on_muc_user_presence(self, |
| 587 | 588 | self._joined_users[room.jid][nickname] = occupant.presence
|
| 588 | 589 | |
| 589 | 590 | presence = self._process_user_presence(properties)
|
| 590 | - occupant.update_presence(presence, properties)
|
|
| 591 | + self._process_occupant_presence_change(properties,
|
|
| 592 | + presence,
|
|
| 593 | + occupant)
|
|
| 591 | 594 | |
| 592 | 595 | room.notify('user-nickname-changed',
|
| 593 | 596 | occupant,
|
| ... | ... | @@ -613,7 +616,9 @@ def _on_muc_user_presence(self, |
| 613 | 616 | self._start_join_timeout(room_jid)
|
| 614 | 617 | |
| 615 | 618 | presence = self._process_user_presence(properties)
|
| 616 | - occupant.update_presence(presence, properties)
|
|
| 619 | + self._process_occupant_presence_change(properties,
|
|
| 620 | + presence,
|
|
| 621 | + occupant)
|
|
| 617 | 622 | return
|
| 618 | 623 | |
| 619 | 624 | if properties.is_muc_self_presence and properties.is_kicked:
|
| ... | ... | @@ -639,7 +644,38 @@ def _on_muc_user_presence(self, |
| 639 | 644 | log.warning(stanza)
|
| 640 | 645 | return
|
| 641 | 646 | |
| 642 | - occupant.update_presence(presence, properties)
|
|
| 647 | + self._process_occupant_presence_change(properties, presence, occupant)
|
|
| 648 | + |
|
| 649 | + def _process_occupant_presence_change(
|
|
| 650 | + self,
|
|
| 651 | + properties: PresenceProperties,
|
|
| 652 | + presence: MUCPresenceData,
|
|
| 653 | + occupant: GroupchatParticipant) -> None:
|
|
| 654 | + |
|
| 655 | + if not occupant.is_available and presence.available:
|
|
| 656 | + occupant.update_presence(presence)
|
|
| 657 | + occupant.notify('user-joined', properties)
|
|
| 658 | + return
|
|
| 659 | + |
|
| 660 | + if not presence.available:
|
|
| 661 | + occupant.update_presence(presence)
|
|
| 662 | + occupant.notify('user-left', properties)
|
|
| 663 | + return
|
|
| 664 | + |
|
| 665 | + signals: list[str] = []
|
|
| 666 | + if occupant.affiliation != presence.affiliation:
|
|
| 667 | + signals.append('user-affiliation-changed')
|
|
| 668 | + |
|
| 669 | + if occupant.role != presence.role:
|
|
| 670 | + signals.append('user-role-changed')
|
|
| 671 | + |
|
| 672 | + if (occupant.status != presence.status or
|
|
| 673 | + occupant.show != presence.show):
|
|
| 674 | + signals.append('user-status-show-changed')
|
|
| 675 | + |
|
| 676 | + occupant.update_presence(presence)
|
|
| 677 | + for signal in signals:
|
|
| 678 | + occupant.notify(signal, properties)
|
|
| 643 | 679 | |
| 644 | 680 | def _process_user_presence(self,
|
| 645 | 681 | properties: PresenceProperties
|
| ... | ... | @@ -21,6 +21,7 @@ |
| 21 | 21 | import os
|
| 22 | 22 | import sys
|
| 23 | 23 | import signal
|
| 24 | +import sqlite3
|
|
| 24 | 25 | import platform
|
| 25 | 26 | from ctypes import CDLL, byref, create_string_buffer
|
| 26 | 27 | from ctypes.util import find_library
|
| ... | ... | @@ -36,6 +37,7 @@ |
| 36 | 37 | _MIN_PYGOBJECT_VER = '3.32.0'
|
| 37 | 38 | _MIN_GLIB_VER = '2.60.0'
|
| 38 | 39 | _MIN_PANGO_VER = '1.50.0'
|
| 40 | +_MIN_SQLITE_VER = '3.33.0'
|
|
| 39 | 41 | |
| 40 | 42 | |
| 41 | 43 | def check_version(dep_name: str, current_ver: str, min_ver: str) -> None:
|
| ... | ... | @@ -92,6 +94,7 @@ def _check_required_deps() -> None: |
| 92 | 94 | check_version('gtk3', gtk_ver, _MIN_GTK_VER)
|
| 93 | 95 | check_version('glib', glib_ver, _MIN_GLIB_VER)
|
| 94 | 96 | check_version('pango', Pango.version_string(), _MIN_PANGO_VER)
|
| 97 | + check_version('sqlite', sqlite3.sqlite_version, _MIN_SQLITE_VER)
|
|
| 95 | 98 | |
| 96 | 99 | |
| 97 | 100 | def _init_gui(gui: str) -> None:
|