aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre-Luc Beaudoin <pierre-luc@pierlux.com>2008-12-17 04:18:51 +0800
committerPierre-Luc Beaudoin <pierre-luc.beaudoin@collabora.co.uk>2009-06-01 23:35:30 +0800
commit82235fee6f56b8dc3c0d7c84e9349a06ceb616e9 (patch)
tree53502a6129145702e8203a71760fd3ed6b996f5f
parent94d32934ce6f9f4f22b314d262b7b2e7f15fa400 (diff)
downloadgsoc2013-empathy-82235fee6f56b8dc3c0d7c84e9349a06ceb616e9.tar
gsoc2013-empathy-82235fee6f56b8dc3c0d7c84e9349a06ceb616e9.tar.gz
gsoc2013-empathy-82235fee6f56b8dc3c0d7c84e9349a06ceb616e9.tar.bz2
gsoc2013-empathy-82235fee6f56b8dc3c0d7c84e9349a06ceb616e9.tar.lz
gsoc2013-empathy-82235fee6f56b8dc3c0d7c84e9349a06ceb616e9.tar.xz
gsoc2013-empathy-82235fee6f56b8dc3c0d7c84e9349a06ceb616e9.tar.zst
gsoc2013-empathy-82235fee6f56b8dc3c0d7c84e9349a06ceb616e9.zip
Send timestamp
-rw-r--r--libempathy-gtk/empathy-location-manager.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/libempathy-gtk/empathy-location-manager.c b/libempathy-gtk/empathy-location-manager.c
index 9fda2f90d..2e61d8d5e 100644
--- a/libempathy-gtk/empathy-location-manager.c
+++ b/libempathy-gtk/empathy-location-manager.c
@@ -22,6 +22,7 @@
#include "config.h"
#include <string.h>
+#include <time.h>
#include <glib/gi18n.h>
@@ -249,6 +250,25 @@ empathy_location_manager_get_default (void)
return singleton;
}
+static void
+update_timestamp (EmpathyLocationManager *location_manager,
+ int timestamp)
+{
+ EmpathyLocationManagerPriv *priv;
+ priv = GET_PRIV (location_manager);
+ GValue *new_value;
+ gchar str_time [100];
+ time_t time = timestamp;
+ struct tm *ptm = gmtime (&time);
+
+ if (strftime (str_time, 100, "%Y%m%dT%TZ", ptm) == 0)
+ return;
+
+ new_value = tp_g_value_slice_new (G_TYPE_STRING);
+ g_value_set_string (new_value, str_time);
+ g_hash_table_insert (priv->location, EMPATHY_LOCATION_TIMESTAMP, new_value);
+ DEBUG ("\t - Timestamp: %s", str_time);
+}
#if HAVE_GEOCLUE
static void
@@ -324,6 +344,7 @@ position_changed_cb (GeocluePosition *position,
DEBUG ("\t - Accuracy: %f", mean);
}
+ update_timestamp (location_manager, timestamp);
publish_location_to_all_accounts (EMPATHY_LOCATION_MANAGER (location_manager));
}
@@ -381,6 +402,7 @@ address_changed_cb (GeoclueAddress *address,
g_hash_table_foreach (details, address_foreach_cb, (gpointer)location_manager);
+ update_timestamp (location_manager, timestamp);
publish_location_to_all_accounts (EMPATHY_LOCATION_MANAGER (location_manager));
}