telepathy-idle: MUCManager: move ChannelType check up
Jonny Lamb
jonny at kemper.freedesktop.org
Wed May 16 10:45:08 PDT 2012
Module: telepathy-idle
Branch: master
Commit: d8fb9480f7bb452eac31a9b0563d6340be0c226c
URL: http://cgit.freedesktop.org/telepathy/telepathy-idle/commit/?id=d8fb9480f7bb452eac31a9b0563d6340be0c226c
Author: Will Thompson <will.thompson at collabora.co.uk>
Date: Fri Sep 9 12:04:27 2011 +0100
MUCManager: move ChannelType check up
There's no reason for us to even look at the rest of the request if it's
not a request for a text channel.
---
src/idle-muc-manager.c | 58 ++++++++++++++++++++++-------------------------
1 files changed, 27 insertions(+), 31 deletions(-)
diff --git a/src/idle-muc-manager.c b/src/idle-muc-manager.c
index 04e318f..8300f89 100644
--- a/src/idle-muc-manager.c
+++ b/src/idle-muc-manager.c
@@ -741,6 +741,12 @@ _muc_manager_request (
const gchar *channel_type;
IdleMUCChannel *channel;
+ channel_type = tp_asv_get_string (request_properties,
+ TP_IFACE_CHANNEL ".ChannelType");
+
+ if (tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_TEXT))
+ return FALSE;
+
if (tp_asv_get_uint32 (request_properties,
TP_IFACE_CHANNEL ".TargetHandleType", NULL) != TP_HANDLE_TYPE_ROOM)
return FALSE;
@@ -751,48 +757,38 @@ _muc_manager_request (
if (!tp_handle_is_valid (room_repo, handle, &error))
goto error;
- channel_type = tp_asv_get_string (request_properties,
- TP_IFACE_CHANNEL ".ChannelType");
-
- if (!tp_strdiff (channel_type, TP_IFACE_CHANNEL_TYPE_TEXT))
- {
- if (tp_channel_manager_asv_has_unknown_properties (request_properties,
- muc_channel_fixed_properties, muc_channel_allowed_properties,
- &error))
- goto error;
+ if (tp_channel_manager_asv_has_unknown_properties (request_properties,
+ muc_channel_fixed_properties, muc_channel_allowed_properties,
+ &error))
+ goto error;
- channel = g_hash_table_lookup (priv->channels, GINT_TO_POINTER (handle));
+ channel = g_hash_table_lookup (priv->channels, GINT_TO_POINTER (handle));
- if (channel != NULL)
+ if (channel != NULL)
+ {
+ if (require_new)
{
- if (require_new)
- {
- g_set_error (&error, TP_ERROR, TP_ERROR_NOT_AVAILABLE,
- "That channel has already been created (or requested)");
- goto error;
- }
- else if (idle_muc_channel_is_ready (channel))
- {
- tp_channel_manager_emit_request_already_satisfied (self,
- request_token, TP_EXPORTABLE_CHANNEL (channel));
- return TRUE;
- }
+ g_set_error (&error, TP_ERROR, TP_ERROR_NOT_AVAILABLE,
+ "That channel has already been created (or requested)");
+ goto error;
}
- else
+ else if (idle_muc_channel_is_ready (channel))
{
- channel = _muc_manager_new_channel (self, handle, base_conn->self_handle, TRUE);
- idle_muc_channel_join_attempt (channel);
+ tp_channel_manager_emit_request_already_satisfied (self,
+ request_token, TP_EXPORTABLE_CHANNEL (channel));
+ return TRUE;
}
-
- associate_request (self, channel, request_token);
-
- return TRUE;
}
else
{
- return FALSE;
+ channel = _muc_manager_new_channel (self, handle, base_conn->self_handle, TRUE);
+ idle_muc_channel_join_attempt (channel);
}
+ associate_request (self, channel, request_token);
+
+ return TRUE;
+
error:
tp_channel_manager_emit_request_failed (self, request_token,
error->domain, error->code, error->message);
More information about the telepathy-commits
mailing list