summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRobert McQueen <robert.mcqueen@collabora.co.uk>2007-03-26 20:37:41 +0000
committerRobert McQueen <robert.mcqueen@collabora.co.uk>2007-03-26 20:37:41 +0000
commit02f325646e6ec0d77a4ed2efbe3595a70eff824c (patch)
tree7b2760c6c4f2896b2f72ad09df8f982cd6dd01c9 /src
parent991b884b42f99abf3f328385f6f21680ee8beaa5 (diff)
fix disco callback for obsolete MUC invites so that it doesn't have any paths where it leaks the data structure, and uses the shared do_invite function
Diffstat (limited to 'src')
-rw-r--r--src/muc-factory.c54
1 files changed, 18 insertions, 36 deletions
diff --git a/src/muc-factory.c b/src/muc-factory.c
index 8f3ac1f2..3b98079a 100644
--- a/src/muc-factory.c
+++ b/src/muc-factory.c
@@ -372,55 +372,37 @@ obsolete_invite_disco_cb (GabbleDisco *self,
GabbleMucFactoryPrivate *priv = GABBLE_MUC_FACTORY_GET_PRIVATE (fac);
TpHandleRepoIface *contact_repo = tp_base_connection_get_handles (
(TpBaseConnection *)priv->conn, TP_HANDLE_TYPE_CONTACT);
- TpHandleRepoIface *room_repo = tp_base_connection_get_handles (
- (TpBaseConnection *)priv->conn, TP_HANDLE_TYPE_ROOM);
LmMessageNode *identity;
- const char *category, *type;
- TpHandle handle;
+ const char *category = NULL, *type = NULL;
g_hash_table_remove (priv->disco_requests, request);
- identity = lm_message_node_get_child (query_result, "identity");
- if (NULL == identity)
- return;
-
- category = lm_message_node_get_attribute (identity, "category");
- if (NULL == category)
- return;
-
- type = lm_message_node_get_attribute (identity, "type");
- if (NULL == type)
- return;
-
- if (0 != strcmp (category, "conference") ||
- 0 != strcmp (type, "text"))
+ if (error != NULL)
{
- DEBUG ("obsolete invite request specified inappropriate jid '%s' "
- "(not a text conference), ignoring", jid);
- return;
+ DEBUG ("ignoring obsolete invite to room '%s'; got disco error: %s",
+ jid, error->message);
+ goto out;
}
- /* OK, it's MUC after all, create a new channel */
- handle = tp_handle_ensure (room_repo, jid, NULL, NULL);
- if (handle == 0)
+ identity = lm_message_node_get_child (query_result, "identity");
+ if (identity != NULL)
{
- DEBUG ("obsolete invite request specified invalid jid '%s', "
- "ignoring", jid);
- return;
+ category = lm_message_node_get_attribute (identity, "category");
+ type = lm_message_node_get_attribute (identity, "type");
}
- if (g_hash_table_lookup (priv->channels, GINT_TO_POINTER (handle)) == NULL)
- {
- GabbleMucChannel *chan;
- chan = new_muc_channel (fac, handle, FALSE);
- _gabble_muc_channel_handle_invited (chan, data->inviter, data->reason);
- }
- else
+ if (tp_strdiff (category, "conference") ||
+ tp_strdiff (type, "text"))
{
- DEBUG ("ignoring invite to a room '%s' we're already in", jid);
+ DEBUG ("obsolete invite request specified inappropriate jid '%s' "
+ "(not a text conference); ignoring request", jid);
+ goto out;
}
- tp_handle_unref (room_repo, handle);
+ /* OK, it's MUC after all, create a new channel */
+ do_invite (fac, jid, data->inviter, data->reason);
+
+out:
tp_handle_unref (contact_repo, data->inviter);
g_free (data->reason);
g_slice_free (struct DiscoInviteData, data);