Philipp Hörist pushed to branch master at gajim / gajim
Commits: 7cf3fbd3 by Philipp Hörist at 2022-09-05T22:37:23+02:00 refactor: Remove dead code
- - - - - 2b123a75 by Philipp Hörist at 2022-09-05T22:42:42+02:00 cfix: Don’t expose hide_groupchat_occupants_list in advanced settings
This is an internal setting that holds the toggle state of the groupchat roster
- - - - -
5 changed files:
- gajim/common/const.py - gajim/common/modules/muc.py - gajim/common/modules/presence.py - gajim/common/setting_values.py - gajim/common/storage/archive.py
Changes:
===================================== gajim/common/const.py ===================================== @@ -113,16 +113,6 @@ def __str__(self): return str(self.value)
-@unique -class ShowConstant(IntEnum): - ONLINE = 0 - CHAT = 1 - AWAY = 2 - XA = 3 - DND = 4 - OFFLINE = 5 - - @unique class TypeConstant(IntEnum): AIM = 0
===================================== gajim/common/modules/muc.py ===================================== @@ -26,7 +26,6 @@
import nbxmpp from nbxmpp.const import InviteType -from nbxmpp.const import PresenceType from nbxmpp.const import StatusCode from nbxmpp.errors import StanzaError from nbxmpp.modules.dataforms import SimpleDataForm @@ -48,13 +47,12 @@ from gajim.common import events from gajim.common import helpers from gajim.common import types -from gajim.common.const import ClientState, KindConstant +from gajim.common.const import ClientState from gajim.common.const import MUCJoinedState from gajim.common.events import MessageModerated from gajim.common.events import MucAdded from gajim.common.events import MucDecline from gajim.common.events import MucInvitation -from gajim.common.helpers import AdditionalDataDict from gajim.common.helpers import get_default_muc_config from gajim.common.helpers import get_group_chat_nick from gajim.common.structs import MUCData @@ -814,42 +812,6 @@ def _remove_join_timeout(self, room_jid: str) -> None: GLib.source_remove(id_) del self._join_timeouts[room_jid]
- def _log_muc_event(self, - event_name: str, - properties: PresenceProperties - ) -> None: - # TODO CURRENTLY NOT USED - if event_name not in ['muc-user-joined', - 'muc-user-left', - 'muc-user-status-show-changed']: - return - - if not app.settings.get('log_contact_status_changes'): - return - - additional_data = AdditionalDataDict() - if properties.muc_user is not None: - if properties.muc_user.jid is not None: - additional_data.set_value( - 'gajim', 'real_jid', str(properties.muc_user.jid)) - - # TODO: Refactor - if properties.type == PresenceType.UNAVAILABLE: - show = 'offline' - else: - show = properties.show.value - show = app.storage.archive.convert_show_values_to_db_api_values(show) - - app.storage.archive.insert_into_logs( - self._account, - properties.jid.bare, - properties.timestamp, - KindConstant.GCSTATUS, - contact_name=properties.muc_nickname, - message=properties.status or None, - show=show, - additional_data=additional_data) - def _on_subject_change(self, _con: types.xmppClient, _stanza: Message,
===================================== gajim/common/modules/presence.py ===================================== @@ -38,8 +38,6 @@ from gajim.common.events import UnsubscribedPresenceReceived from gajim.common.i18n import _ from gajim.common.structs import PresenceData -from gajim.common.const import KindConstant -from gajim.common.const import ShowConstant from gajim.common.modules.base import BaseModule
@@ -156,23 +154,6 @@ def _presence_received(self,
app.ged.raise_event(PresenceReceived(**event_attrs))
- self._log_presence(properties) - - def _log_presence(self, properties: PresenceProperties) -> None: - if not app.settings.get('log_contact_status_changes'): - return - - show = ShowConstant[properties.show.name] - if properties.type.is_unavailable: - show = ShowConstant.OFFLINE - - app.storage.archive.insert_into_logs(self._account, - properties.jid.bare, - time.time(), - KindConstant.STATUS, - message=properties.status, - show=show) - def _subscribe_received(self, _con: types.xmppClient, _stanza: nbxmpp.protocol.Presence,
===================================== gajim/common/setting_values.py ===================================== @@ -63,7 +63,6 @@ class _ACCOUNT_DEFAULT: 'hide_groupchat_occupants_list', 'ignore_incoming_attention', 'is_window_visible', - 'log_contact_status_changes', 'muc_prefer_direct_msg', 'notification_preview_message', 'notify_on_all_muc_messages', @@ -221,7 +220,6 @@ class _ACCOUNT_DEFAULT: 'last_sounds_dir': '', 'last_update_check': '', 'latest_disco_addresses': '', - 'log_contact_status_changes': False, 'mainwin_height': 500, 'mainwin_width': 1000, 'mainwin_x_position': 0, @@ -676,12 +674,9 @@ class WorkspaceSettings(TypedDict): 'groupchat_roster_width': _('Width of group chat roster in pixel'), 'hide_chat_banner': _('Hides the banner in a 1:1 chat window.'), 'hide_groupchat_banner': _('Hides the banner in a group chat window.'), - 'hide_groupchat_occupants_list': _( - 'Hides the group chat participants list in a group chat window.'), 'ignore_incoming_attention': _( 'If enabled, Gajim will ignore incoming attention ' 'requests ("wizz").'), - 'log_contact_status_changes': '', 'muc_highlight_words': _( 'A list of words (semicolon separated) that will be ' 'highlighted in group chats.'),
===================================== gajim/common/storage/archive.py ===================================== @@ -43,7 +43,6 @@ from gajim.common import configpaths from gajim.common.helpers import AdditionalDataDict from gajim.common.const import MAX_MESSAGE_CORRECTION_DELAY -from gajim.common.const import ShowConstant from gajim.common.const import KindConstant from gajim.common.const import JIDConstant
@@ -340,31 +339,6 @@ def get_jid_id(self, self._delayed_commit() return lastrowid
- @staticmethod - def convert_show_values_to_db_api_values(show: Optional[str] - ) -> Optional[ShowConstant]: - ''' - Convert from string style to constant ints for db - ''' - - if show == 'online': - return ShowConstant.ONLINE - if show == 'chat': - return ShowConstant.CHAT - if show == 'away': - return ShowConstant.AWAY - if show == 'xa': - return ShowConstant.XA - if show == 'dnd': - return ShowConstant.DND - if show == 'offline': - return ShowConstant.OFFLINE - if show is None: - return ShowConstant.ONLINE - # invisible in GC when someone goes invisible - # it's a RFC violation .... but we should not crash - return None - @timeit def get_conversation_before_after(self, account: str,
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/compare/b380d4c5ab1033f0b9e15eb150d237b0...