Sun Feb 17 12:40:14 GMT 2008 Will Thompson * Reject server parameters which are blank or contain spaces diff -rN -u old-telepathy-haze.upstream/src/connection-manager.c new-telepathy-haze.upstream/src/connection-manager.c --- old-telepathy-haze.upstream/src/connection-manager.c 2008-02-27 01:03:40.000000000 +0000 +++ new-telepathy-haze.upstream/src/connection-manager.c 2008-02-27 01:03:40.000000000 +0000 @@ -104,6 +104,32 @@ g_hash_table_insert (params, prpl_param_name, value_copy); } +static gboolean +_param_filter_no_blanks (const TpCMParamSpec *paramspec, + GValue *value, + GError **error) +{ + const gchar *str = g_value_get_string (value); + + if (*str == '\0') + { + g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT, + "Account parameter '%s' must not be empty", + paramspec->name); + return FALSE; + } + + if (strstr (str, " ") != NULL) + { + g_set_error (error, TP_ERRORS, TP_ERROR_INVALID_ARGUMENT, + "Account parameter '%s' may not contain spaces", + paramspec->name); + return FALSE; + } + + return TRUE; +} + /* Populates a TpCMParamSpec from a PurpleAccountOption, possibly renaming the * parameter as specified in parameter_map. paramspec is assumed to be zeroed out. * Returns TRUE on success, and FALSE if paramspec could not be populated (and @@ -179,6 +205,9 @@ return FALSE; } + if (g_str_equal (paramspec->name, "server")) + paramspec->filter = _param_filter_no_blanks; + return TRUE; }