empathy r2599 - trunk/libempathy
- From: xclaesse svn gnome org
- To: svn-commits-list gnome org
- Subject: empathy r2599 - trunk/libempathy
- Date: Fri, 6 Mar 2009 11:52:29 +0000 (UTC)
Author: xclaesse
Date: Fri Mar 6 11:52:29 2009
New Revision: 2599
URL: http://svn.gnome.org/viewvc/empathy?rev=2599&view=rev
Log:
EmpathyLogStore: Store the CM message ID in the logs, and use it when reading logs.
Signed-off-by: Jonny Lamb <jonny lamb collabora co uk>
Modified:
trunk/libempathy/empathy-log-store-empathy.c
Modified: trunk/libempathy/empathy-log-store-empathy.c
==============================================================================
--- trunk/libempathy/empathy-log-store-empathy.c (original)
+++ trunk/libempathy/empathy-log-store-empathy.c Fri Mar 6 11:52:29 2009
@@ -246,8 +246,10 @@
avatar_token = g_markup_escape_text (avatar->token, -1);
g_fprintf (file,
- "<message time='%s' id='%s' name='%s' token='%s' isuser='%s' type='%s'>"
- "%s</message>\n" LOG_FOOTER, timestamp, contact_id, contact_name,
+ "<message time='%s' cm_id='%d' id='%s' name='%s' token='%s' isuser='%s' type='%s'>"
+ "%s</message>\n" LOG_FOOTER, timestamp,
+ empathy_message_get_id (message),
+ contact_id, contact_name,
avatar_token ? avatar_token : "",
empathy_contact_is_user (sender) ? "true" : "false",
empathy_message_type_to_str (msg_type), body);
@@ -452,6 +454,8 @@
gchar *is_user_str;
gboolean is_user = FALSE;
gchar *msg_type_str;
+ gchar *cm_id_str;
+ guint cm_id;
TpChannelTextMessageType msg_type = TP_CHANNEL_TEXT_MESSAGE_TYPE_NORMAL;
if (strcmp (node->name, "message") != 0)
@@ -464,6 +468,7 @@
sender_avatar_token = xmlGetProp (node, "token");
is_user_str = xmlGetProp (node, "isuser");
msg_type_str = xmlGetProp (node, "type");
+ cm_id_str = xmlGetProp (node, "cm_id");
if (is_user_str)
is_user = strcmp (is_user_str, "true") == 0;
@@ -471,6 +476,9 @@
if (msg_type_str)
msg_type = empathy_message_type_from_str (msg_type_str);
+ if (cm_id_str)
+ sscanf (cm_id_str, "%d", &cm_id);
+
t = empathy_time_parse (time);
sender = empathy_contact_new_full (account, sender_id, sender_name);
@@ -484,6 +492,9 @@
empathy_message_set_timestamp (message, t);
empathy_message_set_tptype (message, msg_type);
+ if (cm_id_str)
+ empathy_message_set_id (message, cm_id);
+
messages = g_list_append (messages, message);
g_object_unref (sender);
@@ -493,6 +504,7 @@
xmlFree (body);
xmlFree (is_user_str);
xmlFree (msg_type_str);
+ xmlFree (cm_id_str);
}
DEBUG ("Parsed %d messages", g_list_length (messages));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]