Skip to content
Snippets Groups Projects
Commit eccb3b88 authored by Dicson's avatar Dicson
Browse files

Set Location.Do not ignore 'Pablish location' parametr

parent 735e0165
No related branches found
No related tags found
No related merge requests found
[info] [info]
name: Set Location name: Set Location
short_name: set_location short_name: set_location
version: 0.6 version: 0.7
description: Set information about the current geographical or physical location. description: Set information about the current geographical or physical location.
To be able to specify a location on the built-in card, you must install python-osmgpsmap > 0.5 To be able to specify a location on the built-in card, you must install python-osmgpsmap > 0.5
authors: Denis Fomin <fominde@gmail.com> authors: Denis Fomin <fominde@gmail.com>
homepage: http://trac-plugins.gajim.org/wiki/SetLocalitionPlugin homepage: http://trac-plugins.gajim.org/wiki/SetLocalitionPlugin
...@@ -10,6 +10,7 @@ from plugins.gui import GajimPluginConfigDialog ...@@ -10,6 +10,7 @@ from plugins.gui import GajimPluginConfigDialog
from plugins import GajimPlugin from plugins import GajimPlugin
from plugins.helpers import log, log_calls from plugins.helpers import log, log_calls
from common import gajim from common import gajim
from common import ged
import gtkgui_helpers import gtkgui_helpers
from dialogs import InputDialog, WarningDialog from dialogs import InputDialog, WarningDialog
...@@ -43,6 +44,22 @@ class SetLocationPlugin(GajimPlugin): ...@@ -43,6 +44,22 @@ class SetLocationPlugin(GajimPlugin):
@log_calls('SetLocationPlugin') @log_calls('SetLocationPlugin')
def activate(self): def activate(self):
gajim.ged.register_event_handler('signed-in', ged.POSTGUI,
self.on_signed_in)
self.send_locations()
@log_calls('SetLocationPlugin')
def deactivate(self):
self._data = {}
for acct in gajim.connections:
gajim.connections[acct].send_location(self._data)
gajim.ged.remove_event_handler('signed-in', ged.POSTGUI,
self.on_signed_in)
def on_signed_in(self, network_event):
self.send_locations(network_event.conn.name)
def send_locations(self, acct=False):
self._data = {} self._data = {}
timestamp = time.time() timestamp = time.time()
timestamp = datetime.utcfromtimestamp(timestamp) timestamp = datetime.utcfromtimestamp(timestamp)
...@@ -50,16 +67,13 @@ class SetLocationPlugin(GajimPlugin): ...@@ -50,16 +67,13 @@ class SetLocationPlugin(GajimPlugin):
self._data['timestamp'] = timestamp self._data['timestamp'] = timestamp
for name in self.config_default_values: for name in self.config_default_values:
self._data[name] = self.config[name] self._data[name] = self.config[name]
for acct in gajim.connections:
if gajim.connections[acct].connected == 0:
gajim.connections[acct].to_be_sent_location = self._data
else:
gajim.connections[acct].send_location(self._data)
@log_calls('SetLocationPlugin') if not acct:
def deactivate(self): #set geo for all accounts
self._data = {} for acct in gajim.connections:
for acct in gajim.connections: if gajim.config.get_per('accounts', acct, 'publish_location'):
gajim.connections[acct].send_location(self._data)
elif gajim.config.get_per('accounts', acct, 'publish_location'):
gajim.connections[acct].send_location(self._data) gajim.connections[acct].send_location(self._data)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment