From 3d88b24d03dc7c96983cba44a4952e29a0ef46a5 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Thu, 3 Mar 2011 13:56:57 -0500 Subject: Port _tpl_time_parse() to GDateTime --- telepathy-logger/datetime-internal.h | 2 +- telepathy-logger/datetime.c | 54 ++++++++++++------------------------ 2 files changed, 19 insertions(+), 37 deletions(-) diff --git a/telepathy-logger/datetime-internal.h b/telepathy-logger/datetime-internal.h index 34d292812..481c6243d 100644 --- a/telepathy-logger/datetime-internal.h +++ b/telepathy-logger/datetime-internal.h @@ -34,7 +34,7 @@ G_BEGIN_DECLS #define _TPL_TIME_FORMAT_DISPLAY_SHORT "%H:%M" #define _TPL_TIME_FORMAT_DISPLAY_LONG "%a %d %b %Y" time_t _tpl_time_get_current (void); -time_t _tpl_time_parse (const gchar * str); +gint64 _tpl_time_parse (const gchar * str); gchar *_tpl_time_to_string_utc (time_t t, const gchar * format); gchar *_tpl_time_to_string_local (time_t t, const gchar * format); diff --git a/telepathy-logger/datetime.c b/telepathy-logger/datetime.c index dde31e15d..d4f639102 100644 --- a/telepathy-logger/datetime.c +++ b/telepathy-logger/datetime.c @@ -38,54 +38,36 @@ _tpl_time_get_current (void) return time (NULL); } -static time_t -_tpl_time_get_local_time (struct tm *tm) -{ - const gchar *tz; - time_t t; - - tz = g_getenv ("TZ"); - g_setenv ("TZ", "", TRUE); - - tzset (); - - t = mktime (tm); - - if (tz != NULL) - g_setenv ("TZ", tz, TRUE); - else - g_unsetenv ("TZ"); - - tzset (); - - return t; -} /* The format is: "20021209T23:51:30" and is in UTC. 0 is returned on * failure. The alternative format "20021209" is also accepted. */ -time_t +gint64 _tpl_time_parse (const gchar *str) { - struct tm tm; - gint year, month; + gint year = 0; + gint month = 0; + gint day = 0; + gint hour = 0; + gint min = 0; + gint sec = 0; gint n_parsed; - - memset (&tm, 0, sizeof (struct tm)); + GDateTime *dt; + gint64 ts; n_parsed = sscanf (str, "%4d%2d%2dT%2d:%2d:%2d", - &year, &month, &tm.tm_mday, &tm.tm_hour, - &tm.tm_min, &tm.tm_sec); + &year, &month, &day, &hour, + &min, &sec); + if (n_parsed != 3 && n_parsed != 6) - { - return 0; - } + return 0; + + dt = g_date_time_new_utc (year, month, day, hour, min, sec); + ts = g_date_time_to_unix (dt); - tm.tm_year = year - 1900; - tm.tm_mon = month - 1; - tm.tm_isdst = -1; + g_date_time_unref (dt); - return _tpl_time_get_local_time (&tm); + return ts; } /* Converts the UTC timestamp to a string, also in UTC. Returns NULL on failure. */ -- cgit v1.2.3 From 8fd8f7cdc575cbd35d85439a41c11f192f8763e4 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Thu, 3 Mar 2011 13:57:14 -0500 Subject: Port XML log store to GDateTime --- telepathy-logger/log-store-xml.c | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/telepathy-logger/log-store-xml.c b/telepathy-logger/log-store-xml.c index c5fe56693..84be52c3f 100644 --- a/telepathy-logger/log-store-xml.c +++ b/telepathy-logger/log-store-xml.c @@ -340,14 +340,15 @@ log_store_xml_get_dir (TplLogStoreXml *self, static gchar * log_store_xml_get_timestamp_filename (void) { - time_t t; gchar *time_str; gchar *filename; + GDateTime *now; - t = _tpl_time_get_current (); - time_str = _tpl_time_to_string_local (t, LOG_TIME_FORMAT); + now = g_date_time_new_now_local (); + time_str = g_date_time_format (now, LOG_TIME_FORMAT); filename = g_strconcat (time_str, LOG_FILENAME_SUFFIX, NULL); + g_date_time_unref (now); g_free (time_str); return filename; @@ -357,12 +358,15 @@ log_store_xml_get_timestamp_filename (void) static gchar * log_store_xml_get_timestamp_from_event (TplEvent *event) { - time_t t; + GDateTime *ts; + gchar *ts_str; - t = tpl_event_get_timestamp (event); + ts = g_date_time_new_from_unix_utc (tpl_event_get_timestamp (event)); + ts_str = g_date_time_format (ts, LOG_TIME_FORMAT_FULL); - /* We keep the timestamps in the events as UTC */ - return _tpl_time_to_string_utc (t, LOG_TIME_FORMAT_FULL); + g_date_time_unref (ts); + + return ts_str; } -- cgit v1.2.3 From 0dbcccf1321b865319a898b5cfa6eb049e325d75 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Thu, 3 Mar 2011 14:02:23 -0500 Subject: Port _tpl_create_message_token() to GDateTime --- telepathy-logger/util.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/telepathy-logger/util.c b/telepathy-logger/util.c index f7be04488..c14c86502 100644 --- a/telepathy-logger/util.c +++ b/telepathy-logger/util.c @@ -21,7 +21,6 @@ #include "util-internal.h" -#include "datetime-internal.h" #include "log-store-sqlite-internal.h" #include @@ -33,14 +32,20 @@ * within itself */ gchar * _tpl_create_message_token (const gchar *channel, - gint64 timestamp, + gint64 unix_timestamp, guint msgid) { - GChecksum *log_id = g_checksum_new (G_CHECKSUM_SHA1); gchar *retval; - gchar *date = _tpl_time_to_string_local (timestamp, + gchar *date; + GDateTime *timestamp; + GChecksum *log_id = g_checksum_new (G_CHECKSUM_SHA1); + + timestamp = g_date_time_new_from_unix_utc (unix_timestamp); + date = g_date_time_format (timestamp, TPL_LOG_STORE_SQLITE_TIMESTAMP_FORMAT); + g_date_time_unref (timestamp); + g_checksum_update (log_id, (guchar *) channel, -1); g_checksum_update (log_id, (guchar *) date, -1); g_checksum_update (log_id, (guchar *) &msgid, sizeof (unsigned int)); -- cgit v1.2.3 From 968941a7c7d417b58743c19145a37beceeb6e2be Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Thu, 3 Mar 2011 15:24:41 -0500 Subject: Port SQLite log store to GDateTime --- telepathy-logger/log-store-sqlite-internal.h | 2 +- telepathy-logger/log-store-sqlite.c | 52 +++++++++++++++++++--------- 2 files changed, 37 insertions(+), 17 deletions(-) diff --git a/telepathy-logger/log-store-sqlite-internal.h b/telepathy-logger/log-store-sqlite-internal.h index d44d9712b..aa978fa2c 100644 --- a/telepathy-logger/log-store-sqlite-internal.h +++ b/telepathy-logger/log-store-sqlite-internal.h @@ -79,7 +79,7 @@ TplLogStore * _tpl_log_store_sqlite_dup (void); GList * _tpl_log_store_sqlite_get_pending_messages (TplLogStore *self, TpChannel *channel, GError **error); GList * _tpl_log_store_sqlite_get_log_ids (TplLogStore *self, - TpChannel *channel, time_t timestamp, GError **error); + TpChannel *channel, gint64 timestamp, GError **error); gboolean _tpl_log_store_sqlite_log_id_is_present (TplLogStore *self, const gchar* log_id); diff --git a/telepathy-logger/log-store-sqlite.c b/telepathy-logger/log-store-sqlite.c index 90668ea48..7c17effcc 100644 --- a/telepathy-logger/log-store-sqlite.c +++ b/telepathy-logger/log-store-sqlite.c @@ -34,7 +34,6 @@ #include "log-manager-internal.h" #define DEBUG_FLAG TPL_DEBUG_LOG_STORE -#include "datetime-internal.h" #include "debug-internal.h" #include "util-internal.h" @@ -47,7 +46,7 @@ static void log_store_iface_init (TplLogStoreInterface *iface); static gboolean _insert_to_cache_table (TplLogStore *self, TplEvent *message, GError **error); -static void tpl_log_store_sqlite_purge (TplLogStoreSqlite *self, time_t delta, +static void tpl_log_store_sqlite_purge (TplLogStoreSqlite *self, GTimeSpan delta, GError **error); static gboolean purge_event_timeout (gpointer logstore); @@ -298,21 +297,30 @@ get_channel_name_from_event (TplEvent *event) static char * get_date (TplEvent *event) { - time_t t; + GDateTime *ts; + gchar *date; + + ts = g_date_time_new_from_unix_utc (tpl_event_get_timestamp (event)); + date = g_date_time_format (ts, "%Y-%m-%d"); - t = tpl_event_get_timestamp (event); + g_date_time_unref (ts); - return _tpl_time_to_string_utc (t, "%Y-%m-%d"); + + return date; } static char * get_datetime (TplEvent *event) { - time_t t; + GDateTime *ts; + gchar *date; + + ts = g_date_time_new_from_unix_utc (tpl_event_get_timestamp (event)); + date = g_date_time_format (ts, TPL_LOG_STORE_SQLITE_TIMESTAMP_FORMAT); - t = tpl_event_get_timestamp (event); + g_date_time_unref (ts); - return _tpl_time_to_string_utc (t, TPL_LOG_STORE_SQLITE_TIMESTAMP_FORMAT); + return date; } static const char * @@ -799,10 +807,10 @@ out: * If @channel is %NULL, it will get all the existing log-ids. * * All the entries will be filtered against @timestamp, returning only log-ids - * older than this value (time_t). Set it to %G_MAXUINT or any other value in + * older than this value (gint64). Set it to %G_MAXINT64 or any other value in * the future to obtain all the entries. * For example, to obtain entries older than one day ago, use - * @timestamp = (#_tpl_time_get_current()-86400) + * @timestamp = (now - 86400) * * Note that (in case @channel is not %NULL) this method might return log-ids * which are not currently related to @channel but just share the object-path, @@ -819,13 +827,14 @@ out: GList * _tpl_log_store_sqlite_get_log_ids (TplLogStore *self, TpChannel *channel, - time_t timestamp, + gint64 unix_timestamp, GError **error) { TplLogStoreSqlitePrivate *priv = GET_PRIV (self); sqlite3_stmt *sql = NULL; GList *retval = NULL; - gchar *date = NULL; + GDateTime *timestamp; + gchar *date; int e; g_return_val_if_fail (TPL_IS_LOG_STORE_SQLITE (self), NULL); @@ -849,10 +858,14 @@ _tpl_log_store_sqlite_get_log_ids (TplLogStore *self, goto out; } - date = _tpl_time_to_string_utc (timestamp, + timestamp = g_date_time_new_from_unix_utc (unix_timestamp); + date = g_date_time_format (timestamp, TPL_LOG_STORE_SQLITE_TIMESTAMP_FORMAT); sqlite3_bind_text (sql, 1, date, -1, SQLITE_TRANSIENT); + g_date_time_unref (timestamp); + g_free (date); + if (channel != NULL) sqlite3_bind_text (sql, 2, get_channel_name (channel), -1, SQLITE_TRANSIENT); @@ -877,7 +890,6 @@ _tpl_log_store_sqlite_get_log_ids (TplLogStore *self, out: if (sql != NULL) sqlite3_finalize (sql); - g_free (date); /* check that we set an error if appropriate * NOTE: retval == NULL && *error != @@ -1059,20 +1071,28 @@ out: static void tpl_log_store_sqlite_purge (TplLogStoreSqlite *self, - time_t delta, + GTimeSpan delta, GError **error) { TplLogStoreSqlitePrivate *priv = GET_PRIV (self); sqlite3_stmt *sql = NULL; + GDateTime *now; + GDateTime *timestamp; gchar *date; int e; g_return_if_fail (error == NULL || *error == NULL); g_return_if_fail (TPL_IS_LOG_STORE_SQLITE (self)); - date = _tpl_time_to_string_utc ((_tpl_time_get_current () - delta), + now = g_date_time_new_now_utc (); + timestamp = g_date_time_add (now, -delta); + + date = g_date_time_format (timestamp, TPL_LOG_STORE_SQLITE_TIMESTAMP_FORMAT); + g_date_time_unref (now); + g_date_time_unref (timestamp); + DEBUG ("Purging entries older than %s (%u seconds ago)", date, (guint) delta); e = sqlite3_prepare_v2 (priv->db, "DELETE FROM message_cache " -- cgit v1.2.3 From fe3fcdc701e7ee091a10dcbe82af55ce3a7d14b5 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Thu, 3 Mar 2011 15:35:14 -0500 Subject: Move _time_parse() to util and remove datetime --- doc/reference/libtelepathy-logger/Makefile.am | 1 - telepathy-logger/Makefile.am | 2 - telepathy-logger/datetime-internal.h | 42 ---------- telepathy-logger/datetime.c | 109 -------------------------- telepathy-logger/log-manager.c | 1 - telepathy-logger/log-store-pidgin.c | 1 - telepathy-logger/log-store-xml.c | 1 - telepathy-logger/text-channel.c | 1 - telepathy-logger/util-internal.h | 6 +- telepathy-logger/util.c | 35 ++++++++- 10 files changed, 39 insertions(+), 160 deletions(-) delete mode 100644 telepathy-logger/datetime-internal.h delete mode 100644 telepathy-logger/datetime.c diff --git a/doc/reference/libtelepathy-logger/Makefile.am b/doc/reference/libtelepathy-logger/Makefile.am index c235d1f48..8a0062345 100644 --- a/doc/reference/libtelepathy-logger/Makefile.am +++ b/doc/reference/libtelepathy-logger/Makefile.am @@ -61,7 +61,6 @@ IGNORE_HFILES=\ channel-internal.h \ conf-internal.h \ contact-internal.h \ - datetime-internal.h \ dbus-service-internal.h \ debug-internal.h \ event-internal.h \ diff --git a/telepathy-logger/Makefile.am b/telepathy-logger/Makefile.am index 7431e9213..9941f7bbe 100644 --- a/telepathy-logger/Makefile.am +++ b/telepathy-logger/Makefile.am @@ -52,8 +52,6 @@ libtelepathy_logger_la_SOURCES = \ conf-internal.h \ entity.c \ entity-internal.h \ - datetime.c \ - datetime-internal.h \ dbus-service.c \ dbus-service-internal.h \ debug-internal.h \ diff --git a/telepathy-logger/datetime-internal.h b/telepathy-logger/datetime-internal.h deleted file mode 100644 index 481c6243d..000000000 --- a/telepathy-logger/datetime-internal.h +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Copyright (C) 2004 Imendio AB - * Copyright (C) 2007-2010 Collabora Ltd. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - * Authors: Richard Hult - */ - -#ifndef __TPL_TIME_H__ -#define __TPL_TIME_H__ - -#ifndef __USE_XOPEN -#define __USE_XOPEN -#endif -#include - -#include - -G_BEGIN_DECLS -#define _TPL_TIME_FORMAT_DISPLAY_SHORT "%H:%M" -#define _TPL_TIME_FORMAT_DISPLAY_LONG "%a %d %b %Y" -time_t _tpl_time_get_current (void); -gint64 _tpl_time_parse (const gchar * str); -gchar *_tpl_time_to_string_utc (time_t t, const gchar * format); -gchar *_tpl_time_to_string_local (time_t t, const gchar * format); - -G_END_DECLS -#endif /* __TPL_TIME_H__ */ diff --git a/telepathy-logger/datetime.c b/telepathy-logger/datetime.c deleted file mode 100644 index d4f639102..000000000 --- a/telepathy-logger/datetime.c +++ /dev/null @@ -1,109 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Copyright (C) 2003-2007 Imendio AB - * Copyright (C) 2007-2010 Collabora Ltd. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - * Authors: Richard Hult - */ - -#include "config.h" -#include "datetime-internal.h" - -#include -#include -#include -#include -#include - - -/* Note: time is always in UTC. */ - -time_t -_tpl_time_get_current (void) -{ - return time (NULL); -} - - -/* The format is: "20021209T23:51:30" and is in UTC. 0 is returned on - * failure. The alternative format "20021209" is also accepted. - */ -gint64 -_tpl_time_parse (const gchar *str) -{ - gint year = 0; - gint month = 0; - gint day = 0; - gint hour = 0; - gint min = 0; - gint sec = 0; - gint n_parsed; - GDateTime *dt; - gint64 ts; - - n_parsed = sscanf (str, "%4d%2d%2dT%2d:%2d:%2d", - &year, &month, &day, &hour, - &min, &sec); - - if (n_parsed != 3 && n_parsed != 6) - return 0; - - dt = g_date_time_new_utc (year, month, day, hour, min, sec); - ts = g_date_time_to_unix (dt); - - g_date_time_unref (dt); - - return ts; -} - -/* Converts the UTC timestamp to a string, also in UTC. Returns NULL on failure. */ -gchar * -_tpl_time_to_string_utc (time_t t, - const gchar * format) -{ - gchar stamp[128]; - struct tm *tm; - - g_return_val_if_fail (format != NULL, NULL); - - tm = gmtime (&t); - if (strftime (stamp, sizeof (stamp), format, tm) == 0) - { - return NULL; - } - - return g_strdup (stamp); -} - -/* Converts the UTC timestamp to a string, in local time. Returns NULL on failure. */ -gchar * -_tpl_time_to_string_local (time_t t, - const gchar *format) -{ - gchar stamp[128]; - struct tm *tm; - - g_return_val_if_fail (format != NULL, NULL); - - tm = localtime (&t); - if (strftime (stamp, sizeof (stamp), format, tm) == 0) - { - return NULL; - } - - return g_strdup (stamp); -} diff --git a/telepathy-logger/log-manager.c b/telepathy-logger/log-manager.c index a69a4f900..00229c420 100644 --- a/telepathy-logger/log-manager.c +++ b/telepathy-logger/log-manager.c @@ -43,7 +43,6 @@ #include #define DEBUG_FLAG TPL_DEBUG_LOG_MANAGER -#include #include #include diff --git a/telepathy-logger/log-store-pidgin.c b/telepathy-logger/log-store-pidgin.c index 766f724dc..b40a21415 100644 --- a/telepathy-logger/log-store-pidgin.c +++ b/telepathy-logger/log-store-pidgin.c @@ -35,7 +35,6 @@ #include "log-manager-internal.h" #include "text-event-internal.h" #include "entity-internal.h" -#include "datetime-internal.h" #include "util-internal.h" #define DEBUG_FLAG TPL_DEBUG_LOG_STORE diff --git a/telepathy-logger/log-store-xml.c b/telepathy-logger/log-store-xml.c index 84be52c3f..7486e9041 100644 --- a/telepathy-logger/log-store-xml.c +++ b/telepathy-logger/log-store-xml.c @@ -49,7 +49,6 @@ #define DEBUG_FLAG TPL_DEBUG_LOG_STORE #include -#include #include #include diff --git a/telepathy-logger/text-channel.c b/telepathy-logger/text-channel.c index 67b9a5b38..b34ae2c14 100644 --- a/telepathy-logger/text-channel.c +++ b/telepathy-logger/text-channel.c @@ -38,7 +38,6 @@ #define DEBUG_FLAG TPL_DEBUG_CHANNEL #include #include -#include #include #include diff --git a/telepathy-logger/util-internal.h b/telepathy-logger/util-internal.h index e5d75cf41..3c7982eb4 100644 --- a/telepathy-logger/util-internal.h +++ b/telepathy-logger/util-internal.h @@ -1,6 +1,7 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * Copyright (C) 2009 Collabora Ltd. + * Copyright (C) 2009-2011 Collabora Ltd. + * Copyright (C) 2003-2007 Imendio AB * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -17,6 +18,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * * Authors: Cosimo Alfarano + * Richard Hult */ #ifndef __TPL_UTIL_H__ @@ -32,5 +34,7 @@ gchar *_tpl_create_message_token (const gchar *channel, gint64 timestamp, void _tpl_rmdir_recursively (const gchar *dir_name); +gint64 _tpl_time_parse (const gchar * str); + #endif // __TPL_UTIL_H__ diff --git a/telepathy-logger/util.c b/telepathy-logger/util.c index c14c86502..d242972be 100644 --- a/telepathy-logger/util.c +++ b/telepathy-logger/util.c @@ -1,6 +1,7 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* - * Copyright (C) 2009 Collabora Ltd. + * Copyright (C) 2009-2011 Collabora Ltd. + * Copyright (C) 2003-2007 Imendio AB * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -17,6 +18,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * * Authors: Cosimo Alfarano + * Richard Hult */ #include "util-internal.h" @@ -91,3 +93,34 @@ _tpl_rmdir_recursively (const gchar *dir_name) dir_name, g_strerror (errno)); } + +/* The format is: "20021209T23:51:30" and is in UTC. 0 is returned on + * failure. The alternative format "20021209" is also accepted. + */ +gint64 +_tpl_time_parse (const gchar *str) +{ + gint year = 0; + gint month = 0; + gint day = 0; + gint hour = 0; + gint min = 0; + gint sec = 0; + gint n_parsed; + GDateTime *dt; + gint64 ts; + + n_parsed = sscanf (str, "%4d%2d%2dT%2d:%2d:%2d", + &year, &month, &day, &hour, + &min, &sec); + + if (n_parsed != 3 && n_parsed != 6) + return 0; + + dt = g_date_time_new_utc (year, month, day, hour, min, sec); + ts = g_date_time_to_unix (dt); + + g_date_time_unref (dt); + + return ts; +} -- cgit v1.2.3 From 7dbbb62b3b748ce84033630549a50fe8c01b5e17 Mon Sep 17 00:00:00 2001 From: Nicolas Dufresne Date: Thu, 3 Mar 2011 15:44:28 -0500 Subject: Message a(sv) contains timestamp in signed int 64bit --- telepathy-logger/text-channel.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/telepathy-logger/text-channel.c b/telepathy-logger/text-channel.c index b34ae2c14..0c02562fa 100644 --- a/telepathy-logger/text-channel.c +++ b/telepathy-logger/text-channel.c @@ -711,7 +711,7 @@ got_message_pending_messages_cb (TpProxy *proxy, GList *l; const gchar *message_token; gchar *tpl_message_token; - guint64 message_timestamp; + gint64 message_timestamp; guint message_type = TP_CHANNEL_TEXT_MESSAGE_TYPE_NORMAL; guint message_flags = 0; guint message_id; @@ -737,7 +737,7 @@ got_message_pending_messages_cb (TpProxy *proxy, "UNKNOWN"); message_id = TPL_TEXT_EVENT_MSG_ID_UNKNOWN; } - message_timestamp = tp_asv_get_uint64 (message_headers, + message_timestamp = tp_asv_get_int64 (message_headers, "message-received", NULL); tpl_message_token = _tpl_create_message_token (channel_path, @@ -770,8 +770,9 @@ got_message_pending_messages_cb (TpProxy *proxy, if (l == NULL) { /* call the received signal callback to trigger the message storing */ + /* FIXME Avoid converting gint64 timestamp into guint timestamp */ on_received_signal_cb (TP_CHANNEL (proxy), - message_id, message_timestamp, message_sender_handle, + message_id, (guint) message_timestamp, message_sender_handle, message_type, message_flags, message_body, NULL, NULL); } -- cgit v1.2.3