From 82235fee6f56b8dc3c0d7c84e9349a06ceb616e9 Mon Sep 17 00:00:00 2001 From: Pierre-Luc Beaudoin Date: Tue, 16 Dec 2008 15:18:51 -0500 Subject: Send timestamp --- libempathy-gtk/empathy-location-manager.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) 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 +#include #include @@ -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)); } -- cgit v1.2.3