![]() |
![]() |
![]() |
Mission Control Plugins Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Prerequisites |
#include <mission-control-plugins/mission-control-plugins.h> McpRequestPolicy; McpRequestPolicyIface; void mcp_request_policy_check (McpRequestPolicy *policy
,McpRequest *request
); void mcp_request_policy_iface_implement_check (McpRequestPolicyIface *iface
,void (implMcpRequestPolicy *, McpRequest *) ()
);
Plugins may implement McpRequestPolicy in order to apply policy to Telepathy channel requests passing through the Channel Dispatcher part of Mission Control. The plugins are run just after the requesting client calls the ChannelRequest.Proceed method, and can inspect the request, delay its processing, and/or make it fail.
To do so, the plugin must implement a GObject subclass that implements
McpRequestPolicy, then return an instance of that subclass from
mcp_plugin_ref_nth_object()
.
The contents of the McpRequestPolicyIface struct are not public, so to
provide an implementation of the check method,
plugins should call mcp_request_policy_iface_implement_check()
from the
interface initialization function, like this:
Example 2.
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_REQUEST_POLICY, request_policy_iface_init); G_IMPLEMENT_INTERFACE (...)) /* ... */ static void request_policy_iface_init (McpRequestPolicyIface *iface, gpointer unused G_GNUC_UNUSED) { mcp_request_policy_iface_implement_check (iface, my_plugin_check_request); } |
A single object can implement more than one interface; for instance, it may be useful to combine this interface with McpDispatchOperationPolicy.
void mcp_request_policy_check (McpRequestPolicy *policy
,McpRequest *request
);
Check what to do with a channel request. Implementations of this method
can use methods on request
to examine the request, delay
processing, make the request fail, etc. in order to impose whatever policy
the plugin requires.
Mission Control calls this function in each plugin just after the requesting client calls the Proceed method on the Telepathy ChannelRequest. If the plugin makes the request fail, this does not take effect until all plugins have been notified.
|
an implementation of this interface, provided by a plugin |
|
an object representing a channel request |
void mcp_request_policy_iface_implement_check (McpRequestPolicyIface *iface
,void (implMcpRequestPolicy *, McpRequest *) ()
);
|
the interface |