[hamster_integration] Fix imports, fix Activity sending and retracting
This commit is contained in:
committed by
Philipp Hörist
parent
0faa416363
commit
4da67cdfaf
@@ -10,13 +10,9 @@ from gajim.common import dbus_support
|
|||||||
|
|
||||||
from gajim.plugins import GajimPlugin
|
from gajim.plugins import GajimPlugin
|
||||||
from gajim.plugins.helpers import log_calls
|
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'
|
HAMSTAER_INTERFACE = 'org.gnome.Hamster'
|
||||||
SUBACTIVITIES = []
|
SUBACTIVITIES = []
|
||||||
@@ -31,9 +27,8 @@ class HamsterIntegrationPlugin(GajimPlugin):
|
|||||||
|
|
||||||
@log_calls('HamsterIntegrationPlugin')
|
@log_calls('HamsterIntegrationPlugin')
|
||||||
def init(self):
|
def init(self):
|
||||||
self.description = _('Integration with project hamster\n'
|
self.description = _('Integration with project hamster, see '
|
||||||
'see https://trac.gajim.org/ticket/6993\n'
|
'http://projecthamster.wordpress.com/about/')
|
||||||
'and http://projecthamster.wordpress.com/about/')
|
|
||||||
self.config_dialog = None
|
self.config_dialog = None
|
||||||
self.events_handlers = {}
|
self.events_handlers = {}
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
@@ -79,7 +74,7 @@ class HamsterIntegrationPlugin(GajimPlugin):
|
|||||||
for account in accounts:
|
for account in accounts:
|
||||||
if app.account_is_connected(account):
|
if app.account_is_connected(account):
|
||||||
connection = app.connections[account]
|
connection = app.connections[account]
|
||||||
connection.retract_activity()
|
connection.get_module('UserActivity').send(None)
|
||||||
return
|
return
|
||||||
|
|
||||||
last_fact = self.from_dbus_fact(facts[-1])
|
last_fact = self.from_dbus_fact(facts[-1])
|
||||||
@@ -98,8 +93,8 @@ class HamsterIntegrationPlugin(GajimPlugin):
|
|||||||
for account in app.connections:
|
for account in app.connections:
|
||||||
if app.account_is_connected(account):
|
if app.account_is_connected(account):
|
||||||
connection = app.connections[account]
|
connection = app.connections[account]
|
||||||
connection.send_activity(activity, subactivity,
|
connection.get_module('UserActivity').send(
|
||||||
last_fact['fact'])
|
(activity, subactivity, last_fact['fact']))
|
||||||
|
|
||||||
def from_dbus_fact(self, fact):
|
def from_dbus_fact(self, fact):
|
||||||
'''unpack the struct into a proper dict'''
|
'''unpack the struct into a proper dict'''
|
||||||
|
|||||||
Reference in New Issue
Block a user