summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/dbus-service.c33
-rw-r--r--telepathy-logger/channel-text.c124
-rw-r--r--telepathy-logger/log-entry.c57
-rw-r--r--telepathy-logger/log-entry.h7
-rw-r--r--telepathy-logger/log-manager.c6
5 files changed, 121 insertions, 106 deletions
diff --git a/src/dbus-service.c b/src/dbus-service.c
index 339c376..e1c0b12 100644
--- a/src/dbus-service.c
+++ b/src/dbus-service.c
@@ -27,6 +27,7 @@
#include <telepathy-glib/dbus.h>
#include <telepathy-glib/account.h>
+#include <telepathy-logger/log-entry-text.h>
#include <telepathy-logger/log-manager.h>
#define DBUS_STRUCT_STRING_STRING_UINT \
@@ -43,7 +44,6 @@ tpl_dbus_service_last_chats (TplDBusService *self,
G_DEFINE_TYPE (TplDBusService, tpl_dbus_service, G_TYPE_OBJECT)
-
static void
tpl_dbus_service_finalize (GObject *obj)
{
@@ -82,7 +82,8 @@ tpl_dbus_service_init(TplDBusService* self)
}
-TplDBusService *tpl_dbus_service_new (void)
+TplDBusService *
+tpl_dbus_service_new (void)
{
return g_object_new(TPL_TYPE_DBUS_SERVICE, NULL);
}
@@ -102,10 +103,11 @@ tpl_dbus_service_chat_message_free(TplDBusServiceChatMessage *data)
*/
static gboolean
-_pack_last_chats_answer (GList *data, GPtrArray **array)
+_pack_last_chats_answer (GList *data,
+ GPtrArray **array)
{
guint data_idx;
- GPtrArray *retval;
+ GPtrArray *retval;
(*array) = g_ptr_array_new_with_free_func ((GDestroyNotify) g_value_array_free);
retval = *array;
@@ -117,31 +119,22 @@ _pack_last_chats_answer (GList *data, GPtrArray **array)
GValue *value = g_new0(GValue, 1);
gchar *message = g_strdup (
- tpl_log_entry_text_get_message (
- log->entry.text)
- );
- gchar *sender = g_strdup (
- tpl_contact_get_identifier(
- tpl_log_entry_text_get_sender (
- log->entry.text)) );
+ tpl_log_entry_text_get_message (TPL_LOG_ENTRY_TEXT (log)));
+ gchar *sender = g_strdup (tpl_contact_get_identifier(
+ tpl_log_entry_text_get_sender (TPL_LOG_ENTRY_TEXT (log))));
guint timestamp = tpl_log_entry_get_timestamp (log);
-
g_value_init(value, DBUS_STRUCT_STRING_STRING_UINT);
g_value_take_boxed (value, dbus_g_type_specialized_construct
- (DBUS_STRUCT_STRING_STRING_UINT));
+ (DBUS_STRUCT_STRING_STRING_UINT));
- dbus_g_type_struct_set (value, 0, sender,
- 1, message,
- 2, timestamp,
- G_MAXUINT);
+ dbus_g_type_struct_set (value, 0, sender, 1, message, 2, timestamp,
+ G_MAXUINT);
g_ptr_array_add (retval, g_value_get_boxed (value));
g_free (value);
g_debug ("retval[%d]=\"[%d] <%s>: %s\"\n", data_idx,
- timestamp,
- sender,
- message);
+ timestamp, sender, message);
}
return TRUE;
}
diff --git a/telepathy-logger/channel-text.c b/telepathy-logger/channel-text.c
index 933181f..31a78ae 100644
--- a/telepathy-logger/channel-text.c
+++ b/telepathy-logger/channel-text.c
@@ -41,7 +41,7 @@
#define TP_CONTACT_MYSELF 0
#define TP_CONTACT_REMOTE 1
-typedef void (*TplPendingProc) (TplTextChannel * self);
+typedef void (*TplPendingProc) (TplTextChannel *self);
static TpContactFeature features[TP_CONTACT_FEATURES_LEN] = {
TP_CONTACT_FEATURE_ALIAS,
@@ -51,8 +51,9 @@ static TpContactFeature features[TP_CONTACT_FEATURES_LEN] = {
/* Signal's Callbacks */
static void
-_channel_on_closed_cb (TpChannel * proxy,
- gpointer user_data, GObject * weak_object)
+_channel_on_closed_cb (TpChannel *proxy,
+ gpointer user_data,
+ GObject *weak_object)
{
TplTextChannel *tpl_text = TPL_TEXT_CHANNEL (user_data);
TplChannel *tpl_chan = tpl_text_channel_get_tpl_channel (tpl_text);
@@ -68,20 +69,22 @@ _channel_on_closed_cb (TpChannel * proxy,
}
static void
-_channel_on_lost_message_cb (TpChannel * proxy,
- gpointer user_data, GObject * weak_object)
+_channel_on_lost_message_cb (TpChannel *proxy,
+ gpointer user_data,
+ GObject *weak_object)
{
g_debug ("lost message signal catched. nothing logged");
// TODO log that the system lost a message
}
static void
-_channel_on_send_error_cb (TpChannel * proxy,
+_channel_on_send_error_cb (TpChannel *proxy,
guint arg_Error,
guint arg_Timestamp,
guint arg_Type,
- const gchar * arg_Text,
- gpointer user_data, GObject * weak_object)
+ const gchar *arg_Text,
+ gpointer user_data,
+ GObject *weak_object)
{
g_error ("unlogged event: "
"TP was unable to send the message: %s", arg_Text);
@@ -90,11 +93,12 @@ _channel_on_send_error_cb (TpChannel * proxy,
static void
-_channel_on_sent_signal_cb (TpChannel * proxy,
+_channel_on_sent_signal_cb (TpChannel *proxy,
guint arg_Timestamp,
guint arg_Type,
- const gchar * arg_Text,
- gpointer user_data, GObject * weak_object)
+ const gchar *arg_Text,
+ gpointer user_data,
+ GObject *weak_object)
{
GError *error = NULL;
TplTextChannel *tpl_text = TPL_TEXT_CHANNEL (user_data);
@@ -137,10 +141,10 @@ _channel_on_sent_signal_cb (TpChannel * proxy,
TPL_LOG_ENTRY_DIRECTION_OUT);
g_free (chat_id);
- tpl_log_entry_set_timestamp (TPL_LOG_ENTRY (log), (time_t) arg_Timestamp);
- tpl_log_entry_set_signal_type (TPL_LOG_ENTRY (log), TPL_LOG_ENTRY_TEXT_SIGNAL_SENT);
- tpl_log_entry_set_sender (TPL_LOG_ENTRY (log), tpl_contact_sender);
- tpl_log_entry_set_receiver (TPL_LOG_ENTRY (log), tpl_contact_receiver);
+ tpl_log_entry_text_set_timestamp (log, (time_t) arg_Timestamp);
+ tpl_log_entry_text_set_signal_type (log, TPL_LOG_ENTRY_TEXT_SIGNAL_SENT);
+ tpl_log_entry_text_set_sender (log, tpl_contact_sender);
+ tpl_log_entry_text_set_receiver (log, tpl_contact_receiver);
tpl_log_entry_text_set_message (log, arg_Text);
tpl_log_entry_text_set_message_type (log, arg_Type);
tpl_log_entry_text_set_tpl_text_channel (log, tpl_text);
@@ -166,14 +170,14 @@ _channel_on_sent_signal_cb (TpChannel * proxy,
}
static void
-_channel_on_received_signal_with_contact_cb (TpConnection * connection,
+_channel_on_received_signal_with_contact_cb (TpConnection *connection,
guint n_contacts,
- TpContact * const *contacts,
+ TpContact *const *contacts,
guint n_failed,
- const TpHandle * failed,
- const GError * error,
+ const TpHandle *failed,
+ const GError *error,
gpointer user_data,
- GObject * weak_object)
+ GObject *weak_object)
{
TplLogEntryText *log = TPL_LOG_ENTRY_TEXT (user_data);
TplTextChannel *tpl_text = tpl_log_entry_text_get_tpl_text_channel (log);
@@ -208,7 +212,7 @@ _channel_on_received_signal_with_contact_cb (TpConnection * connection,
tpl_contact_sender = tpl_contact_from_tp_contact (remote);
tpl_contact_set_contact_type (tpl_contact_sender, TPL_CONTACT_USER);
- tpl_log_entry_set_sender (TPL_LOG_ENTRY (log), tpl_contact_sender);
+ tpl_log_entry_text_set_sender (log, tpl_contact_sender);
g_message ("recvd: %s (%s): %s",
tpl_contact_get_identifier (tpl_contact_sender),
@@ -222,12 +226,12 @@ _channel_on_received_signal_with_contact_cb (TpConnection * connection,
else
chat_id = g_strdup (tpl_text_channel_get_chatroom_id (tpl_text));
- tpl_log_entry_set_chat_id (TPL_LOG_ENTRY (log), chat_id);
+ tpl_log_entry_text_set_chat_id (log, chat_id);
tpl_log_entry_text_set_chatroom (log,
- tpl_text_channel_is_chatroom (tpl_text));
+ tpl_text_channel_is_chatroom (tpl_text));
logmanager = tpl_log_manager_dup_singleton ();
- tpl_log_manager_add_message (logmanager, (gpointer) log, &e);
+ tpl_log_manager_add_message (logmanager, log, &e);
if (e != NULL)
{
g_error ("LogStore: %s", e->message);
@@ -241,14 +245,15 @@ _channel_on_received_signal_with_contact_cb (TpConnection * connection,
}
static void
-_channel_on_received_signal_cb (TpChannel * proxy,
+_channel_on_received_signal_cb (TpChannel *proxy,
guint arg_ID,
guint arg_Timestamp,
guint arg_Sender,
guint arg_Type,
guint arg_Flags,
- const gchar * arg_Text,
- gpointer user_data, GObject * weak_object)
+ const gchar *arg_Text,
+ gpointer user_data,
+ GObject *weak_object)
{
TpHandle remote_handle = (TpHandle) arg_Sender;
TplTextChannel *tpl_text = TPL_TEXT_CHANNEL (user_data);
@@ -274,14 +279,14 @@ _channel_on_received_signal_cb (TpChannel * proxy,
tpl_log_entry_text_set_tpl_text_channel (log, tpl_text);
tpl_log_entry_text_set_message (log, arg_Text);
tpl_log_entry_text_set_message_type (log, arg_Type);
- tpl_log_entry_set_signal_type (TPL_LOG_ENTRY (log), TPL_LOG_ENTRY_TEXT_SIGNAL_RECEIVED);
+ tpl_log_entry_text_set_signal_type (log, TPL_LOG_ENTRY_TEXT_SIGNAL_RECEIVED);
me = tpl_text_channel_get_my_contact (tpl_text);
tpl_contact_receiver = tpl_contact_from_tp_contact (me);
tpl_contact_set_contact_type (tpl_contact_receiver, TPL_CONTACT_USER);
- tpl_log_entry_set_receiver (TPL_LOG_ENTRY (log), tpl_contact_receiver);
+ tpl_log_entry_text_set_receiver (log, tpl_contact_receiver);
- tpl_log_entry_set_timestamp (TPL_LOG_ENTRY (log), (time_t) arg_Timestamp);
+ tpl_log_entry_text_set_timestamp (log, (time_t) arg_Timestamp);
tp_connection_get_contacts_by_handle (tpl_channel_get_connection (tpl_chan),
1, &remote_handle,
@@ -298,7 +303,7 @@ _channel_on_received_signal_cb (TpChannel * proxy,
/* Context related operations */
static void
-context_continue (TplTextChannel * ctx)
+context_continue (TplTextChannel *ctx)
{
if (g_queue_is_empty (ctx->chain))
{
@@ -315,7 +320,7 @@ context_continue (TplTextChannel * ctx)
/* Connect signals to TplTextChannel instance */
static void
-_tpl_text_channel_pendingproc_connect_signals (TplTextChannel * self)
+_tpl_text_channel_pendingproc_connect_signals (TplTextChannel *self)
{
GError *error = NULL;
TpChannel *channel = NULL;
@@ -381,10 +386,10 @@ _tpl_text_channel_pendingproc_connect_signals (TplTextChannel * self)
}
static void
-_tpl_text_channel_get_chatroom_cb (TpConnection * proxy,
- const gchar ** out_Identifiers,
- const GError * error,
- gpointer user_data, GObject * weak_object)
+_tpl_text_channel_get_chatroom_cb (TpConnection *proxy,
+ const gchar **out_Identifiers,
+ const GError *error,
+ gpointer user_data, GObject *weak_object)
{
TplTextChannel *tpl_text = TPL_TEXT_CHANNEL (user_data);
@@ -399,7 +404,7 @@ _tpl_text_channel_get_chatroom_cb (TpConnection * proxy,
}
static void
-_tpl_text_channel_pendingproc_get_chatroom_id (TplTextChannel * ctx)
+_tpl_text_channel_pendingproc_get_chatroom_id (TplTextChannel *ctx)
{
TplChannel *tpl_chan = tpl_text_channel_get_tpl_channel (ctx);
TpConnection *connection = tpl_channel_get_connection (tpl_chan);
@@ -427,13 +432,14 @@ _tpl_text_channel_pendingproc_get_chatroom_id (TplTextChannel * ctx)
// used by _get_my_contact and _get_remote_contact
static void
-_tpl_text_channel_get_contact_cb (TpConnection * connection,
+_tpl_text_channel_get_contact_cb (TpConnection *connection,
guint n_contacts,
- TpContact * const *contacts,
+ TpContact *const *contacts,
guint n_failed,
- const TpHandle * failed,
- const GError * error,
- gpointer user_data, GObject * weak_object)
+ const TpHandle *failed,
+ const GError *error,
+ gpointer user_data,
+ GObject *weak_object)
{
TplTextChannel *tpl_text = TPL_TEXT_CHANNEL (user_data);
@@ -479,7 +485,7 @@ _tpl_text_channel_get_contact_cb (TpConnection * connection,
static void
-_tpl_text_channel_pendingproc_get_remote_contact (TplTextChannel * ctx)
+_tpl_text_channel_pendingproc_get_remote_contact (TplTextChannel *ctx)
{
TplChannel *tpl_chan = tpl_text_channel_get_tpl_channel (ctx);
TpHandleType remote_handle_type;
@@ -497,7 +503,7 @@ _tpl_text_channel_pendingproc_get_remote_contact (TplTextChannel * ctx)
}
static void
-_tpl_text_channel_pendingproc_get_my_contact (TplTextChannel * ctx)
+_tpl_text_channel_pendingproc_get_my_contact (TplTextChannel *ctx)
{
TplChannel *tpl_chan = tpl_text_channel_get_tpl_channel (ctx);
TpHandle my_handle =
@@ -516,7 +522,7 @@ _tpl_text_channel_pendingproc_get_my_contact (TplTextChannel * ctx)
G_DEFINE_TYPE (TplTextChannel, tpl_text_channel, G_TYPE_OBJECT)
-static void tpl_text_channel_dispose (GObject * obj)
+static void tpl_text_channel_dispose (GObject *obj)
{
TplTextChannel *self = TPL_TEXT_CHANNEL (obj);
@@ -533,7 +539,7 @@ static void tpl_text_channel_dispose (GObject * obj)
}
static void
-tpl_text_channel_finalize (GObject * obj)
+tpl_text_channel_finalize (GObject *obj)
{
TplTextChannel *self = TPL_TEXT_CHANNEL (obj);
@@ -542,7 +548,7 @@ tpl_text_channel_finalize (GObject * obj)
}
static void
-tpl_text_channel_class_init (TplTextChannelClass * klass)
+tpl_text_channel_class_init (TplTextChannelClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
@@ -552,12 +558,12 @@ tpl_text_channel_class_init (TplTextChannelClass * klass)
static void
-tpl_text_channel_init (TplTextChannel * self)
+tpl_text_channel_init (TplTextChannel *self)
{
}
TplTextChannel *
-tpl_text_channel_new (TplChannel * tpl_channel)
+tpl_text_channel_new (TplChannel *tpl_channel)
{
TplTextChannel *ret = g_object_new (TPL_TYPE_TEXT_CHANNEL, NULL);
tpl_text_channel_set_tpl_channel (ret, tpl_channel);
@@ -613,39 +619,39 @@ tpl_text_channel_new (TplChannel * tpl_channel)
TplChannel *
-tpl_text_channel_get_tpl_channel (TplTextChannel * self)
+tpl_text_channel_get_tpl_channel (TplTextChannel *self)
{
return self->tpl_channel;
}
TpContact *
-tpl_text_channel_get_remote_contact (TplTextChannel * self)
+tpl_text_channel_get_remote_contact (TplTextChannel *self)
{
return self->remote_contact;
}
TpContact *
-tpl_text_channel_get_my_contact (TplTextChannel * self)
+tpl_text_channel_get_my_contact (TplTextChannel *self)
{
return self->my_contact;
}
gboolean
-tpl_text_channel_is_chatroom (TplTextChannel * self)
+tpl_text_channel_is_chatroom (TplTextChannel *self)
{
g_return_val_if_fail(TPL_IS_TEXT_CHANNEL (self), FALSE);
return self->chatroom;
}
const gchar *
-tpl_text_channel_get_chatroom_id (TplTextChannel * self)
+tpl_text_channel_get_chatroom_id (TplTextChannel *self)
{
g_return_val_if_fail(TPL_IS_TEXT_CHANNEL (self), NULL);
return self->chatroom_id;
}
void
-tpl_text_channel_set_tpl_channel (TplTextChannel * self, TplChannel * data)
+tpl_text_channel_set_tpl_channel (TplTextChannel *self, TplChannel *data)
{
g_return_if_fail (TPL_IS_TEXT_CHANNEL (self));
g_return_if_fail (TPL_IS_CHANNEL (data));
@@ -656,7 +662,7 @@ tpl_text_channel_set_tpl_channel (TplTextChannel * self, TplChannel * data)
}
void
-tpl_text_channel_set_remote_contact (TplTextChannel * self, TpContact * data)
+tpl_text_channel_set_remote_contact (TplTextChannel *self, TpContact *data)
{
g_return_if_fail (TPL_IS_TEXT_CHANNEL (self));
g_return_if_fail (TP_IS_CONTACT (data));
@@ -667,7 +673,7 @@ tpl_text_channel_set_remote_contact (TplTextChannel * self, TpContact * data)
}
void
-tpl_text_channel_set_my_contact (TplTextChannel * self, TpContact * data)
+tpl_text_channel_set_my_contact (TplTextChannel *self, TpContact *data)
{
g_return_if_fail (TPL_IS_TEXT_CHANNEL (self));
g_return_if_fail (TP_IS_CONTACT (data));
@@ -678,7 +684,7 @@ tpl_text_channel_set_my_contact (TplTextChannel * self, TpContact * data)
}
void
-tpl_text_channel_set_chatroom (TplTextChannel * self, gboolean data)
+tpl_text_channel_set_chatroom (TplTextChannel *self, gboolean data)
{
g_return_if_fail (TPL_IS_TEXT_CHANNEL (self));
@@ -686,7 +692,7 @@ tpl_text_channel_set_chatroom (TplTextChannel * self, gboolean data)
}
void
-tpl_text_channel_set_chatroom_id (TplTextChannel * self, const gchar * data)
+tpl_text_channel_set_chatroom_id (TplTextChannel *self, const gchar *data)
{
g_return_if_fail (TPL_IS_TEXT_CHANNEL (self));
diff --git a/telepathy-logger/log-entry.c b/telepathy-logger/log-entry.c
index 7cdab4c..381ce52 100644
--- a/telepathy-logger/log-entry.c
+++ b/telepathy-logger/log-entry.c
@@ -27,28 +27,21 @@
#include <telepathy-logger/debug.h>
#include <telepathy-logger/util.h>
+/**
+ * SECTION:LogEntry
+ * @title: TplLogEntry
+ * @short_description: Abstract representation of a log entry
+ * @see_also: #TplLogEntryText and other subclasses when they'll exist
+ *
+ * The TPLogger log entry abstract representation. This class is supposed to
+ * be subclassed by a class representing a specific type of log (i.e., Text
+ * chat, Call, etc).
+ *
+ */
+
G_DEFINE_ABSTRACT_TYPE (TplLogEntry, tpl_log_entry, G_TYPE_OBJECT)
static void tpl_log_entry_set_log_id (TplLogEntry *self, guint data);
-static time_t tpl_log_entry_get_timestamp (TplLogEntry* self);
-static TplLogEntrySignalType tpl_log_entry_get_signal_type (TplLogEntry* self);
-static guint tpl_log_entry_get_log_id (TplLogEntry *self);
-static const gchar *tpl_log_entry_get_chat_id (TplLogEntry *self);
-static TplLogEntryDirection tpl_log_entry_get_direction (TplLogEntry *self);
-static TplContact *tpl_log_entry_get_sender (TplLogEntry *self);
-static TplContact *tpl_log_entry_get_receiver (TplLogEntry *self);
-
-static void tpl_log_entry_set_timestamp (TplLogEntry *self, time_t data);
-static void tpl_log_entry_set_signal_type (TplLogEntry *self,
- TplLogEntrySignalType data);
-static void tpl_log_entry_set_direction (TplLogEntry *self,
- TplLogEntryDirection data);
-static void tpl_log_entry_set_chat_id (TplLogEntry *self,
- const gchar *data);
-static void tpl_log_entry_set_sender (TplLogEntry *self, TplContact *data);
-static void tpl_log_entry_set_receiver (TplLogEntry *self, TplContact *data);
-
-static gboolean tpl_log_entry_equal (TplLogEntry *message1, TplLogEntry *message2);
#define GET_PRIV(obj) TPL_GET_PRIV (obj, TplLogEntry)
struct _TplLogEntryPriv
@@ -79,7 +72,8 @@ enum {
};
-static void tpl_log_entry_finalize (GObject *obj)
+static void
+tpl_log_entry_finalize (GObject *obj)
{
TplLogEntryPriv *priv = GET_PRIV (obj);
@@ -397,7 +391,7 @@ tpl_log_entry_set_signal_type (TplLogEntry *self,
g_object_notify (G_OBJECT(self), "signal-type");
}
-
+/* set just on construction time */
static void
tpl_log_entry_set_log_id (TplLogEntry *self,
guint data)
@@ -472,4 +466,25 @@ tpl_log_entry_set_chat_id (TplLogEntry *self,
priv = GET_PRIV (self);
g_free (priv->chat_id);
priv->chat_id = g_strdup (data);
+ g_object_notify (G_OBJECT(self), "chat-id");
+}
+
+/**
+ * log_entry:
+ * @self: TplLogEntry subclass instance
+ * @data: an instance of the same class of @self,
+ *
+ * Checks if two instances of TplLogEntry represent the same data
+ *
+ * Returns: %TRUE if @data is the same type of @self and they hold the same
+ * data, %FALSE otherwise
+ */
+gboolean
+tpl_log_entry_equal (TplLogEntry *self,
+ TplLogEntry *data)
+{
+ g_return_val_if_fail (TPL_IS_LOG_ENTRY (self), FALSE);
+ g_return_val_if_fail (TPL_IS_LOG_ENTRY (data), FALSE);
+
+ return TPL_LOG_ENTRY_GET_CLASS (self)->equal (self, data);
}
diff --git a/telepathy-logger/log-entry.h b/telepathy-logger/log-entry.h
index fecd677..f4c1002 100644
--- a/telepathy-logger/log-entry.h
+++ b/telepathy-logger/log-entry.h
@@ -95,7 +95,7 @@ typedef struct
void (*set_receiver) (TplLogEntry *self, TplContact *data);
void (*set_chat_id) (TplLogEntry *self, const gchar *data);
- /* to be implemented by subclasses */
+ /* to be implemented only by subclasses */
gboolean (*equal) (TplLogEntry *entry1, TplLogEntry *entry2);
} TplLogEntryClass;
@@ -103,7 +103,6 @@ GType tpl_log_entry_get_type (void);
TplLogEntry *tpl_log_entry_new (guint log_id, const gchar *chat_id,
TplLogEntryDirection direction);
-/*
time_t tpl_log_entry_get_timestamp (TplLogEntry * self);
TplLogEntrySignalType tpl_log_entry_get_signal_type (TplLogEntry * self);
guint tpl_log_entry_get_log_id (TplLogEntry *self);
@@ -121,8 +120,8 @@ void tpl_log_entry_set_chat_id (TplLogEntry * self, const gchar * data);
void tpl_log_entry_set_sender (TplLogEntry * self, TplContact * data);
void tpl_log_entry_set_receiver (TplLogEntry * self, TplContact * data);
-gboolean tpl_log_entry_equal (TplLogEntry *message1, TplLogEntry *message2);
-*/
+gboolean tpl_log_entry_equal (TplLogEntry *self, TplLogEntry *data);
+
G_END_DECLS
#endif // __TPL_LOG_ENTRY_H__
diff --git a/telepathy-logger/log-manager.c b/telepathy-logger/log-manager.c
index 5b47dbf..c232b73 100644
--- a/telepathy-logger/log-manager.c
+++ b/telepathy-logger/log-manager.c
@@ -300,8 +300,10 @@ log_manager_message_date_cmp (gconstpointer a, gconstpointer b)
TplLogEntry *two = (TplLogEntry *) b;
time_t one_time, two_time;
- one_time = tpl_log_entry_get_timestamp (one);
- two_time = tpl_log_entry_get_timestamp (two);
+ /* TODO better to use a real method call, instead or dereferencing it's
+ * pointer */
+ one_time = TPL_LOG_ENTRY_GET_CLASS (one)->get_timestamp (one);
+ two_time = TPL_LOG_ENTRY_GET_CLASS (two)->get_timestamp (two);
/* Return -1 of message1 is older than message2 */
return one_time < two_time ? -1 : one_time - two_time;