Commit 2492c88b authored by Daniel Brötzmann's avatar Daniel Brötzmann

Rename setting and simplify condition for PM sending

parent 1f06a850
Pipeline #4132 passed with stages
in 2 minutes and 47 seconds
......@@ -110,7 +110,7 @@ class Config:
'sort_by_show_in_muc': [opt_bool, False, '', True],
'use_speller': [opt_bool, False, ],
'ignore_incoming_xhtml': [opt_bool, False, ],
'non_anonymous_muc_pm': [opt_bool, True, _('If enabled, Gajim tries to send private messages directly to the XMPP address of the participant instead of relaying them via group chat. This applies to private group chats only.')],
'muc_prefer_direct_msg': [opt_bool, True, _('If enabled, Gajim tries to send private messages directly to the XMPP address of the participant instead of relaying them via group chat. This applies to private group chats only.')],
'speller_language': [opt_str, '', _('Language used for spell checking.')],
'print_time': [opt_str, 'always', _('\'always\' - print time for every message.\n\'sometimes\' - print time every print_ichat_every_foo_minutes minute.\n\'never\' - never print time.')],
'print_time_fuzzy': [opt_int, 0, _('Print time in chats using Fuzzy Clock. Value of fuzziness from 1 to 4, or 0 to disable Fuzzy Clock. 1 is the most precise clock, 4 the least precise one. This is used only if \'print_time\' is \'sometimes\'.')],
......
......@@ -833,7 +833,7 @@
</packing>
</child>
<child>
<object class="GtkCheckButton" id="non_anonymous_muc_pm_checkbutton">
<object class="GtkCheckButton" id="muc_prefer_direct_msg_checkbutton">
<property name="label" translatable="yes">Message participants directly in private group chats</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
......@@ -841,7 +841,7 @@
<property name="tooltip_text" translatable="yes">If enabled, Gajim tries to send private messages directly to the XMPP address of the participant instead of relaying them via group chat. This applies to private group chats only.</property>
<property name="halign">start</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="_on_non_anonymous_muc_pm_toggled" swapped="no"/>
<signal name="toggled" handler="_on_muc_prefer_direct_msg_toggled" swapped="no"/>
</object>
<packing>
<property name="left_attach">0</property>
......
......@@ -2659,10 +2659,11 @@ class GroupchatControl(ChatControlBase):
gc_c = app.contacts.get_gc_contact(self.account, self.room_jid, nick)
nick_jid = gc_c.get_full_jid()
non_anonymous_muc_pm = app.config.get('non_anonymous_muc_pm')
queue = len(app.events.get_events(
self.account, jid=nick_jid, types=['pm']))
if not self.is_anonymous and non_anonymous_muc_pm and not queue:
muc_prefer_direct_msg = app.config.get(
'muc_prefer_direct_msg')
queue = app.events.get_events(
self.account, jid=nick_jid, types=['pm'])
if not self.is_anonymous and muc_prefer_direct_msg and not queue:
jid = app.get_jid_without_resource(gc_c.jid)
contact = app.contacts.get_contact(self.account, jid)
ctrl = app.interface.msg_win_mgr.get_control(jid, self.account)
......
......@@ -172,8 +172,8 @@ class Preferences(Gtk.ApplicationWindow):
st = app.config.get('print_status_muc_default')
self._ui.status_change_checkbutton.set_active(st)
st = app.config.get('non_anonymous_muc_pm')
self._ui.non_anonymous_muc_pm_checkbutton.set_active(st)
st = app.config.get('muc_prefer_direct_msg')
self._ui.muc_prefer_direct_msg_checkbutton.set_active(st)
# Displayed chat state notifications
st = app.config.get('show_chatstate_in_tabs')
......@@ -600,8 +600,8 @@ class Preferences(Gtk.ApplicationWindow):
for control in self._get_all_muc_controls():
control.update_actions()
def _on_non_anonymous_muc_pm_toggled(self, widget):
self.on_checkbutton_toggled(widget, 'non_anonymous_muc_pm')
def _on_muc_prefer_direct_msg_toggled(self, widget):
self.on_checkbutton_toggled(widget, 'muc_prefer_direct_msg')
def on_show_chatstate_in_tabs_toggled(self, widget):
self.on_checkbutton_toggled(widget, 'show_chatstate_in_tabs')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment