summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2013-09-30 12:33:05 +0200
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2013-10-01 15:45:21 +0200
commita7499229f98d9bf7ae8ce821bc73c00571ab0317 (patch)
tree50a0aa6b8c92f7fb6267b521d87853e7f7dda958
parent063582640d027315591f91399d2ce330372c7683 (diff)
downloadtelepathy-logger-a7499229f98d9bf7ae8ce821bc73c00571ab0317.tar.gz
support call end detail reason with old TP prefix
-rw-r--r--telepathy-logger/log-store-xml.c27
-rw-r--r--tests/logs/TpLogger/logs/gabble_jabber_user_40collabora_2eco_2euk/user4@collabora.co.uk/20100113.call.log3
2 files changed, 27 insertions, 3 deletions
diff --git a/telepathy-logger/log-store-xml.c b/telepathy-logger/log-store-xml.c
index ab269f3..9d56900 100644
--- a/telepathy-logger/log-store-xml.c
+++ b/telepathy-logger/log-store-xml.c
@@ -1147,6 +1147,29 @@ parse_text_node (TplLogStoreXml *self,
return event;
}
+static gchar *
+dup_detailed_reason (xmlNodePtr node)
+{
+ gchar *d, *result;
+ const gchar *old_tp_prefix = "org.freedesktop.Telepathy.Error";
+
+ d = (char *) xmlGetProp (node, (const xmlChar *) "detail");
+
+ /* Ensure log backward compatiblity if the reason is using the old (pre 1.0)
+ * Telepathy prefix. */
+ if (!g_str_has_prefix (d, old_tp_prefix))
+ {
+ result = g_strdup (d);
+ xmlFree (d);
+ return result;
+ }
+
+ result = g_strdup_printf ("%s.%s", TP_ERROR_PREFIX,
+ d + strlen (old_tp_prefix) + 1);
+
+ xmlFree (d);
+ return result;
+}
static TplEvent *
parse_call_node (TplLogStoreXml *self,
@@ -1189,7 +1212,7 @@ parse_call_node (TplLogStoreXml *self,
actor_avatar_token = (char *) xmlGetProp (node,
(const xmlChar *) "actortoken");
reason_str = (char *) xmlGetProp (node, (const xmlChar *) "reason");
- detailed_reason = (char *) xmlGetProp (node, (const xmlChar *) "detail");
+ detailed_reason = dup_detailed_reason (node);
if (is_user_str != NULL)
is_user = (!tp_strdiff (is_user_str, "true"));
@@ -1246,7 +1269,7 @@ parse_call_node (TplLogStoreXml *self,
xmlFree (actor_avatar_token);
xmlFree (duration_str);
xmlFree (reason_str);
- xmlFree (detailed_reason);
+ g_free (detailed_reason);
return event;
}
diff --git a/tests/logs/TpLogger/logs/gabble_jabber_user_40collabora_2eco_2euk/user4@collabora.co.uk/20100113.call.log b/tests/logs/TpLogger/logs/gabble_jabber_user_40collabora_2eco_2euk/user4@collabora.co.uk/20100113.call.log
index c5f65a5..dfb79cb 100644
--- a/tests/logs/TpLogger/logs/gabble_jabber_user_40collabora_2eco_2euk/user4@collabora.co.uk/20100113.call.log
+++ b/tests/logs/TpLogger/logs/gabble_jabber_user_40collabora_2eco_2euk/user4@collabora.co.uk/20100113.call.log
@@ -3,5 +3,6 @@
<log>
<call time='20100113T17:48:01' id='user@collabora.co.uk' name='Nicolas1' isuser='false' token='' duration='1' actor='user@collabora.co.uk' actortype='contact' actorname='User1' actortoken='' reason='user-requested' detail='im.telepathy1.Error.Cancelled' />
<call time='20100113T17:48:01' id='user@collabora.co.uk' name='Nicolas1' isuser='false' token='' duration='2' actor='user@collabora.co.uk' actortype='contact' actorname='User1' actortoken='' reason='user-requested' detail='im.telepathy1.Error.Cancelled' />
-<call time='20100113T17:48:01' id='user@collabora.co.uk' name='Nicolas1' isuser='false' token='' duration='3' actor='user@collabora.co.uk' actortype='contact' actorname='User1' actortoken='' reason='user-requested' detail='im.telepathy1.Error.Cancelled' />
+<!-- use the old Telepathy namespace for 'detail' to test backward compatibility -->
+<call time='20100113T17:48:01' id='user@collabora.co.uk' name='Nicolas1' isuser='false' token='' duration='3' actor='user@collabora.co.uk' actortype='contact' actorname='User1' actortoken='' reason='user-requested' detail='org.freedesktop.Telepathy.Error.Cancelled' />
</log>