From 4da67cdfaf694249f33f990a2c9a399e50b313e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Br=C3=B6tzmann?= Date: Thu, 1 Nov 2018 22:43:51 +0100 Subject: [PATCH] [hamster_integration] Fix imports, fix Activity sending and retracting --- hamster/hamster.py | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/hamster/hamster.py b/hamster/hamster.py index 35c6c77..281bd07 100644 --- a/hamster/hamster.py +++ b/hamster/hamster.py @@ -10,13 +10,9 @@ from gajim.common import dbus_support from gajim.plugins import GajimPlugin from gajim.plugins.helpers import log_calls -from gajim.common.pep import ACTIVITIES +from gajim.plugins.plugins_i18n import _ +from gajim.common.const import ACTIVITIES -# Since Gajim 1.1.0 _() has to be imported -try: - from gajim.common.i18n import _ -except ImportError: - pass HAMSTAER_INTERFACE = 'org.gnome.Hamster' SUBACTIVITIES = [] @@ -31,9 +27,8 @@ class HamsterIntegrationPlugin(GajimPlugin): @log_calls('HamsterIntegrationPlugin') def init(self): - self.description = _('Integration with project hamster\n' - 'see https://trac.gajim.org/ticket/6993\n' - 'and http://projecthamster.wordpress.com/about/') + self.description = _('Integration with project hamster, see ' + 'http://projecthamster.wordpress.com/about/') self.config_dialog = None self.events_handlers = {} if os.name == 'nt': @@ -79,7 +74,7 @@ class HamsterIntegrationPlugin(GajimPlugin): for account in accounts: if app.account_is_connected(account): connection = app.connections[account] - connection.retract_activity() + connection.get_module('UserActivity').send(None) return last_fact = self.from_dbus_fact(facts[-1]) @@ -98,8 +93,8 @@ class HamsterIntegrationPlugin(GajimPlugin): for account in app.connections: if app.account_is_connected(account): connection = app.connections[account] - connection.send_activity(activity, subactivity, - last_fact['fact']) + connection.get_module('UserActivity').send( + (activity, subactivity, last_fact['fact'])) def from_dbus_fact(self, fact): '''unpack the struct into a proper dict'''