aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
authorJonny Lamb <jonny.lamb@collabora.co.uk>2009-03-06 19:52:24 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2009-03-06 19:52:24 +0800
commit0a777526729fd4cd1e2171b9ea6e5c498c17ac64 (patch)
tree0328686778d1497d79767c59b82b75376a6469ab /libempathy
parent83790c2b83179b2170417e34f0fa55b75808a0dd (diff)
downloadgsoc2013-empathy-0a777526729fd4cd1e2171b9ea6e5c498c17ac64.tar
gsoc2013-empathy-0a777526729fd4cd1e2171b9ea6e5c498c17ac64.tar.gz
gsoc2013-empathy-0a777526729fd4cd1e2171b9ea6e5c498c17ac64.tar.bz2
gsoc2013-empathy-0a777526729fd4cd1e2171b9ea6e5c498c17ac64.tar.lz
gsoc2013-empathy-0a777526729fd4cd1e2171b9ea6e5c498c17ac64.tar.xz
gsoc2013-empathy-0a777526729fd4cd1e2171b9ea6e5c498c17ac64.tar.zst
gsoc2013-empathy-0a777526729fd4cd1e2171b9ea6e5c498c17ac64.zip
Added empathy_message_get_unique_id & empathy_message_equal.
Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk> svn path=/trunk/; revision=2598
Diffstat (limited to 'libempathy')
-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__ */