Philipp Hörist pushed to branch master at gajim / gajim
Commits:
e8004084 by Philipp Hörist at 2017-11-12T23:53:03+01:00
Use Gio.NetworkMonitor for reconnecting
- This uses also NetworkManager, but also other more low level interfaces
on linux
- This should work cross-platform
- Leave network_watcher.py for now, because it shows how
to use the Gtk dbus interface
- - - - -
f7bb9c8a by Philipp Hörist at 2017-11-18T22:09:35+01:00
Merge branch 'networkmonitor' into 'master'
Use Gio.NetworkMonitor for reconnecting
See merge request gajim/gajim!149
- - - - -
2 changed files:
- gajim/features_window.py
- gajim/gui_interface.py
Changes:
=====================================
gajim/features_window.py
=====================================
--- a/gajim/features_window.py
+++ b/gajim/features_window.py
@@ -57,10 +57,6 @@ class FeaturesWindow:
_('Ability to encrypting chat messages with OpenPGP.'),
_('Requires gpg and python-gnupg (http://code.google.com/p/python-gnupg/).'),
_('Requires gpg.exe in PATH.')),
- _('Network-Watcher'): (self.network_watcher_available,
- _('Autodetection of network status.'),
- _('Requires gnome-network-manager'),
- _('Feature not available under Windows.')),
_('Password encryption'): (self.some_keyring_available,
_('Passwords can be stored securely and not just in plaintext.'),
_('Requires libsecret and a provider (such as GNOME Keyring and KSecretService).'),
@@ -157,10 +153,6 @@ class FeaturesWindow:
def gpg_available(self):
return app.HAVE_GPG
- def network_watcher_available(self):
- from gajim import network_watcher
- return network_watcher.supported
-
def some_keyring_available(self):
if os.name == 'nt':
return True
=====================================
gajim/gui_interface.py
=====================================
--- a/gajim/gui_interface.py
+++ b/gajim/gui_interface.py
@@ -44,6 +44,7 @@ import hashlib
from gi.repository import Gtk
from gi.repository import GdkPixbuf
from gi.repository import GLib
+from gi.repository import Gio
try:
from PIL import Image
@@ -2558,6 +2559,23 @@ class Interface:
view.updateNamespace({'gajim': app})
app.ipython_window = window
+ def network_status_changed(self, monitor, connected):
+ if connected == self.network_state:
+ # This callback gets called a lot from GTK with the
+ # same state, not only on change.
+ return
+ self.network_state = connected
+ if connected:
+ for connection in app.connections.values():
+ if connection.connected <= 0:
+ log.info('Connect %s', connection.name)
+ connection.reconnect()
+ else:
+ for connection in app.connections.values():
+ if connection.connected > 1:
+ log.info('Disconnect %s', connection.name)
+ connection.disconnectedReconnCB()
+
def run(self, application):
if app.config.get('trayicon') != 'never':
self.show_systray()
@@ -2779,8 +2797,6 @@ class Interface:
self.remote_ctrl = None
- from gajim import network_watcher
-
if dbus_support.supported:
from gajim import upower_listener
from gajim import logind_listener
@@ -2882,6 +2898,11 @@ class Interface:
self.music_track_changed_signal = None
+ self.network_monitor = Gio.NetworkMonitor.get_default()
+ self.network_monitor.connect('network-changed',
+ self.network_status_changed)
+ self.network_state = self.network_monitor.get_network_available()
+
class PassphraseRequest:
def __init__(self, keyid):
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/639f0db1646ae5515f29996b8c7387b62…
---
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/639f0db1646ae5515f29996b8c7387b62…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
86f5953e by Annika Sommer at 2017-11-18T18:10:10+01:00
MUC: Improve error messages
Distinguish between 'item-not-found' and 'remote-server-not-found'
Fixes #8749
- - - - -
54f4c36f by Philipp Hörist at 2017-11-18T18:18:41+01:00
Merge branch 'master' into 'master'
Fix #8749: Misleading error message when joining a room
Closes #8749
See merge request gajim/gajim!150
- - - - -
1 changed file:
- gajim/gui_interface.py
Changes:
=====================================
gajim/gui_interface.py
=====================================
--- a/gajim/gui_interface.py
+++ b/gajim/gui_interface.py
@@ -326,8 +326,13 @@ class Interface:
obj.room_jid)
elif (obj.errcode == '404') or (obj.errcon in ('item-not-found',
'remote-server-not-found')):
+ # remote server does not exist
+ if (obj.errcon == 'remote-server-not-found'):
+ self.handle_gc_error(gc_control, _('Unable to join group chat'),
+ _('Remote server <b>%s</b> does not exist.') % obj.room_jid)
# group chat does not exist
- self.handle_gc_error(gc_control, _('Unable to join group chat'),
+ else:
+ self.handle_gc_error(gc_control, _('Unable to join group chat'),
_('Group chat <b>%s</b> does not exist.') % obj.room_jid)
elif (obj.errcode == '405') or (obj.errcon == 'not-allowed'):
self.handle_gc_error(gc_control, _('Unable to join group chat'),
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/c1c2a92efccbc89e625e27ff5129bb498…
---
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/c1c2a92efccbc89e625e27ff5129bb498…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
c1c2a92e by Philipp Hörist at 2017-11-18T11:11:47+01:00
Init Plugins and Caps after Roster
- Some plugins do not depend on gui extension points and need the
roster to be initialized
- - - - -
1 changed file:
- gajim/gui_interface.py
Changes:
=====================================
gajim/gui_interface.py
=====================================
--- a/gajim/gui_interface.py
+++ b/gajim/gui_interface.py
@@ -2562,6 +2562,20 @@ class Interface:
MessageWindowMgr.ONE_MSG_WINDOW_ALWAYS_WITH_ROSTER:
self.msg_win_mgr.create_window(None, None, None)
+ # Creating plugin manager
+ from gajim import plugins
+ app.plugin_manager = plugins.PluginManager()
+ app.plugin_manager.init_plugins()
+
+ helpers.update_optional_features()
+ # prepopulate data which we are sure of; note: we do not log these info
+ for account in app.connections:
+ gajimcaps = caps_cache.capscache[
+ ('sha-1', app.caps_hash[account])]
+ gajimcaps.identities = [app.gajim_identity]
+ gajimcaps.features = app.gajim_common_features + \
+ app.gajim_optional_features[account]
+
self.roster._before_fill()
for account in app.connections:
app.connections[account].load_roster_from_db()
@@ -2758,20 +2772,6 @@ class Interface:
app.gajim_optional_features[a] = []
app.caps_hash[a] = ''
- # Creating plugin manager
- from gajim import plugins
- app.plugin_manager = plugins.PluginManager()
- app.plugin_manager.init_plugins()
-
- helpers.update_optional_features()
- # prepopulate data which we are sure of; note: we do not log these info
- for account in app.connections:
- gajimcaps = caps_cache.capscache[('sha-1',
- app.caps_hash[account])]
- gajimcaps.identities = [app.gajim_identity]
- gajimcaps.features = app.gajim_common_features + \
- app.gajim_optional_features[account]
-
self.remote_ctrl = None
from gajim import network_watcher
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/c1c2a92efccbc89e625e27ff5129bb4984…
---
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/c1c2a92efccbc89e625e27ff5129bb4984…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
0fe78daa by Philipp Hörist at 2017-11-15T21:57:15+01:00
Init PluginManger earlier
- Plugins need the possibility to add caps before Gajim updates them
- - - - -
775fec2f by Philipp Hörist at 2017-11-15T22:26:55+01:00
Dont activate plugins in PluginManager init
Plugins maybe want to use in their activation Gajim methods that
use an extension point. But because the PluginManager Object is not fully
initialized, the extension point method is not available yet
First create the PluginManager Object, then load Plugins.
- - - - -
d5ddbe37 by Philipp Hörist at 2017-11-15T22:28:11+01:00
Add extension point for plugins to add their caps
- - - - -
9f0154ef by Philipp Hörist at 2017-11-15T22:28:57+01:00
Add caps to first presence
According to the XEP, caps hash has to be added to all presences
- - - - -
4 changed files:
- gajim/common/connection_handlers.py
- gajim/common/helpers.py
- gajim/gui_interface.py
- gajim/plugins/pluginmanager.py
Changes:
=====================================
gajim/common/connection_handlers.py
=====================================
--- a/gajim/common/connection_handlers.py
+++ b/gajim/common/connection_handlers.py
@@ -2039,6 +2039,7 @@ ConnectionHandlersBase, ConnectionJingle, ConnectionIBBytestream):
p.setStatus(msg)
if signed:
p.setTag(nbxmpp.NS_SIGNED + ' x').setData(signed)
+ p = self.add_sha(p)
if self.connection:
self.connection.send(p)
=====================================
gajim/common/helpers.py
=====================================
--- a/gajim/common/helpers.py
+++ b/gajim/common/helpers.py
@@ -1354,6 +1354,10 @@ def update_optional_features(account = None):
app.gajim_optional_features[a].append(nbxmpp.NS_JINGLE_XTLS)
app.gajim_optional_features[a].append(nbxmpp.NS_JINGLE_BYTESTREAM)
app.gajim_optional_features[a].append(nbxmpp.NS_JINGLE_IBB)
+
+ # Give plugins the possibility to add their features
+ app.plugin_manager.extension_point('update_caps', a)
+
app.caps_hash[a] = caps_cache.compute_caps_hash([app.gajim_identity],
app.gajim_common_features + app.gajim_optional_features[a])
# re-send presence with new hash
=====================================
gajim/gui_interface.py
=====================================
--- a/gajim/gui_interface.py
+++ b/gajim/gui_interface.py
@@ -2562,10 +2562,6 @@ class Interface:
MessageWindowMgr.ONE_MSG_WINDOW_ALWAYS_WITH_ROSTER:
self.msg_win_mgr.create_window(None, None, None)
- # Creating plugin manager
- from gajim import plugins
- app.plugin_manager = plugins.PluginManager()
-
self.roster._before_fill()
for account in app.connections:
app.connections[account].load_roster_from_db()
@@ -2762,6 +2758,11 @@ class Interface:
app.gajim_optional_features[a] = []
app.caps_hash[a] = ''
+ # Creating plugin manager
+ from gajim import plugins
+ app.plugin_manager = plugins.PluginManager()
+ app.plugin_manager.init_plugins()
+
helpers.update_optional_features()
# prepopulate data which we are sure of; note: we do not log these info
for account in app.connections:
=====================================
gajim/plugins/pluginmanager.py
=====================================
--- a/gajim/plugins/pluginmanager.py
+++ b/gajim/plugins/pluginmanager.py
@@ -110,7 +110,6 @@ class PluginManager(metaclass=Singleton):
for path in [app.PLUGINS_DIRS[1], app.PLUGINS_DIRS[0]]:
pc = PluginManager.scan_dir_for_plugins(path)
self.add_plugins(pc)
- self._activate_all_plugins_from_global_config()
@log_calls('PluginManager')
def _plugin_has_entry_in_global_config(self, plugin):
@@ -127,6 +126,10 @@ class PluginManager(metaclass=Singleton):
app.config.del_per('plugins', plugin.short_name)
@log_calls('PluginManager')
+ def init_plugins(self):
+ self._activate_all_plugins_from_global_config()
+
+ @log_calls('PluginManager')
def add_plugin(self, plugin_class):
'''
:todo: what about adding plug-ins that are already added? Module reload
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/5236693df9f5855888411bcaaed41b01f…
---
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/5236693df9f5855888411bcaaed41b01f…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
5236693d by Philipp Hörist at 2017-11-11T21:46:00+01:00
Parse stanza-id in groupchat correctly
- - - - -
1 changed file:
- gajim/common/connection_handlers_events.py
Changes:
=====================================
gajim/common/connection_handlers_events.py
=====================================
--- a/gajim/common/connection_handlers_events.py
+++ b/gajim/common/connection_handlers_events.py
@@ -148,10 +148,14 @@ class HelperEvent:
if by is None:
# We can not verify who set this stanza-id, ignore it.
return
- elif not self.conn.get_own_jid().bareMatch(by):
- # by attribute does not match the server, ignore it.
- return
- return stanza_id
+ if stanza.getType() == 'groupchat':
+ if stanza.getFrom().bareMatch(by):
+ # by attribute must match the server
+ return stanza_id
+ elif self.conn.get_own_jid().bareMatch(by):
+ # by attribute must match the server
+ return stanza_id
+ return
@staticmethod
def get_forwarded_message(stanza):
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/5236693df9f5855888411bcaaed41b01f3…
---
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/5236693df9f5855888411bcaaed41b01f3…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
309e844b by Philipp Hörist at 2017-11-11T17:10:31+01:00
Escape account label in roster and menus
- - - - -
2 changed files:
- gajim/gui_menu_builder.py
- gajim/roster_window.py
Changes:
=====================================
gajim/gui_menu_builder.py
=====================================
--- a/gajim/gui_menu_builder.py
+++ b/gajim/gui_menu_builder.py
@@ -780,7 +780,8 @@ def build_accounts_menu():
return
if len(accounts_list) > 1:
for acc in accounts_list:
- label = app.config.get_per('accounts', acc, 'account_label')
+ label = escape_mnemonic(
+ app.config.get_per('accounts', acc, 'account_label'))
acc_menu.append_submenu(
label or acc, get_account_menu(acc))
else:
@@ -806,8 +807,8 @@ def build_bookmark_menu(account):
if acc_menu.get_item_link(0, 'submenu'):
for i in range(acc_menu.get_n_items()):
label = acc_menu.get_item_attribute_value(i, 'label')
- account_label = app.config.get_per('accounts', account,
- 'account_label')
+ account_label = escape_mnemonic(
+ app.config.get_per('accounts', account, 'account_label'))
if label.get_string() in (account_label, account):
menu = acc_menu.get_item_link(i, 'submenu')
else:
@@ -835,3 +836,11 @@ def get_encryption_menu(control_id, type_id):
if menu.get_n_items() == 1:
return None
return menu
+
+
+def escape_mnemonic(label):
+ if label is None:
+ return
+ # Underscore inside a label means the next letter is a keyboard
+ # shortcut. To show an underscore we have to use double underscore
+ return label.replace('_', '__')
=====================================
gajim/roster_window.py
=====================================
--- a/gajim/roster_window.py
+++ b/gajim/roster_window.py
@@ -1069,7 +1069,7 @@ class RosterWindow:
accounts = accounts)
account_name += ' (%s/%s)' % (repr(nbr_on), repr(nbr_total))
- self.model[child_iter][Column.NAME] = account_name
+ self.model[child_iter][Column.NAME] = GLib.markup_escape_text(account_name)
pep_dict = app.connections[account].pep
if app.config.get('show_mood_in_roster') and 'mood' in pep_dict:
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/309e844b4ee853c1dbb17108e517ff38e9…
---
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/309e844b4ee853c1dbb17108e517ff38e9…
You're receiving this email because of your account on dev.gajim.org.