summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Thompson <will.thompson@collabora.co.uk>2010-07-10 01:57:59 +0100
committerWill Thompson <will.thompson@collabora.co.uk>2010-07-10 01:57:59 +0100
commit724c435d8cbe2a82f3d07c1a5188f5a8ddcda429 (patch)
tree313b1ae1e3ded2419efd90170c5f9a9a6d94f713
parent2f95a521d64460a6d81e1d764f040961fb52b027 (diff)
Expose ports as uint16 not int32.
This shouldn't actually break existing accounts, because MC doesn't store parameter types, only their values. (If you stored a really big int32 as a port number ... well, then your account was invalid. :)) Fixes <https://bugs.freedesktop.org/show_bug.cgi?id=23702>.
-rw-r--r--src/connection-manager.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/connection-manager.c b/src/connection-manager.c
index c126d3d..b711fd3 100644
--- a/src/connection-manager.c
+++ b/src/connection-manager.c
@@ -266,8 +266,22 @@ _translate_protocol_option (PurpleAccountOption *option,
purple_account_option_get_default_bool (option));
break;
case PURPLE_PREF_INT:
- paramspec->dtype = DBUS_TYPE_INT32_AS_STRING;
- paramspec->gtype = G_TYPE_INT;
+ /* The spec decrees that ports should be uint16, and people get
+ * very upset if they're not. I suppose technically there could be
+ * int parameters whose names end in "port" which aren't meant to
+ * be unsigned?
+ */
+ if (g_str_has_suffix (name, "port"))
+ {
+ paramspec->dtype = DBUS_TYPE_UINT16_AS_STRING;
+ paramspec->gtype = G_TYPE_UINT;
+ }
+ else
+ {
+ paramspec->dtype = DBUS_TYPE_INT32_AS_STRING;
+ paramspec->gtype = G_TYPE_INT;
+ }
+
paramspec->flags |= TP_CONN_MGR_PARAM_FLAG_HAS_DEFAULT;
paramspec->def = GINT_TO_POINTER (
purple_account_option_get_default_int (option));