summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--telepathy-logger/event.c17
-rw-r--r--telepathy-logger/text-event.c16
2 files changed, 32 insertions, 1 deletions
diff --git a/telepathy-logger/event.c b/telepathy-logger/event.c
index f76c7f8..2d1765c 100644
--- a/telepathy-logger/event.c
+++ b/telepathy-logger/event.c
@@ -23,6 +23,7 @@
#include "event-internal.h"
#include <glib.h>
+#include "entity-internal.h"
#define DEBUG_FLAG TPL_DEBUG_EVENT
#include <telepathy-logger/debug-internal.h>
@@ -180,6 +181,17 @@ tpl_event_set_property (GObject *object,
};
}
+static inline gboolean
+account_equal (TpAccount *account1, TpAccount *account2)
+{
+ g_return_val_if_fail (TP_IS_PROXY (account1), FALSE);
+ g_return_val_if_fail (TP_IS_PROXY (account2), FALSE);
+
+ return !tp_strdiff (tp_proxy_get_object_path (TP_PROXY (account1)),
+ tp_proxy_get_object_path (TP_PROXY (account2)));
+}
+
+
static gboolean
tpl_event_equal_default (TplEvent *message1,
TplEvent *message2)
@@ -187,7 +199,10 @@ tpl_event_equal_default (TplEvent *message1,
g_return_val_if_fail (TPL_IS_EVENT (message1), FALSE);
g_return_val_if_fail (TPL_IS_EVENT (message2), FALSE);
- return !tp_strdiff (message1->priv->log_id, message2->priv->log_id);
+ return message1->priv->timestamp == message2->priv->timestamp
+ && account_equal (message1->priv->account, message2->priv->account)
+ && _tpl_entity_compare (message1->priv->sender, message2->priv->sender)
+ && _tpl_entity_compare (message1->priv->receiver, message2->priv->receiver);
}
diff --git a/telepathy-logger/text-event.c b/telepathy-logger/text-event.c
index 8adffe3..a1a40ad 100644
--- a/telepathy-logger/text-event.c
+++ b/telepathy-logger/text-event.c
@@ -166,15 +166,31 @@ tpl_text_event_set_property (GObject *object,
}
}
+
+static gboolean tpl_text_event_equal (TplEvent *event1,
+ TplEvent *event2)
+{
+ TplTextEvent *text_event1 = TPL_TEXT_EVENT (event1);
+ TplTextEvent *text_event2 = TPL_TEXT_EVENT (event2);
+
+ return TPL_EVENT_CLASS (tpl_text_event_parent_class)->equal (event1, event2)
+ && text_event1->priv->message_type == text_event2->priv->message_type
+ && !tp_strdiff (text_event1->priv->message, text_event2->priv->message);
+}
+
+
static void tpl_text_event_class_init (TplTextEventClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ TplEventClass *event_class = TPL_EVENT_CLASS (klass);
GParamSpec *param_spec;
object_class->finalize = tpl_text_event_finalize;
object_class->get_property = tpl_text_event_get_property;
object_class->set_property = tpl_text_event_set_property;
+ event_class->equal = tpl_text_event_equal;
+
param_spec = g_param_spec_uint ("message-type",
"MessageType",
"The message type for a Text log event",