aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-01-13 21:57:00 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-01-13 22:14:26 +0800
commit362f0f152b4c84e0b0cb7a46ecc4a7386fea1726 (patch)
treed8ae4d48840ed2d17d2e4152169b2d7928a8333c /libempathy-gtk
parent2a7fa12bcf9c0ee5a9ff506bc88af2194990dabc (diff)
downloadgsoc2013-empathy-362f0f152b4c84e0b0cb7a46ecc4a7386fea1726.tar
gsoc2013-empathy-362f0f152b4c84e0b0cb7a46ecc4a7386fea1726.tar.gz
gsoc2013-empathy-362f0f152b4c84e0b0cb7a46ecc4a7386fea1726.tar.bz2
gsoc2013-empathy-362f0f152b4c84e0b0cb7a46ecc4a7386fea1726.tar.lz
gsoc2013-empathy-362f0f152b4c84e0b0cb7a46ecc4a7386fea1726.tar.xz
gsoc2013-empathy-362f0f152b4c84e0b0cb7a46ecc4a7386fea1726.tar.zst
gsoc2013-empathy-362f0f152b4c84e0b0cb7a46ecc4a7386fea1726.zip
irc-network-chooser: set the account service
https://bugzilla.gnome.org/show_bug.cgi?id=667791
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/empathy-irc-network-chooser.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/libempathy-gtk/empathy-irc-network-chooser.c b/libempathy-gtk/empathy-irc-network-chooser.c
index 7a6bd7898..0f147d887 100644
--- a/libempathy-gtk/empathy-irc-network-chooser.c
+++ b/libempathy-gtk/empathy-irc-network-chooser.c
@@ -118,6 +118,34 @@ unset_server_params (EmpathyIrcNetworkChooser *self)
empathy_account_settings_unset (priv->settings, "use-ssl");
}
+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;
+
+ 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]))
+ {
+ g_free (service);
+ return NULL;
+ }
+
+ service = g_strcanon (service, VALID, '-');
+
+ result = g_ascii_strdown (service, -1);
+ g_free (service);
+
+ return result;
+}
+
static void
update_server_params (EmpathyIrcNetworkChooser *self)
{
@@ -139,6 +167,7 @@ update_server_params (EmpathyIrcNetworkChooser *self)
gchar *address;
guint port;
gboolean ssl;
+ gchar *service;
g_object_get (server,
"address", &address,
@@ -153,7 +182,13 @@ update_server_params (EmpathyIrcNetworkChooser *self)
DEBUG ("Setting use-ssl to %s", ssl ? "TRUE": "FALSE" );
empathy_account_settings_set_boolean (priv->settings, "use-ssl", ssl);
+ /* Set Account.Service */
+ service = dup_network_service (priv->network);
+ DEBUG ("Setting Service to %s", service);
+ empathy_account_settings_set_service (priv->settings, service);
+
g_free (address);
+ g_free (service);
}
else
{