summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVivek Dasmohapatra <vivek@collabora.co.uk>2011-03-21 18:08:45 +0000
committerVivek Dasmohapatra <vivek@collabora.co.uk>2011-04-05 14:19:10 +0100
commit66c6dcfbc51a541da10e07d306b6ba300fd9fc7e (patch)
treeed7f93cad0af34573edda4914904d126dd8bcde0
parentf5dc7b9af212d5a4e495ebd5c433ea9d12e4e2d4 (diff)
downloadtelepathy-mission-control-66c6dcfbc51a541da10e07d306b6ba300fd9fc7e.tar.gz
If a new channel results from an internal request, invoke its callback
The usual approvers/observers logic is followed, to preserve as much normal channel behaviour as possible.
-rw-r--r--src/mcd-dispatch-operation.c41
1 files changed, 34 insertions, 7 deletions
diff --git a/src/mcd-dispatch-operation.c b/src/mcd-dispatch-operation.c
index 05bbcb7a..46358748 100644
--- a/src/mcd-dispatch-operation.c
+++ b/src/mcd-dispatch-operation.c
@@ -1722,7 +1722,8 @@ _mcd_dispatch_operation_handlers_can_bypass_approval (
}
/* If no handler still exists, we don't bypass approval, although if that
- * happens we're basically doomed anyway. */
+ * happens we're basically doomed anyway. (unless this is an internal
+ * request, in which case we should be ok) */
return FALSE;
}
@@ -2139,6 +2140,7 @@ _mcd_dispatch_operation_run_clients (McdDispatchOperation *self)
if (self->priv->channels != NULL)
{
const GList *mini_plugins;
+ gchar **possible_handlers = self->priv->possible_handlers;
if (_mcd_dispatch_operation_handlers_can_bypass_observers (self))
{
@@ -2150,14 +2152,39 @@ _mcd_dispatch_operation_run_clients (McdDispatchOperation *self)
_mcd_dispatch_operation_run_observers (self);
}
- for (mini_plugins = mcp_list_objects ();
- mini_plugins != NULL;
- mini_plugins = mini_plugins->next)
+ /* internally generated/handled requests are not subject to policy */
+ if (possible_handlers != NULL && tp_str_empty (*possible_handlers))
{
- if (MCP_IS_DISPATCH_OPERATION_POLICY (mini_plugins->data))
+ guint i = 0;
+ GList *list = self->priv->channels;
+
+ DEBUG ("Invoking internal handlers for requests");
+
+ for (; list != NULL; list = g_list_next (list))
{
- mcp_dispatch_operation_policy_check (mini_plugins->data,
- MCP_DISPATCH_OPERATION (self->priv->plugin_api));
+ McdChannel *channel = list->data;
+ McdRequest *request = _mcd_channel_get_request (channel);
+
+ if (request != NULL)
+ {
+ DEBUG ("Internal handler for request channel #%u", i);
+ _mcd_request_handle_internally (request, channel, TRUE);
+ }
+
+ i++;
+ }
+ }
+ else
+ {
+ for (mini_plugins = mcp_list_objects ();
+ mini_plugins != NULL;
+ mini_plugins = mini_plugins->next)
+ {
+ if (MCP_IS_DISPATCH_OPERATION_POLICY (mini_plugins->data))
+ {
+ mcp_dispatch_operation_policy_check (mini_plugins->data,
+ MCP_DISPATCH_OPERATION (self->priv->plugin_api));
+ }
}
}
}