Philipp Hörist pushed to branch master at gajim / gajim
Commits: c0980b92 by Daniel Brötzmann at 2020-12-29T23:19:26+01:00 Don’t send PM if group chat is not anonymous
- - - - -
3 changed files:
- gajim/common/setting_values.py - gajim/groupchat_control.py - gajim/gtk/preferences.py
Changes:
===================================== gajim/common/setting_values.py ===================================== @@ -116,6 +116,7 @@ class _ACCOUNT_DEFAULT: 'notification_position_x': -1, 'notification_position_y': -1, 'muc_highlight_words': '', + 'muc_prefer_direct_msg': True, 'quit_on_roster_x_button': False, 'hide_on_roster_x_button': False, 'show_status_msgs_in_roster': True,
===================================== gajim/groupchat_control.py ===================================== @@ -1902,11 +1902,14 @@ def _start_private_message(self, nick): gc_c = app.contacts.get_gc_contact(self.account, self.room_jid, nick) nick_jid = gc_c.get_full_jid()
- ctrl = app.interface.msg_win_mgr.get_control(nick_jid, self.account) - if not ctrl: + muc_prefer_direct_msg = app.settings.get('muc_prefer_direct_msg') + pm_queue = len(app.events.get_events( + self.account, jid=nick_jid, types=['pm'])) + if not self.is_anonymous and muc_prefer_direct_msg and not pm_queue: + jid = app.get_jid_without_resource(gc_c.jid) + ctrl = app.interface.new_chat_from_jid(self.account, jid) + else: ctrl = app.interface.new_private_chat(gc_c, self.account) - - if ctrl: ctrl.parent_win.set_active_tab(ctrl)
return ctrl
===================================== gajim/gtk/preferences.py ===================================== @@ -420,6 +420,12 @@ def __init__(self, *args): desc=_('Default for new public group chats'), props={'entries': THRESHOLD_OPTIONS}),
+ Setting(SettingKind.SWITCH, + _('Direct Messages'), + SettingType.CONFIG, + 'muc_prefer_direct_msg', + desc=_('Prefer direct messages in private group chats ')), + Setting(SettingKind.SWITCH, _('Show Joined / Left'), SettingType.CONFIG,
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/c0980b922f2cb16a5513d8e719f0f0038...