Philipp Hörist pushed to branch gajim_1.3 at gajim / gajim
Commits:
-
1b55c3fa
by lovetox at 2021-01-09T11:53:10+01:00
-
6394776f
by lovetox at 2021-01-09T11:57:43+01:00
-
fe7cdb53
by lovetox at 2021-01-09T17:24:37+01:00
-
d0f6a26f
by lovetox at 2021-01-09T17:24:38+01:00
-
0f4dd5c6
by Daniel Brötzmann at 2021-01-09T17:24:38+01:00
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:
| ... | ... | @@ -16,7 +16,6 @@ |
| 16 | 16 |
|
| 17 | 17 |
|
| 18 | 18 |
from nbxmpp.errors import is_error
|
| 19 |
-from nbxmpp.modules.util import raise_if_error
|
|
| 20 | 19 |
|
| 21 | 20 |
from gajim.common.modules.base import BaseModule
|
| 22 | 21 |
from gajim.common.modules.util import as_task
|
| ... | ... | @@ -42,7 +41,10 @@ def get_roster_delimiter(self): |
| 42 | 41 |
delimiter = yield self.request_delimiter()
|
| 43 | 42 |
if is_error(delimiter) or delimiter is None:
|
| 44 | 43 |
result = yield self.set_delimiter(self.delimiter)
|
| 45 |
- raise_if_error(result)
|
|
| 44 |
+ if is_error(result):
|
|
| 45 |
+ self._con.connect_machine()
|
|
| 46 |
+ return
|
|
| 47 |
+ |
|
| 46 | 48 |
delimiter = self.delimiter
|
| 47 | 49 |
|
| 48 | 50 |
self.delimiter = delimiter
|
| ... | ... | @@ -115,6 +115,7 @@ class _ACCOUNT_DEFAULT: |
| 115 | 115 |
'notification_position_x': -1,
|
| 116 | 116 |
'notification_position_y': -1,
|
| 117 | 117 |
'muc_highlight_words': '',
|
| 118 |
+ 'muc_prefer_direct_msg': True,
|
|
| 118 | 119 |
'quit_on_roster_x_button': False,
|
| 119 | 120 |
'hide_on_roster_x_button': False,
|
| 120 | 121 |
'show_status_msgs_in_roster': True,
|
| ... | ... | @@ -1902,11 +1902,14 @@ def _start_private_message(self, nick): |
| 1902 | 1902 |
gc_c = app.contacts.get_gc_contact(self.account, self.room_jid, nick)
|
| 1903 | 1903 |
nick_jid = gc_c.get_full_jid()
|
| 1904 | 1904 |
|
| 1905 |
- ctrl = app.interface.msg_win_mgr.get_control(nick_jid, self.account)
|
|
| 1906 |
- if not ctrl:
|
|
| 1905 |
+ muc_prefer_direct_msg = app.settings.get('muc_prefer_direct_msg')
|
|
| 1906 |
+ pm_queue = len(app.events.get_events(
|
|
| 1907 |
+ self.account, jid=nick_jid, types=['pm']))
|
|
| 1908 |
+ if not self.is_anonymous and muc_prefer_direct_msg and not pm_queue:
|
|
| 1909 |
+ jid = app.get_jid_without_resource(gc_c.jid)
|
|
| 1910 |
+ ctrl = app.interface.new_chat_from_jid(self.account, jid)
|
|
| 1911 |
+ else:
|
|
| 1907 | 1912 |
ctrl = app.interface.new_private_chat(gc_c, self.account)
|
| 1908 |
- |
|
| 1909 |
- if ctrl:
|
|
| 1910 | 1913 |
ctrl.parent_win.set_active_tab(ctrl)
|
| 1911 | 1914 |
|
| 1912 | 1915 |
return ctrl
|
| ... | ... | @@ -420,6 +420,12 @@ def __init__(self, *args): |
| 420 | 420 |
desc=_('Default for new public group chats'),
|
| 421 | 421 |
props={'entries': THRESHOLD_OPTIONS}),
|
| 422 | 422 |
|
| 423 |
+ Setting(SettingKind.SWITCH,
|
|
| 424 |
+ _('Direct Messages'),
|
|
| 425 |
+ SettingType.CONFIG,
|
|
| 426 |
+ 'muc_prefer_direct_msg',
|
|
| 427 |
+ desc=_('Prefer direct messages in private group chats ')),
|
|
| 428 |
+ |
|
| 423 | 429 |
Setting(SettingKind.SWITCH,
|
| 424 | 430 |
_('Show Joined / Left'),
|
| 425 | 431 |
SettingType.CONFIG,
|
| ... | ... | @@ -554,9 +554,6 @@ def get_account_mood_icon_name(account): |
| 554 | 554 |
|
| 555 | 555 |
|
| 556 | 556 |
def format_activity(activity, subactivity, text):
|
| 557 |
- if activity is None:
|
|
| 558 |
- return None
|
|
| 559 |
- |
|
| 560 | 557 |
if subactivity in ACTIVITIES[activity]:
|
| 561 | 558 |
subactivity = ACTIVITIES[activity][subactivity]
|
| 562 | 559 |
activity = ACTIVITIES[activity]['category']
|
| ... | ... | @@ -586,8 +583,6 @@ def get_account_activity_icon_name(account): |
| 586 | 583 |
|
| 587 | 584 |
|
| 588 | 585 |
def format_tune(artist, _length, _rating, source, title, _track, _uri):
|
| 589 |
- if artist is None and title is None and source is None:
|
|
| 590 |
- return None
|
|
| 591 | 586 |
artist = GLib.markup_escape_text(artist or _('Unknown Artist'))
|
| 592 | 587 |
title = GLib.markup_escape_text(title or _('Unknown Title'))
|
| 593 | 588 |
source = GLib.markup_escape_text(source or _('Unknown Source'))
|
| ... | ... | @@ -583,7 +583,7 @@ def __init__(self, prop, account): |
| 583 | 583 |
def _on_text_changed(self, entry, _param):
|
| 584 | 584 |
text = entry.get_text()
|
| 585 | 585 |
if self._prop.name == 'org':
|
| 586 |
- self._prop.values[0] = text
|
|
| 586 |
+ self._prop.values = [text]
|
|
| 587 | 587 |
else:
|
| 588 | 588 |
self._prop.value = text
|
| 589 | 589 |
self._value_label.set_value(text)
|
| 1 | 1 |
|
| 2 | 2 |
import sys
|
| 3 |
-import importlib
|
|
| 3 |
+from importlib.abc import MetaPathFinder
|
|
| 4 |
+from importlib.util import spec_from_file_location
|
|
| 4 | 5 |
from pathlib import Path
|
| 5 | 6 |
|
| 6 | 7 |
|
| 7 |
-class GUIFinder(importlib.abc.MetaPathFinder):
|
|
| 8 |
+class GUIFinder(MetaPathFinder):
|
|
| 8 | 9 |
|
| 9 | 10 |
def __init__(self, name, fallback=None):
|
| 10 | 11 |
self._path = Path(__file__).parent.parent / name
|
| ... | ... | @@ -22,7 +23,7 @@ def find_spec(self, fullname, _path, _target=None): |
| 22 | 23 |
if module_path is None:
|
| 23 | 24 |
return None
|
| 24 | 25 |
|
| 25 |
- spec = importlib.util.spec_from_file_location(fullname, module_path)
|
|
| 26 |
+ spec = spec_from_file_location(fullname, module_path)
|
|
| 26 | 27 |
|
| 27 | 28 |
return spec
|
| 28 | 29 |
|