McpRequestPolicy

McpRequestPolicy — Request-policy object, implemented by plugins

Functions

Object Hierarchy

    GInterface
    ╰── McpRequestPolicy

Includes

#include <mission-control-plugins/mission-control-plugins.h>

Description

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().

An implementation of this plugin might look like this:

Example 2. 

1
2
3
4
5
6
7
8
9
10
11
12
13
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)
{
  iface->check = 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.

Functions

McpRequestPolicyCb ()

void
(*McpRequestPolicyCb) (McpRequestPolicy *policy,
                       McpRequest *request);

Signature of an implementation of mcp_request_policy_check().

Parameters

policy

an implementation of this interface, provided by a plugin

 

request

an object representing a channel request

 

mcp_request_policy_check ()

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.

Parameters

policy

an implementation of this interface, provided by a plugin

 

request

an object representing a channel request

 

mcp_request_policy_iface_implement_check ()

void
mcp_request_policy_iface_implement_check
                               (McpRequestPolicyIface *iface,
                                void (*impl) (McpRequestPolicy *, McpRequest *));

This function is no longer needed, since McpRequestPolicyIface is now public API. Use "iface->check = impl" instead.

Parameters

iface

the interface

 

impl

an implementation of the virtual method mcp_request_policy_check()

 

Types and Values

See Also

McpRequest