diff options
author | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2009-11-19 23:55:48 +0000 |
---|---|---|
committer | Jonny Lamb <jonny.lamb@collabora.co.uk> | 2009-11-23 17:46:55 +0000 |
commit | 0a8be4f699fb3cadfe4d6e74cfd5f86942aa5d8a (patch) | |
tree | 6448e388436f0b6d4ca127ccdaa702ee071825d1 /src | |
parent | 2e2a062f8548ea3d88153d68fc62cdaba33fbb7e (diff) |
util: allow GabbleConnection to be NULL in _normalize_room
The handle test, test-handles, has no connection, but calls this
function.
Signed-off-by: Jonny Lamb <jonny.lamb@collabora.co.uk>
Diffstat (limited to 'src')
-rw-r--r-- | src/util.c | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/src/util.c b/src/util.c index bf6f9f4ef..351bacda1 100644 --- a/src/util.c +++ b/src/util.c @@ -415,18 +415,28 @@ gabble_normalize_room (TpHandleRepoIface *repo, gpointer context, GError **error) { - GabbleConnection *conn = GABBLE_CONNECTION (context); + GabbleConnection *conn; gchar *qualified_name, *resource; - qualified_name = gabble_connection_get_canonical_room_name (conn, jid); + /* Only look up the canonical room name if we got a GabbleConnection. + * This should only happen in the test-handles test. */ + if (context != NULL) + { + conn = GABBLE_CONNECTION (context); + qualified_name = gabble_connection_get_canonical_room_name (conn, jid); - if (qualified_name == NULL) + 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; + } + } + else { - 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; + qualified_name = g_strdup (jid); } if (!gabble_decode_jid (qualified_name, NULL, NULL, &resource)) |