Philipp Hörist pushed to branch master at gajim / gajim
Commits:
dce40846 by lovetox at 2020-05-16T17:50:30+02:00
Client: Unregister modules when account is disabled
- - - - -
fbd65d79 by lovetox at 2020-05-16T17:50:30+02:00
Client: Don't create nbxmpp.Client() after cleanup()
- - - - -
fdfb0864 by lovetox at 2020-05-16T17:50:30+02:00
PluginManager: Remove obsolete check on handler registration
- - - - -
2 changed files:
- gajim/common/client.py
- gajim/plugins/pluginmanager.py
Changes:
=====================================
gajim/common/client.py
=====================================
@@ -57,7 +57,6 @@ class Client(ConnectionHandlers):
self.password = None
self._priority = 0
- self.handlers_registered = False
self._connect_machine_calls = 0
self.avatar_conversion = False
self.addressing_supported = False
@@ -77,9 +76,10 @@ class Client(ConnectionHandlers):
self._ssl_errors = set()
+ self._destroyed = False
+
self.available_transports = {}
- # Register all modules
modules.register_modules(self)
self._create_client()
@@ -121,6 +121,16 @@ class Client(ConnectionHandlers):
self._remove_account = value
def _create_client(self):
+ if self._destroyed:
+ # If we disable an account cleanup() is called and all
+ # modules are unregistered. Because disable_account() does not wait
+ # for the client to properly disconnect, handlers of the
+ # nbxmpp.Client() are emitted after we called cleanup().
+ # After nbxmpp.Client() disconnects and is destroyed we create a
+ # new instance with this method but modules.get_handlers() fails
+ # because modules are already unregistered.
+ # TODO: Make this nicer
+ return
log.info('Create new nbxmpp client')
self._client = NBXMPPClient(log_context=self._account)
self.connection = self._client
@@ -162,7 +172,8 @@ class Client(ConnectionHandlers):
self._client.subscribe('stanza-sent', self._on_stanza_sent)
self._client.subscribe('stanza-received', self._on_stanza_received)
- self._register_new_handlers()
+ for handler in modules.get_handlers(self):
+ self._client.register_handler(handler)
def process_ssl_errors(self):
if not self._ssl_errors:
@@ -372,11 +383,6 @@ class Client(ConnectionHandlers):
app.nec.push_incoming_event(
OurShowEvent(None, conn=self, show=show))
- def _register_new_handlers(self):
- for handler in modules.get_handlers(self):
- self._client.register_handler(handler)
- self.handlers_registered = True
-
def get_module(self, name):
return modules.get(self._account, name)
@@ -522,7 +528,8 @@ class Client(ConnectionHandlers):
self._reconnect_timer_source = None
def cleanup(self):
- pass
+ self._destroyed = True
+ modules.unregister_modules(self)
def quit(self, kill_core):
if kill_core and self._state in (ClientState.CONNECTING,
=====================================
gajim/plugins/pluginmanager.py
=====================================
@@ -406,13 +406,8 @@ class PluginManager(metaclass=Singleton):
instance, name = module.get_instance(con)
modules.register_single_module(con, instance, name)
- # If handlers have been registered, register the
- # plugin handlers. Otherwise this will be done
- # automatically on connecting
- # in connection_handlers._register_handlers()
- if con.handlers_registered:
- for handler in instance.handlers:
- con.connection.register_handler(handler)
+ for handler in instance.handlers:
+ con.connection.register_handler(handler)
def _unregister_modules_with_handlers(self, plugin):
if not hasattr(plugin, 'modules'):
@@ -422,11 +417,8 @@ class PluginManager(metaclass=Singleton):
instance = con.get_module(module.name)
modules.unregister_single_module(con, module.name)
- # Account is still connected and handlers are registered
- # So just unregister the plugin handlers
- if con.handlers_registered:
- for handler in instance.handlers:
- con.connection.unregister_handler(handler)
+ for handler in instance.handlers:
+ con.connection.unregister_handler(handler)
def activate_plugin(self, plugin):
'''
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/compare/fe82e8874b5f904a5fcdc7780156e34…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/compare/fe82e8874b5f904a5fcdc7780156e34…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
cc5ed8e2 by André Apitzsch at 2020-05-16T12:30:34+02:00
Use PEP-440 compatible version comparison
https://www.python.org/dev/peps/pep-0440/
- - - - -
d63a796a by André Apitzsch at 2020-05-16T12:30:34+02:00
Optparser: Support PEP-440 versions
- - - - -
62ecb9ca by André Apitzsch at 2020-05-16T12:30:34+02:00
PluginManager: Use packaging's Version() directly
- - - - -
fe82e887 by André Apitzsch at 2020-05-16T12:57:00+02:00
Optparser: Remove unneeded comparison
`new_version` passed to `update_config()` corresponds to the currently
running version of Gajim, i.e. it's the latest version compared to the
other versions mentioned in `update_config()`, that's why the
conditions `V('...') <= new_version` are always true and can be removed.
- - - - -
6 changed files:
- flatpak/org.gajim.Gajim.yaml
- gajim/common/helpers.py
- gajim/common/optparser.py
- gajim/gajim.py
- gajim/plugins/pluginmanager.py
- setup.cfg
Changes:
=====================================
flatpak/org.gajim.Gajim.yaml
=====================================
@@ -49,6 +49,24 @@ cleanup:
- '*.la'
modules:
+ - name: python3-pyparsing
+ buildsystem: simple
+ build-commands:
+ - pip3 install --prefix=/app pyparsing-2.4.7-py2.py3-none-any.whl
+ sources:
+ - type: file
+ url: https://files.pythonhosted.org/packages/8a/bb/488841f56197b13700afd5658fc27…
+ sha256: ef9d7589ef3c200abe66653d3f1ab1033c3c419ae9b9bdb1240a85b024efc88b
+
+ - name: python3-packaging
+ buildsystem: simple
+ build-commands:
+ - pip3 install --prefix=/app packaging-20.3-py2.py3-none-any.whl
+ sources:
+ - type: file
+ url: https://files.pythonhosted.org/packages/62/0a/34641d2bf5c917c96db0ded85ae4d…
+ sha256: 82f77b9bee21c1bafbf35a84905d604d5d1223801d639cf3ed140bd651c08752
+
- name: python3-pycparser
buildsystem: simple
build-commands:
=====================================
gajim/common/helpers.py
=====================================
@@ -56,9 +56,9 @@ import urllib
from urllib.parse import unquote
from io import StringIO
from datetime import datetime, timedelta
-from distutils.version import LooseVersion as V
from encodings.punycode import punycode_encode
from functools import wraps
+from packaging.version import Version as V
from nbxmpp.namespaces import Namespace
from nbxmpp.const import Role
=====================================
gajim/common/optparser.py
=====================================
@@ -28,6 +28,7 @@ import sys
import re
import logging
from pathlib import Path
+from packaging.version import Version as V
from gi.repository import Gdk
from nbxmpp.util import text_to_color
@@ -126,32 +127,25 @@ class OptionsParser:
return True
def update_config(self, old_version, new_version):
- old_version_list = old_version.split('.') # convert '0.x.y' to (0, x, y)
- old = []
- while old_version_list:
- old.append(int(old_version_list.pop(0)))
- new_version_list = new_version.split('.')
- new = []
- while new_version_list:
- new.append(int(new_version_list.pop(0)))
-
- if old < [0, 16, 4, 1] and new >= [0, 16, 4, 1]:
+ old = V(old_version)
+
+ if old < V('0.16.4.1'):
self.update_config_to_01641()
- if old < [0, 16, 10, 1] and new >= [0, 16, 10, 1]:
+ if old < V('0.16.10.1'):
self.update_config_to_016101()
- if old < [0, 16, 10, 2] and new >= [0, 16, 10, 2]:
+ if old < V('0.16.10.2'):
self.update_config_to_016102()
- if old < [0, 16, 10, 4] and new >= [0, 16, 10, 4]:
+ if old < V('0.16.10.4'):
self.update_config_to_016104()
- if old < [0, 16, 10, 5] and new >= [0, 16, 10, 5]:
+ if old < V('0.16.10.5'):
self.update_config_to_016105()
- if old < [0, 98, 3] and new >= [0, 98, 3]:
+ if old < V('0.98.3'):
self.update_config_to_0983()
- if old < [1, 1, 93] and new >= [1, 1, 93]:
+ if old < V('1.1.93'):
self.update_config_to_1193()
- if old < [1, 1, 94] and new >= [1, 1, 94]:
+ if old < V('1.1.94'):
self.update_config_to_1194()
- if old < [1, 1, 95] and new >= [1, 1, 95]:
+ if old < V('1.1.95'):
self.update_config_to_1195()
app.config.set('version', new_version)
=====================================
gajim/gajim.py
=====================================
@@ -22,7 +22,7 @@ import signal
import platform
from ctypes import CDLL, byref, create_string_buffer
from ctypes.util import find_library
-from distutils.version import LooseVersion as V
+from packaging.version import Version as V
from gajim.common import i18n
=====================================
gajim/plugins/pluginmanager.py
=====================================
@@ -29,7 +29,7 @@ import fnmatch
import zipfile
from shutil import rmtree, move
import configparser
-from pkg_resources import parse_version
+from packaging.version import Version as V
import gajim
from gajim.common import app
@@ -645,14 +645,14 @@ class PluginManager(metaclass=Singleton):
continue
gajim_v = gajim.__version__.split('+', 1)[0]
- gajim_v_cmp = parse_version(gajim_v)
+ gajim_v_cmp = V(gajim_v)
- if min_v and gajim_v_cmp < parse_version(min_v):
+ if min_v and gajim_v_cmp < V(min_v):
log.warning('Plugin %s not loaded, newer version of'
'gajim required: %s < %s',
elem_name, gajim_v, min_v)
continue
- if max_v and gajim_v_cmp > parse_version(max_v):
+ if max_v and gajim_v_cmp > V(max_v):
log.warning('Plugin %s not loaded, plugin incompatible '
'with current version of gajim: '
'%s > %s', elem_name, gajim_v, max_v)
=====================================
setup.cfg
=====================================
@@ -23,6 +23,7 @@ install_requires =
css-parser
keyring
nbxmpp>=0.9.94
+ packaging
precis-i18n>=1.0.0
pyOpenSSL>=16.2
pycairo>=1.16.0
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/compare/59f0403f553655c4de9ba3e764019ef…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/compare/59f0403f553655c4de9ba3e764019ef…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
c0eef5cc by André Apitzsch at 2020-05-16T06:55:21+02:00
IPython: Simplify code
IPython 6.5 is the first version that is Python 3.7 compatible.
https://ipython.readthedocs.io/en/stable/whatsnew/version6.html#ipython-6-5…
- - - - -
1 changed file:
- gajim/dev/ipython_view.py
Changes:
=====================================
gajim/dev/ipython_view.py
=====================================
@@ -61,7 +61,6 @@ import sys
import os
from io import StringIO
from functools import reduce
-from pkg_resources import parse_version
from gi.repository import Gtk
from gi.repository import Gdk
@@ -170,12 +169,6 @@ class IterableIPShell:
# Workaround for updating namespace with sys.modules
#
self.__update_namespace()
-
- # Avoid using input splitter when not really needed.
- # Perhaps it could work even before 5.8.0
- # But it definitely does not work any more with >= 7.0.0
- self.no_input_splitter = parse_version(IPython.release.version) >= \
- parse_version('5.8.0')
self.lines = []
def __update_namespace(self):
@@ -208,28 +201,21 @@ class IterableIPShell:
self.IP.rl_do_indent = True
try:
- line = self.IP.raw_input(self.prompt)
+ self.IP.raw_input(self.prompt)
except KeyboardInterrupt:
self.IP.write('\nKeyboardInterrupt\n')
self.IP.input_splitter.reset()
except Exception:
self.IP.showtraceback()
else:
- if self.no_input_splitter:
- self.lines.append(self.IP.raw_input(self.prompt))
- self.iter_more = self.IP.check_complete(
- '\n'.join(self.lines))[0] == 'incomplete'
- else:
- self.IP.input_splitter.push(line)
- self.iter_more = self.IP.input_splitter.push_accepts_more()
+ self.lines.append(self.IP.raw_input(self.prompt))
+ self.iter_more = self.IP.check_complete(
+ '\n'.join(self.lines))[0] == 'incomplete'
self.prompt = self.generatePrompt(self.iter_more)
if not self.iter_more:
- if self.no_input_splitter:
- source_raw = '\n'.join(self.lines)
- self.lines = []
- else:
- source_raw = self.IP.input_splitter.raw_reset()
+ source_raw = '\n'.join(self.lines)
+ self.lines = []
self.IP.run_cell(source_raw, store_history=True)
self.IP.rl_do_indent = False
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/c0eef5cc126fcd80b144873f7389c88c…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/c0eef5cc126fcd80b144873f7389c88c…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
4f3c8630 by André Apitzsch at 2020-05-16T00:15:34+02:00
Add shortcut for shortcuts window
Follow https://gitlab.gnome.org/GNOME/Initiatives/-/issues/14
- - - - -
1 changed file:
- gajim/application.py
Changes:
=====================================
gajim/application.py
=====================================
@@ -545,6 +545,7 @@ class GajimApplication(Gtk.Application):
def _set_shortcuts(self):
shortcuts = {
'app.quit': ['<Primary>Q'],
+ 'app.shortcuts': ['<Primary>question'],
'app.preferences': ['<Primary>P'],
'app.plugins': ['<Primary>E'],
'app.xml-console': ['<Primary><Shift>X'],
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/4f3c86305c1342e83f03324d1a8053fc…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/4f3c86305c1342e83f03324d1a8053fc…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
8dcf632f by Emmanuel Gil Peyrot at 2020-05-13T23:25:21+02:00
Add a codespell ignore list
- - - - -
c3511db9 by Emmanuel Gil Peyrot at 2020-05-13T23:25:21+02:00
Add a CI pass for codespell
This avoids future typos.
- - - - -
c0785403 by Emmanuel Gil Peyrot at 2020-05-13T23:25:21+02:00
Remove � characters from emoji data
- - - - -
e23cbe36 by Emmanuel Gil Peyrot at 2020-05-13T23:25:21+02:00
Fix typos
Thanks codespell!
- - - - -
30 changed files:
- .gitlab-ci.yml
- + codespell.conf
- gajim/chat_control.py
- gajim/chat_control_base.py
- gajim/common/app.py
- gajim/common/contacts.py
- gajim/common/exceptions.py
- gajim/common/helpers.py
- gajim/common/i18n.py
- gajim/common/jingle_ft.py
- gajim/common/jingle_ftstates.py
- gajim/common/jingle_rtp.py
- gajim/common/jingle_session.py
- gajim/common/jingle_xtls.py
- gajim/common/logger.py
- gajim/common/logging_helpers.py
- gajim/common/modules/adhoc_commands.py
- gajim/common/modules/base.py
- gajim/common/modules/bits_of_binary.py
- gajim/common/modules/blocking.py
- gajim/common/modules/bytestream.py
- gajim/common/modules/chatstates.py
- gajim/common/modules/entity_time.py
- gajim/common/modules/httpupload.py
- gajim/common/modules/jingle.py
- gajim/common/modules/message.py
- gajim/common/modules/misc.py
- gajim/common/modules/muc.py
- gajim/common/modules/presence.py
- gajim/common/modules/privacylists.py
The diff was not included because it is too large.
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/compare/f261b49561adda5e5c9785f1e863a66…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/compare/f261b49561adda5e5c9785f1e863a66…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
f261b495 by André Apitzsch at 2020-05-13T22:17:33+02:00
Contacts: Don't delete list while reading it
- - - - -
1 changed file:
- gajim/common/contacts.py
Changes:
=====================================
gajim/common/contacts.py
=====================================
@@ -670,7 +670,7 @@ class Contacts():
for _contact in self._contacts[old_jid]:
_contact.jid = new_jid
self._contacts[new_jid].append(_contact)
- del self._contacts[old_jid]
+ del self._contacts[old_jid]
def get_combined_chatstate(self, jid):
if jid not in self._contacts:
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/f261b49561adda5e5c9785f1e863a66a…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/-/commit/f261b49561adda5e5c9785f1e863a66a…
You're receiving this email because of your account on dev.gajim.org.