aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-01-13 23:03:25 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-01-13 23:12:12 +0800
commitb980b235c35a6cd040d539da0f675d83d2356049 (patch)
treeeaddc28019876c347c08d03721df55e9b37e051f /libempathy-gtk
parente1f5315d0733134b9ce40a40c1e8ffe2c4eb78b1 (diff)
downloadgsoc2013-empathy-b980b235c35a6cd040d539da0f675d83d2356049.tar
gsoc2013-empathy-b980b235c35a6cd040d539da0f675d83d2356049.tar.gz
gsoc2013-empathy-b980b235c35a6cd040d539da0f675d83d2356049.tar.bz2
gsoc2013-empathy-b980b235c35a6cd040d539da0f675d83d2356049.tar.lz
gsoc2013-empathy-b980b235c35a6cd040d539da0f675d83d2356049.tar.xz
gsoc2013-empathy-b980b235c35a6cd040d539da0f675d83d2356049.tar.zst
gsoc2013-empathy-b980b235c35a6cd040d539da0f675d83d2356049.zip
be less restrictive regarding the Service format
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/empathy-irc-network-chooser.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/libempathy-gtk/empathy-irc-network-chooser.c b/libempathy-gtk/empathy-irc-network-chooser.c
index 0f147d887..74c9685e8 100644
--- a/libempathy-gtk/empathy-irc-network-chooser.c
+++ b/libempathy-gtk/empathy-irc-network-chooser.c
@@ -121,29 +121,35 @@ unset_server_params (EmpathyIrcNetworkChooser *self)
static gchar *
dup_network_service (EmpathyIrcNetwork *network)
{
- /* Account.Service follows the same restriction as CM.Protocol
- * http://telepathy.freedesktop.org/spec/Connection_Manager.html#Simple-Type:Protocol
- */
-#define VALID G_CSET_a_2_z G_CSET_A_2_Z G_CSET_DIGITS
- gchar *service;
- gchar *result = NULL;
+ /* Account.Service has to be a lower case alphanumeric string which may
+ * also contain '-' but not start with it. */
+#define VALID G_CSET_a_2_z G_CSET_DIGITS "-"
+ gchar *service, *tmp;
service = g_strdup (empathy_irc_network_get_name (network));
service = g_strstrip (service);
- /* Service has to start with a letter */
- if (!g_ascii_isalpha (service[0]))
+ if (tp_str_empty (service))
{
g_free (service);
return NULL;
}
+ tmp = service;
+ service = g_ascii_strdown (service, -1);
+ g_free (tmp);
+
service = g_strcanon (service, VALID, '-');
- result = g_ascii_strdown (service, -1);
- g_free (service);
+ if (service[0] == '-')
+ {
+ tmp = service;
+ service = g_strdup (service + 1);
+
+ g_free (tmp);
+ }
- return result;
+ return service;
}
static void