aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libempathy/empathy-message.c21
-rw-r--r--libempathy/empathy-message.h4
2 files changed, 25 insertions, 0 deletions
diff --git a/libempathy/empathy-message.c b/libempathy/empathy-message.c
index 2090ae7c2..42e4a45a6 100644
--- a/libempathy/empathy-message.c
+++ b/libempathy/empathy-message.c
@@ -497,3 +497,24 @@ empathy_message_set_id (EmpathyMessage *message, guint id)
priv->id = id;
}
+
+gchar *
+empathy_message_get_unique_id (EmpathyMessage *message)
+{
+ EmpathyMessagePriv *priv = GET_PRIV (message);
+
+ return g_strdup_printf ("%d.%d", priv->id, g_str_hash (priv->body));
+}
+
+gboolean
+empathy_message_equal (EmpathyMessage *message1, EmpathyMessage *message2)
+{
+ EmpathyMessagePriv *priv1 = GET_PRIV (message1);
+ EmpathyMessagePriv *priv2 = GET_PRIV (message2);
+
+ if (priv1->id == priv2->id && g_str_hash (priv1->body) == g_str_hash (priv2->body)) {
+ return TRUE;
+ }
+
+ return FALSE;
+}
diff --git a/libempathy/empathy-message.h b/libempathy/empathy-message.h
index 95883f2db..2e70eea66 100644
--- a/libempathy/empathy-message.h
+++ b/libempathy/empathy-message.h
@@ -75,6 +75,10 @@ const gchar * empathy_message_type_to_str (TpChannelTextMessage
guint empathy_message_get_id (EmpathyMessage *message);
void empathy_message_set_id (EmpathyMessage *message, guint id);
+gchar * empathy_message_get_unique_id (EmpathyMessage *message);
+
+gboolean empathy_message_equal (EmpathyMessage *message1, EmpathyMessage *message2);
+
G_END_DECLS
#endif /* __EMPATHY_MESSAGE_H__ */