diff options
author | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2009-10-01 18:01:32 +0100 |
---|---|---|
committer | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2009-11-23 17:46:24 +0000 |
commit | 557d0de3b6670e05e3ec662104db876dbbb9e9ad (patch) | |
tree | d4bc5fe99cac4445c2d51c0011aa7b041baab9cc /src | |
parent | 3095e0dee4d5ff525337363d00c0c9507d20a2ff (diff) |
fd.o#22456: util: get the canonical room name in gabble_normalize_room
This means that both RequestHandles and the TargetID property set
during a call to CreateChannel will use the canonical room
name. Previously, it only ever did this in a RequestHandles call.
Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
Diffstat (limited to 'src')
-rw-r--r-- | src/connection.c | 2 | ||||
-rw-r--r-- | src/util.c | 36 |
2 files changed, 27 insertions, 11 deletions
diff --git a/src/connection.c b/src/connection.c index 5c4a23e3a..b42554a11 100644 --- a/src/connection.c +++ b/src/connection.c @@ -657,7 +657,7 @@ _gabble_connection_create_handle_repos (TpBaseConnection *conn, gabble_normalize_contact, GUINT_TO_POINTER (GABBLE_JID_ANY)); repos[TP_HANDLE_TYPE_ROOM] = tp_dynamic_handle_repo_new (TP_HANDLE_TYPE_ROOM, gabble_normalize_room, - NULL); + conn); repos[TP_HANDLE_TYPE_GROUP] = tp_dynamic_handle_repo_new (TP_HANDLE_TYPE_GROUP, NULL, NULL); repos[TP_HANDLE_TYPE_LIST] = diff --git a/src/util.c b/src/util.c index d22844d42..64c1bb57e 100644 --- a/src/util.c +++ b/src/util.c @@ -415,20 +415,37 @@ gabble_normalize_room (TpHandleRepoIface *repo, gpointer context, GError **error) { - char *at = strchr (jid, '@'); - char *slash = strchr (jid, '/'); + GabbleConnection *conn = GABBLE_CONNECTION (context); + gchar *at, *slash, *qualified_name; + + qualified_name = gabble_connection_get_canonical_room_name (conn, jid); + + if (qualified_name == NULL) + { + INVALID_HANDLE (error, + "requested room handle %s does not specify a server, but we " + "have not discovered any local conference servers and no " + "fallback was provided", jid); + return NULL; + } + + at = strchr (qualified_name, '@'); + slash = strchr (qualified_name, '/'); /* there'd better be an @ somewhere after the first character */ if (at == NULL) { INVALID_HANDLE (error, - "invalid room JID %s: does not contain '@'", jid); + "invalid room JID %s: does not contain '@'", qualified_name); + g_free (qualified_name); return NULL; } - if (at == jid) + if (at == qualified_name) { INVALID_HANDLE (error, - "invalid room JID %s: room name before '@' may not be empty", jid); + "invalid room JID %s: room name before '@' may not be empty", + qualified_name); + g_free (qualified_name); return NULL; } @@ -436,14 +453,13 @@ gabble_normalize_room (TpHandleRepoIface *repo, if (slash != NULL) { INVALID_HANDLE (error, - "invalid room JID %s: contains nickname part after '/' too", jid); + "invalid room JID %s: contains nickname part after '/' too", + qualified_name); + g_free (qualified_name); return NULL; } - /* the room and service parts are both case-insensitive, so lowercase - * them both; gabble_decode_jid is overkill here - */ - return g_utf8_strdown (jid, -1); + return qualified_name; } gchar * |