Philipp Hörist pushed to branch master at gajim / gajim
Commits:
56a5d016 by Philipp Hörist at 2018-04-29T23:34:46+02:00
Dont allow plain BOSH by default
- - - - -
1 changed file:
- gajim/common/connection.py
Changes:
=====================================
gajim/common/connection.py
=====================================
--- a/gajim/common/connection.py
+++ b/gajim/common/connection.py
@@ -1191,15 +1191,18 @@ class Connection(CommonConnection, ConnectionHandlers):
if scheme == 'https':
connection_types = ['ssl']
else:
- connection_types = ['plain']
+ if allow_plaintext_connection:
+ connection_types = ['plain']
+ else:
+ connection_types = []
host = self._select_next_host(self._hosts)
self._hosts.remove(host)
# Skip record if connection type is not supported.
if host['type'] not in connection_types:
- log.debug("Skipping connection record with unsupported type: %s" %
- host['type'])
+ log.info("Skipping connection record with unsupported type: %s",
+ host['type'])
self._connect_to_next_host(retry)
return
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/56a5d0160985d76999896cf7e4fc9f7220…
---
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/56a5d0160985d76999896cf7e4fc9f7220…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
b8554e3e by Philipp Hörist at 2018-04-29T23:30:08+02:00
Jingle: Check first if we have a content
Fixes #9094
- - - - -
1 changed file:
- gajim/common/jingle_session.py
Changes:
=====================================
gajim/common/jingle_session.py
=====================================
--- a/gajim/common/jingle_session.py
+++ b/gajim/common/jingle_session.py
@@ -523,6 +523,16 @@ class JingleSession:
# error.
# Lets check what kind of jingle session does the peer want
contents, contents_rejected, reason_txt = self.__parse_contents(jingle)
+
+ # If there's no content we understand...
+ if not contents:
+ # TODO: http://xmpp.org/extensions/xep-0166.html#session-terminate
+ reason = nbxmpp.Node('reason')
+ reason.setTag(reason_txt)
+ self.__ack(stanza, jingle, error, action)
+ self._session_terminate(reason)
+ raise nbxmpp.NodeProcessed
+
# If we are not receivin a file
# Check if there's already a session with this user:
if contents[0].media != 'file':
@@ -553,14 +563,7 @@ class JingleSession:
'it is not allowed to request', pjid)
self.decline_session()
raise nbxmpp.NodeProcessed
- # If there's no content we understand...
- if not contents:
- # TODO: http://xmpp.org/extensions/xep-0166.html#session-terminate
- reason = nbxmpp.Node('reason')
- reason.setTag(reason_txt)
- self.__ack(stanza, jingle, error, action)
- self._session_terminate(reason)
- raise nbxmpp.NodeProcessed
+
self.state = JingleStates.PENDING
# Send event about starting a session
app.nec.push_incoming_event(JingleRequestReceivedEvent(None,
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/b8554e3e223c8e48c900521faa30a3d483…
---
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/b8554e3e223c8e48c900521faa30a3d483…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / python-nbxmpp
Commits:
1ace62cd by Philipp Hörist at 2018-04-29T21:38:16+02:00
Fix missing argument
with HTTP Transports like BOSH we dont need ALPN, so it should always
be False
- - - - -
1 changed file:
- nbxmpp/transports_nb.py
Changes:
=====================================
nbxmpp/transports_nb.py
=====================================
--- a/nbxmpp/transports_nb.py
+++ b/nbxmpp/transports_nb.py
@@ -704,7 +704,7 @@ class NonBlockingHTTP(NonBlockingTCP):
:param http_dict: dictionary with data for HTTP request and headers
"""
NonBlockingTCP.__init__(self, raise_event, on_disconnect, idlequeue,
- estabilish_tls, certs, tls_version, cipher_list, proxy_dict)
+ estabilish_tls, certs, tls_version, cipher_list, False, proxy_dict)
self.http_protocol, self.http_host, self.http_port, self.http_path = \
urisplit(http_dict['http_uri'])
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/commit/1ace62cd0747e51c35e8059168…
---
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/commit/1ace62cd0747e51c35e8059168…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / python-nbxmpp
Commits:
83e1028b by Philipp Hörist at 2018-04-28T19:07:49+02:00
Catch UnicodeError when decoding certs
- - - - -
1 changed file:
- nbxmpp/tls_nb.py
Changes:
=====================================
nbxmpp/tls_nb.py
=====================================
--- a/nbxmpp/tls_nb.py
+++ b/nbxmpp/tls_nb.py
@@ -342,7 +342,7 @@ class NonBlockingTLS(PlugIn):
f = open(cert_path, encoding='utf-8')
else:
f = io.open(cert_path, encoding='utf-8')
- except IOError as e:
+ except (IOError, UnicodeError) as e:
log.warning('Unable to open certificate file %s: %s' % \
(cert_path, str(e)))
return
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/commit/83e1028b7693a7a2fe3076e3fa…
---
View it on GitLab: https://dev.gajim.org/gajim/python-nbxmpp/commit/83e1028b7693a7a2fe3076e3fa…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch gajim_1.0 at gajim / gajim
Commits:
dfd0e96f by Markus Wintermann at 2018-04-28T13:48:56+02:00
Add support for dynamic reloading of plugins
- - - - -
75b3412a by Philipp Hörist at 2018-04-28T13:49:53+02:00
Update Flatpak
- - - - -
3 changed files:
- gajim/plugins/gui.py
- gajim/plugins/pluginmanager.py
- org.gajim.Gajim.json
Changes:
=====================================
gajim/plugins/gui.py
=====================================
--- a/gajim/plugins/gui.py
+++ b/gajim/plugins/gui.py
@@ -251,7 +251,7 @@ class PluginsWindow(object):
if iter:
plugin = model.get_value(iter, Column.PLUGIN)
try:
- app.plugin_manager.remove_plugin(plugin)
+ app.plugin_manager.uninstall_plugin(plugin)
except PluginsystemError as e:
WarningDialog(_('Unable to properly remove the plugin'),
str(e), self.window)
=====================================
gajim/plugins/pluginmanager.py
=====================================
--- a/gajim/plugins/pluginmanager.py
+++ b/gajim/plugins/pluginmanager.py
@@ -36,6 +36,7 @@ from pkg_resources import parse_version
from gajim.common import app
from gajim.common import nec
+from gajim.common import configpaths
from gajim.common.exceptions import PluginsystemError
from gajim.plugins.helpers import log, log_calls, Singleton
@@ -149,6 +150,32 @@ class PluginManager(metaclass=Singleton):
plugin.version, plugin.__module__, plugin.short_name))
@log_calls('PluginManager')
+ def remove_plugin(self, plugin):
+ '''
+ removes the plugin from the plugin list and deletes all loaded modules
+ from sys. This way we will have a fresh start when the plugin gets added
+ agin.
+ '''
+ if plugin.active:
+ self.deactivate_plugin(plugin)
+
+ self.plugins.remove(plugin)
+
+ # remove modules from cache
+ base_package = plugin.__module__.split('.')[0]
+ # get the subpackages/-modules of the base_package. Add a dot to the
+ # name to avoid name problems (removing module_abc if base_package is
+ # module_ab)
+ modules_to_remove = [module for module in sys.modules
+ if module.startswith('{}.'.format(base_package))]
+ # remove the base_package itself
+ if base_package in sys.modules:
+ modules_to_remove.append(base_package)
+
+ for module_to_remove in modules_to_remove:
+ del sys.modules[module_to_remove]
+
+ @log_calls('PluginManager')
def add_plugins(self, plugin_classes):
for plugin_class in plugin_classes:
self.add_plugin(plugin_class)
@@ -531,20 +558,9 @@ class PluginManager(metaclass=Singleton):
continue
module = None
-
try:
- if module_name in sys.modules:
- if path == app.PLUGINS_DIRS[0]:
- # Only reload plugins from Gajim base dir when they
- # dont exist. This means plugins in the user path are
- # always preferred.
- continue
- from imp import reload
- log.info('Reloading %s', module_name)
- module = reload(sys.modules[module_name])
- else:
- log.info('Loading %s', module_name)
- module = __import__(module_name)
+ log.info('Loading %s', module_name)
+ module = __import__(module_name)
except Exception as error:
log.warning(
"While trying to load {plugin}, exception occurred".format(plugin=elem_name),
@@ -632,14 +648,14 @@ class PluginManager(metaclass=Singleton):
if len(dirs) > 1:
raise PluginsystemError(_('Archive is malformed'))
- base_dir, user_dir = app.PLUGINS_DIRS
+ user_dir = configpaths.get('PLUGINS_USER')
plugin_dir = os.path.join(user_dir, dirs[0])
if os.path.isdir(plugin_dir):
# Plugin dir already exists
if not owerwrite:
raise PluginsystemError(_('Plugin already exists'))
- self.remove_plugin(self.get_plugin_by_path(plugin_dir))
+ self.uninstall_plugin(self.get_plugin_by_path(plugin_dir))
zip_file.extractall(user_dir)
zip_file.close()
@@ -651,7 +667,7 @@ class PluginManager(metaclass=Singleton):
plugin = self.plugins[-1]
return plugin
- def remove_plugin(self, plugin):
+ def uninstall_plugin(self, plugin):
'''
Deactivate and remove plugin from `plugins` list
'''
@@ -664,15 +680,10 @@ class PluginManager(metaclass=Singleton):
raise PluginsystemError(error[1][1])
if plugin:
- if plugin.active:
- self.deactivate_plugin(plugin)
+ self.remove_plugin(plugin)
rmtree(plugin.__path__, False, on_error)
- self.plugins.remove(plugin)
if self._plugin_has_entry_in_global_config(plugin):
self._remove_plugin_entry_in_global_config(plugin)
- del sys.modules[plugin.__module__.split('.')[0]]
- del plugin.__module__.split('.')[-1]
- del plugin
def get_plugin_by_path(self, plugin_dir):
for plugin in self.plugins:
=====================================
org.gajim.Gajim.json
=====================================
--- a/org.gajim.Gajim.json
+++ b/org.gajim.Gajim.json
@@ -359,8 +359,8 @@
},
{
"type": "archive",
- "url": "https://ftp.gajim.org/plugins_1/plugin_installer.zip",
- "sha256": "3b0c40b22596da54c0eea7f7571c83b61619996ebe6c00b304d7fa5278aaefbb",
+ "url": "https://ftp.gajim.org/plugins_releases/plugin_installer_0.20.4.zip",
+ "sha256": "02f71f0921d67433ecdca7f0b682a63cadaa7a057fa68608f1ec7ce3fae44fb9",
"dest": "gajim/data/plugins/plugin_installer"
}
]
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/1786bb496aa423ae3845a4a37de55aa26…
---
View it on GitLab: https://dev.gajim.org/gajim/gajim/compare/1786bb496aa423ae3845a4a37de55aa26…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
49bfc1f2 by Markus Wintermann at 2018-04-28T13:31:19+02:00
Add support for dynamic reloading of plugins
* rename the remove_plugin function to uninstall_plugin because it
deletes files on the disc and uninstall is the label of the button which
triggers this function
* added a new remove_plugin function, which deactivates the plugin (if
needed), removes it from the list of managed plugins and deletes the
contents of sys.modules
- - - - -
2 changed files:
- gajim/plugins/gui.py
- gajim/plugins/pluginmanager.py
Changes:
=====================================
gajim/plugins/gui.py
=====================================
--- a/gajim/plugins/gui.py
+++ b/gajim/plugins/gui.py
@@ -252,7 +252,7 @@ class PluginsWindow(object):
if iter:
plugin = model.get_value(iter, Column.PLUGIN)
try:
- app.plugin_manager.remove_plugin(plugin)
+ app.plugin_manager.uninstall_plugin(plugin)
except PluginsystemError as e:
WarningDialog(_('Unable to properly remove the plugin'),
str(e), self.window)
=====================================
gajim/plugins/pluginmanager.py
=====================================
--- a/gajim/plugins/pluginmanager.py
+++ b/gajim/plugins/pluginmanager.py
@@ -150,6 +150,32 @@ class PluginManager(metaclass=Singleton):
plugin.version, plugin.__module__, plugin.short_name))
@log_calls('PluginManager')
+ def remove_plugin(self, plugin):
+ '''
+ removes the plugin from the plugin list and deletes all loaded modules
+ from sys. This way we will have a fresh start when the plugin gets added
+ agin.
+ '''
+ if plugin.active:
+ self.deactivate_plugin(plugin)
+
+ self.plugins.remove(plugin)
+
+ # remove modules from cache
+ base_package = plugin.__module__.split('.')[0]
+ # get the subpackages/-modules of the base_package. Add a dot to the
+ # name to avoid name problems (removing module_abc if base_package is
+ # module_ab)
+ modules_to_remove = [module for module in sys.modules
+ if module.startswith('{}.'.format(base_package))]
+ # remove the base_package itself
+ if base_package in sys.modules:
+ modules_to_remove.append(base_package)
+
+ for module_to_remove in modules_to_remove:
+ del sys.modules[module_to_remove]
+
+ @log_calls('PluginManager')
def add_plugins(self, plugin_classes):
for plugin_class in plugin_classes:
self.add_plugin(plugin_class)
@@ -532,20 +558,9 @@ class PluginManager(metaclass=Singleton):
continue
module = None
-
try:
- if module_name in sys.modules:
- if path == configpaths.get('PLUGINS_BASE'):
- # Only reload plugins from Gajim base dir when they
- # dont exist. This means plugins in the user path are
- # always preferred.
- continue
- from imp import reload
- log.info('Reloading %s', module_name)
- module = reload(sys.modules[module_name])
- else:
- log.info('Loading %s', module_name)
- module = __import__(module_name)
+ log.info('Loading %s', module_name)
+ module = __import__(module_name)
except Exception as error:
log.warning(
"While trying to load {plugin}, exception occurred".format(plugin=elem_name),
@@ -633,14 +648,14 @@ class PluginManager(metaclass=Singleton):
if len(dirs) > 1:
raise PluginsystemError(_('Archive is malformed'))
- base_dir, user_dir = configpaths.get('PLUGINS_DIRS')
+ user_dir = configpaths.get('PLUGINS_USER')
plugin_dir = os.path.join(user_dir, dirs[0])
if os.path.isdir(plugin_dir):
# Plugin dir already exists
if not owerwrite:
raise PluginsystemError(_('Plugin already exists'))
- self.remove_plugin(self.get_plugin_by_path(plugin_dir))
+ self.uninstall_plugin(self.get_plugin_by_path(plugin_dir))
zip_file.extractall(user_dir)
zip_file.close()
@@ -652,7 +667,7 @@ class PluginManager(metaclass=Singleton):
plugin = self.plugins[-1]
return plugin
- def remove_plugin(self, plugin):
+ def uninstall_plugin(self, plugin):
'''
Deactivate and remove plugin from `plugins` list
'''
@@ -665,15 +680,10 @@ class PluginManager(metaclass=Singleton):
raise PluginsystemError(error[1][1])
if plugin:
- if plugin.active:
- self.deactivate_plugin(plugin)
+ self.remove_plugin(plugin)
rmtree(plugin.__path__, False, on_error)
- self.plugins.remove(plugin)
if self._plugin_has_entry_in_global_config(plugin):
self._remove_plugin_entry_in_global_config(plugin)
- del sys.modules[plugin.__module__.split('.')[0]]
- del plugin.__module__.split('.')[-1]
- del plugin
def get_plugin_by_path(self, plugin_dir):
for plugin in self.plugins:
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/49bfc1f226e0b5e8fcceef5802140a9f2c…
---
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/49bfc1f226e0b5e8fcceef5802140a9f2c…
You're receiving this email because of your account on dev.gajim.org.