Skip to content
Snippets Groups Projects
Commit c0980b92 authored by Daniel Brötzmann's avatar Daniel Brötzmann Committed by Philipp Hörist
Browse files

Don’t send PM if group chat is not anonymous

parent 39bdea7b
No related branches found
No related tags found
No related merge requests found
......@@ -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,
......
......@@ -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
......
......@@ -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,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment