![]() |
![]() |
![]() |
Mission Control Plugins Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Prerequisites |
McpDispatchOperationPolicyMcpDispatchOperationPolicy — Dispatch Operation policy object, implemented by plugins |
#include <mission-control-plugins/mission-control-plugins.h> McpDispatchOperationPolicy; McpDispatchOperationPolicyIface; void mcp_dispatch_operation_policy_check (McpDispatchOperationPolicy *policy
,McpDispatchOperation *dispatch_operation
); void mcp_dispatch_operation_policy_iface_implement_check (McpDispatchOperationPolicyIface *iface
,void (implMcpDispatchOperationPolicy *, McpDispatchOperation *) ()
);
Plugins may implement McpDispatchOperationPolicy in order to apply policy to Telepathy channel dispatch operations passing through the Channel Dispatcher part of Mission Control. This interface behaves rather like the Observer clients in the Telepathy specification, and has access to the same information, but runs within the Mission Control process rather than being invoked over D-Bus.
To do so, the plugin must implement a GObject subclass that implements
McpDispatchOperationPolicy, then return an instance of that subclass from
mcp_plugin_ref_nth_object()
.
The contents of the McpDispatchOperationPolicyIface struct are not public,
so to provide an implementation of the check method,
plugins should call mcp_dispatch_operation_policy_iface_implement_check()
from the interface initialization function, like this:
Example 3.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
G_DEFINE_TYPE_WITH_CODE (MyPlugin, my_plugin, G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE (...); G_IMPLEMENT_INTERFACE (MCP_TYPE_DISPATCH_OPERATION_POLICY, cdo_policy_iface_init); G_IMPLEMENT_INTERFACE (...)) /* ... */ static void cdo_policy_iface_init (McpDispatchOperationPolicyIface *iface, gpointer unused G_GNUC_UNUSED) { mcp_dispatch_operation_policy_iface_implement_check (iface, my_plugin_check_cdo); } |
A single object can implement more than one interface; for instance, it may be useful to combine this interface with McpRequestPolicy.
typedef struct _McpDispatchOperationPolicyIface McpDispatchOperationPolicyIface;
void mcp_dispatch_operation_policy_check (McpDispatchOperationPolicy *policy
,McpDispatchOperation *dispatch_operation
);
Check what to do with a bundle of channels. Implementations of this method
can use methods on dispatch_operation
to examine the channels, delay
dispatching, close the channels, etc. in order to impose whatever policy
the plugin requires.
Mission Control calls this function in each plugin after invoking Observers, but before Approvers, and without waiting for Observers to reply.
|
an implementation of this interface, provided by a plugin |
|
an object representing a dispatch operation, i.e. a bundle of channels being dispatched |
void mcp_dispatch_operation_policy_iface_implement_check (McpDispatchOperationPolicyIface *iface
,void (implMcpDispatchOperationPolicy *, McpDispatchOperation *) ()
);
|
the interface |