summaryrefslogtreecommitdiff
path: root/telepathy-logger/util.c
diff options
context:
space:
mode:
authorCosimo Alfarano <cosimo.alfarano@collabora.co.uk>2010-03-08 12:36:19 +0100
committerCosimo Alfarano <cosimo.alfarano@collabora.co.uk>2010-03-12 14:07:50 +0100
commit2d01efa2235a521fb6568d1fb072f79847befca4 (patch)
tree9d11df3a47bc3fbddfa0e7d62a56628d0bdaafed /telepathy-logger/util.c
parent5f8cebc439597e30eb6fc0f315770a6d5f2d1a8a (diff)
downloadtelepathy-logger-2d01efa2235a521fb6568d1fb072f79847befca4.tar.gz
Changed create_message_token timestamp type from str to gint64
This way it is passed a unique repr of the data. With the str if any other format string was used, a different token would be produced
Diffstat (limited to 'telepathy-logger/util.c')
-rw-r--r--telepathy-logger/util.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/telepathy-logger/util.c b/telepathy-logger/util.c
index 8193369..1bfdd91 100644
--- a/telepathy-logger/util.c
+++ b/telepathy-logger/util.c
@@ -21,16 +21,21 @@
#include "util.h"
+#include "datetime.h"
+#include "log-store-index.h"
+
/* Bug#26838 prevents us to trust Messages' iface message-token
* header, so I need to create a token which TPL can trust to be unique
* within itself */
gchar *
create_message_token (const gchar *channel,
- const gchar *date,
+ gint64 timestamp,
guint msgid)
{
GChecksum *log_id = g_checksum_new (G_CHECKSUM_SHA1);
gchar *retval;
+ gchar *date = tpl_time_to_string_local (timestamp,
+ TPL_LOG_STORE_INDEX_TIMESTAMP_FORMAT);
g_checksum_update (log_id, (guchar *) channel, -1);
g_checksum_update (log_id, (guchar *) date, -1);
@@ -39,6 +44,7 @@ create_message_token (const gchar *channel,
retval = g_strdup (g_checksum_get_string (log_id));
g_checksum_free (log_id);
+ g_free (date);
return retval;
}