summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Becker <stefan.becker@nokia.com>2010-06-10 19:48:12 +0300
committerWill Thompson <will.thompson@collabora.co.uk>2010-06-11 09:53:21 +0100
commitf0dd110cc1acd264fc5e3ca33a0ee51f6a27156a (patch)
tree81ecf02369e7264275080c505a8015f347620d34
parentfc9e9a6b91d3c477cf098a274d6adbc038d22c8b (diff)
downloadtelepathy-haze-f0dd110cc1acd264fc5e3ca33a0ee51f6a27156a.tar.gz
connection(-manager): PurpleAccountUserSplits should be optional parameters
Not all users will have to fill the additional fields, e.g. for SIPE your username (= account) can also be used for authentication. Make the fields optional and use the default contents provided by Purple if the user leaves them empty.
-rw-r--r--src/connection-manager.c2
-rw-r--r--src/connection.c17
2 files changed, 13 insertions, 6 deletions
diff --git a/src/connection-manager.c b/src/connection-manager.c
index c1b3dd6..c126d3d 100644
--- a/src/connection-manager.c
+++ b/src/connection-manager.c
@@ -202,7 +202,7 @@ _translate_protocol_usersplits (HazeProtocolInfo *hpi,
NULL, /* name */
DBUS_TYPE_STRING_AS_STRING,
G_TYPE_STRING,
- TP_CONN_MGR_PARAM_FLAG_REQUIRED,
+ 0,
NULL, 0, NULL, NULL,
NULL, /* setter_data */
NULL
diff --git a/src/connection.c b/src/connection.c
index 9753ae4..93f8eba 100644
--- a/src/connection.c
+++ b/src/connection.c
@@ -269,13 +269,20 @@ _haze_connection_get_username (GHashTable *params,
gchar *param_name = g_strdup_printf ("usersplit%d", i);
GValue *value = g_hash_table_lookup (params, param_name);
- /* tp-glib should guarantee that this is present and a string. */
- g_assert (value != NULL);
- g_assert (G_VALUE_TYPE (value) == G_TYPE_STRING);
-
g_string_append_c (string,
purple_account_user_split_get_separator (split));
- g_string_append (string, g_value_get_string (value));
+
+ if (value != NULL)
+ {
+ /* tp-glib should guarantee that this is a string. */
+ g_assert (G_VALUE_TYPE (value) == G_TYPE_STRING);
+ g_string_append (string, g_value_get_string (value));
+ }
+ else
+ {
+ g_string_append (string,
+ purple_account_user_split_get_default_value(split));
+ }
g_hash_table_remove (params, param_name);
g_free (param_name);