Philipp Hörist pushed to branch gajim_1.3 at gajim / gajim


Commits:
1b55c3fa by lovetox at 2021-01-09T11:53:10+01:00
Delimiter: Don’t stop connecting when private xml is not available

- - - - -
6394776f by lovetox at 2021-01-09T11:57:43+01:00
VCardGrid: Fix storing org property values

Fixes #10377

- - - - -
fe7cdb53 by lovetox at 2021-01-09T17:24:37+01:00
Don’t return None on format_*() calls

Fixes #10235

- - - - -
d0f6a26f by lovetox at 2021-01-09T17:24:38+01:00
Simplify imports

- - - - -
0f4dd5c6 by Daniel Brötzmann at 2021-01-09T17:24:38+01:00
Don’t send PM if group chat is not anonymous

- - - - -


7 changed files:

- gajim/common/modules/delimiter.py
- gajim/common/setting_values.py
- gajim/groupchat_control.py
- gajim/gtk/preferences.py
- gajim/gtk/util.py
- gajim/gtk/vcard_grid.py
- gajim/gui/__init__.py


Changes:

=====================================
gajim/common/modules/delimiter.py
=====================================
@@ -16,7 +16,6 @@
 
 
 from nbxmpp.errors import is_error
-from nbxmpp.modules.util import raise_if_error
 
 from gajim.common.modules.base import BaseModule
 from gajim.common.modules.util import as_task
@@ -42,7 +41,10 @@ def get_roster_delimiter(self):
         delimiter = yield self.request_delimiter()
         if is_error(delimiter) or delimiter is None:
             result = yield self.set_delimiter(self.delimiter)
-            raise_if_error(result)
+            if is_error(result):
+                self._con.connect_machine()
+                return
+
             delimiter = self.delimiter
 
         self.delimiter = delimiter


=====================================
gajim/common/setting_values.py
=====================================
@@ -115,6 +115,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,


=====================================
gajim/gtk/util.py
=====================================
@@ -554,9 +554,6 @@ def get_account_mood_icon_name(account):
 
 
 def format_activity(activity, subactivity, text):
-    if activity is None:
-        return None
-
     if subactivity in ACTIVITIES[activity]:
         subactivity = ACTIVITIES[activity][subactivity]
     activity = ACTIVITIES[activity]['category']
@@ -586,8 +583,6 @@ def get_account_activity_icon_name(account):
 
 
 def format_tune(artist, _length, _rating, source, title, _track, _uri):
-    if artist is None and title is None and source is None:
-        return None
     artist = GLib.markup_escape_text(artist or _('Unknown Artist'))
     title = GLib.markup_escape_text(title or _('Unknown Title'))
     source = GLib.markup_escape_text(source or _('Unknown Source'))


=====================================
gajim/gtk/vcard_grid.py
=====================================
@@ -583,7 +583,7 @@ def __init__(self, prop, account):
     def _on_text_changed(self, entry, _param):
         text = entry.get_text()
         if self._prop.name == 'org':
-            self._prop.values[0] = text
+            self._prop.values = [text]
         else:
             self._prop.value = text
         self._value_label.set_value(text)


=====================================
gajim/gui/__init__.py
=====================================
@@ -1,10 +1,11 @@
 
 import sys
-import importlib
+from importlib.abc import MetaPathFinder
+from importlib.util import spec_from_file_location
 from pathlib import Path
 
 
-class GUIFinder(importlib.abc.MetaPathFinder):
+class GUIFinder(MetaPathFinder):
 
     def __init__(self, name, fallback=None):
         self._path = Path(__file__).parent.parent / name
@@ -22,7 +23,7 @@ def find_spec(self, fullname, _path, _target=None):
         if module_path is None:
             return None
 
-        spec = importlib.util.spec_from_file_location(fullname, module_path)
+        spec = spec_from_file_location(fullname, module_path)
 
         return spec
 



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/compare/5540f00c5fe616182c8c90ba35e36c5ad7e0f044...0f4dd5c6e31dfcb465588fe2afe8b7bc316aeed1

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/compare/5540f00c5fe616182c8c90ba35e36c5ad7e0f044...0f4dd5c6e31dfcb465588fe2afe8b7bc316aeed1
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to