aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy
diff options
context:
space:
mode:
authorSjoerd Simons <sjoerd.simons@collabora.co.uk>2009-07-22 01:02:47 +0800
committerSjoerd Simons <sjoerd.simons@collabora.co.uk>2009-07-22 01:02:47 +0800
commit7ba6375cdfa00bc0871e4958076398e82f92c2b5 (patch)
treebc75843c938ee8d777176d63f85ef9d22f5892bb /libempathy
parente24b064cc562a89abf8facba5b9085d4aee862ed (diff)
downloadgsoc2013-empathy-7ba6375cdfa00bc0871e4958076398e82f92c2b5.tar
gsoc2013-empathy-7ba6375cdfa00bc0871e4958076398e82f92c2b5.tar.gz
gsoc2013-empathy-7ba6375cdfa00bc0871e4958076398e82f92c2b5.tar.bz2
gsoc2013-empathy-7ba6375cdfa00bc0871e4958076398e82f92c2b5.tar.lz
gsoc2013-empathy-7ba6375cdfa00bc0871e4958076398e82f92c2b5.tar.xz
gsoc2013-empathy-7ba6375cdfa00bc0871e4958076398e82f92c2b5.tar.zst
gsoc2013-empathy-7ba6375cdfa00bc0871e4958076398e82f92c2b5.zip
Unescape _ and _2d in the protocol from mission-control
Diffstat (limited to 'libempathy')
-rw-r--r--libempathy/empathy-account.c39
1 files changed, 38 insertions, 1 deletions
diff --git a/libempathy/empathy-account.c b/libempathy/empathy-account.c
index 21ece6f0d..4cd96e393 100644
--- a/libempathy/empathy-account.c
+++ b/libempathy/empathy-account.c
@@ -345,6 +345,41 @@ empathy_account_got_all_cb (TpProxy *proxy,
empathy_account_update (account, properties);
}
+static gchar *
+empathy_account_unescape_protocol (const gchar *protocol, gssize len)
+{
+ gchar *result, *escape;
+ /* Bad implementation might accidentally use tp_escape_as_identifier,
+ * which escapes - in the wrong way... */
+ if ((escape = g_strstr_len (protocol, len, "_2d")) != NULL)
+ {
+ GString *str;
+ const gchar *input;
+
+ str = g_string_new ("");
+ input = protocol;
+ do {
+ g_string_append_len (str, input, escape - input);
+ g_string_append_c (str, '-');
+
+ len -= escape - input + 3;
+ input = escape + 3;
+ } while ((escape = g_strstr_len (input, len, "_2d")) != NULL);
+
+ g_string_append_len (str, input, len);
+
+ result = g_string_free (str, FALSE);
+ }
+ else
+ {
+ result = g_strndup (protocol, len);
+ }
+
+ g_strdelimit (result, "_", '-');
+
+ return result;
+}
+
static gboolean
empathy_account_parse_unique_name (const gchar *bus_name,
gchar **protocol, gchar **manager)
@@ -375,7 +410,9 @@ empathy_account_parse_unique_name (const gchar *bus_name,
return FALSE;
if (protocol != NULL)
- *protocol = g_strndup (proto, proto_end - proto);
+ {
+ *protocol = empathy_account_unescape_protocol (proto, proto_end - proto);
+ }
if (manager != NULL)
*manager = g_strndup (cm, cm_end - cm);