## TpChannelRequest

TpChannelRequest — proxy object for a request to the Telepathy channel dispatcher

## Functions

TpChannelRequest * | tp_channel_request_new ()
void | tp_channel_request_init_known_interfaces ()
void | tp_channel_request_set_channel_factory ()
const GHashTable * | tp_channel_request_get_immutable_properties ()
GVariant * | tp_channel_request_dup_immutable_properties ()
TpAccount * | tp_channel_request_get_account ()
gint64 | tp_channel_request_get_user_action_time ()
const gchar * | tp_channel_request_get_preferred_handler ()
const GHashTable * | tp_channel_request_get_hints ()
GVariant * | tp_channel_request_dup_hints ()
void | (*tp_cli_channel_request_callback_for_cancel) ()
TpProxyPendingCall * | tp_cli_channel_request_call_cancel ()
void | (*tp_cli_channel_request_callback_for_proceed) ()
TpProxyPendingCall * | tp_cli_channel_request_call_proceed ()
void | (*tp_cli_channel_request_signal_callback_failed) ()
TpProxySignalConnection * | tp_cli_channel_request_connect_to_failed ()
void | (*tp_cli_channel_request_signal_callback_succeeded) ()
TpProxySignalConnection * | tp_cli_channel_request_connect_to_succeeded ()
void | (*tp_cli_channel_request_signal_callback_succeeded_with_channel) ()
TpProxySignalConnection * | tp_cli_channel_request_connect_to_succeeded_with_channel ()

## Properties

TpAccount * | account | Read
GObject * | channel-factory | Read / Write / Construct
GHashTable_gchararray+GValue_* | hints | Read
GVariant * | hints-vardict | Read
GHashTable_gchararray+GValue_* | immutable-properties | Read / Write / Construct Only
GVariant * | immutable-properties-vardict | Read
gchar * | preferred-handler | Read
gint64 | user-action-time | Read

## Signals

void | succeeded | Has Details
void | succeeded-with-channel | Has Details

## Types and Values

struct | TpChannelRequest
struct | TpChannelRequestClass

## Object Hierarchy

        GObject
        ╰── TpProxy
            ╰── TpChannelRequest

## Includes

    #include <telepathy-glib/telepathy-glib.h>

## Description

Requesting a channel from the channel dispatcher can take some time, so an object is created in the channel dispatcher to represent each request. Objects of the TpChannelRequest class provide access to one of those objects.

## Functions

### tp_channel_request_new ()

    TpChannelRequest *
    tp_channel_request_new (TpDBusDaemon *bus_daemon,
                            const gchar *object_path,
                            GHashTable *immutable_properties,
                            GError **error);

`tp_channel_request_new` is deprecated and should not be used in newly-written code.

Since 0.19.9. New code should get TpChannelRequest objects from a TpBaseClient

Convenience function to create a new channel request proxy.

If the channel request was newly created, the client making the request is responsible for calling `tp_cli_channel_request_call_proceed()` when it is ready for the channel request to proceed.

#### Parameters

bus_daemon | Proxy for the D-Bus daemon |
object_path | The non-NULL object path of this channel request |
immutable_properties | As many as are known of the immutable D-Bus properties of this channel request, or `NULL` if none are known |
error | Used to raise an error if `NULL` is returned |

#### Returns

a new reference to an channel request proxy, or `NULL` if `object_path` is not syntactically valid or the channel dispatcher is not running

### tp_channel_request_init_known_interfaces ()

    void
    tp_channel_request_init_known_interfaces
                                   (void);

Ensure that the known interfaces for TpChannelRequest have been set up. This is done automatically when necessary, but for correct overriding of library interfaces by local extensions, you should call this function before calling `tp_proxy_or_subclass_hook_on_interface_add()` with first argument `TP_TYPE_CHANNEL_REQUEST`.

Since: 0.7.32

### tp_channel_request_set_channel_factory ()

    void
    tp_channel_request_set_channel_factory
                                   (TpChannelRequest *self,
                                    TpClientChannelFactory *factory);

`tp_channel_request_set_channel_factory` is deprecated and should not be used in newly-written code.

since 0.15.5. Use “factory” instead.

Change the value of the “channel-factory” property.

#### Parameters

self | a TpChannelRequest |
factory | an object implementing the TpClientChannelFactoryInterface interface |

Since: 0.13.14

### tp_channel_request_get_immutable_properties ()

    const GHashTable *
    tp_channel_request_get_immutable_properties
                                   (TpChannelRequest *self);

Return the “immutable-properties” construct-only property

#### Parameters

self | a TpChannelRequest |

#### Returns

the value of “immutable-properties”.

[transfer none]

Since: 0.13.14

### tp_channel_request_dup_immutable_properties ()

    GVariant *
    tp_channel_request_dup_immutable_properties
                                   (TpChannelRequest *self);

Return the “immutable-properties-vardict” property.

#### Parameters

self | a TpChannelRequest |

#### Returns

the value of “immutable-properties-vardict”.

[transfer full]

Since: 0.19.10

### tp_channel_request_get_account ()

    TpAccount *
    tp_channel_request_get_account (TpChannelRequest *self);

Return the value of the “account” construct-only property

#### Parameters

self | a tpchannelrequest |

#### Returns

the value of “account”.

[transfer none]

Since: 0.15.3

### tp_channel_request_get_user_action_time ()

    gint64
    tp_channel_request_get_user_action_time
                                   (TpChannelRequest *self);

return the “user-action-time” construct-only property

#### Parameters

self | a tpchannelrequest |

#### Returns

the value of “user-action-time”

Since: 0.15.3

### tp_channel_request_get_preferred_handler ()

    const gchar *
    tp_channel_request_get_preferred_handler
                                   (TpChannelRequest *self);

return the “preferred-handler” construct-only property

#### Parameters

self | a tpchannelrequest |

#### Returns

the value of “preferred-handler”

Since: 0.15.3

### tp_channel_request_get_hints ()

    const GHashTable *
    tp_channel_request_get_hints (TpChannelRequest *self);

Return the “hints” property

#### Parameters

self | a TpChannelRequest |

#### Returns

the value of “hints”.

[transfer none]

Since: 0.13.14

### tp_channel_request_dup_hints ()

    GVariant *
    tp_channel_request_dup_hints (TpChannelRequest *self);

Return the “hints-vardict” property

#### Parameters

self | a TpChannelRequest |

#### Returns

the value of “hints-vardict”.

[transfer full]

Since: 0.19.10

### tp_cli_channel_request_callback_for_cancel ()

    void
    (*tp_cli_channel_request_callback_for_cancel)
                                   (TpChannelRequest *proxy,
                                    const GError *error,
                                    gpointer user_data,
                                    GObject *weak_object);

Signature of the callback called when a Cancel method call succeeds or fails.

#### Parameters

proxy | the proxy on which the call was made |
error | `NULL` on success, or an error on failure |
user_data | user-supplied data |
weak_object | user-supplied object |

### tp_cli_channel_request_call_cancel ()

    TpProxyPendingCall *
    tp_cli_channel_request_call_cancel (TpChannelRequest *proxy,
                                        gint timeout_ms,
                                        tp_cli_channel_request_callback_for_cancel callback,
                                        gpointer user_data,
                                        GDestroyNotify destroy,
                                        GObject *weak_object);

Start a Cancel method call.

<tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>Cancel the channel request. The precise effect depends on the current progress of the request.</p> <p>If the connection manager has not already been asked to create a channel, then <tp:member-ref>Failed</tp:member-ref> is emitted immediately, and the channel request is removed.</p> <p>If the connection manager has already been asked to create a channel but has not produced one yet (e.g. if <tp:dbus-ref namespace="org.freedesktop.Telepathy">Connection.Interface.Requests.CreateChannel</tp:dbus-ref> has been called, but has not yet returned), then the ChannelDispatcher will remember that the request has been cancelled. When the channel appears, it will be closed (if it was newly created and can be closed), and will not be dispatched to a handler.</p> <p>If the connection manager has already returned a channel, but the channel has not yet been dispatched to a handler then the channel dispatcher will not dispatch that channel to a handler. If the channel was newly created for this request, the channel dispatcher will close it with <tp:dbus-ref namespace="org.freedesktop.Telepathy.Channel">Close</tp:dbus-ref>; otherwise, the channel dispatcher will ignore it. In either case, <tp:member-ref>Failed</tp:member-ref> will be emitted when processing has been completed.</p> <p>If <tp:member-ref>Failed</tp:member-ref> is emitted in response to this method, the error SHOULD be <code>org.freedesktop.Telepathy.Error.Cancelled</code>.</p> <p>If the channel has already been dispatched to a handler, then it's too late to call this method, and the channel request will no longer exist.</p>

#### Parameters

proxy | the TpProxy |
timeout_ms | the timeout in milliseconds, or -1 to use the default |
callback | called when the method call succeeds or fails; may be `NULL` to make a "fire and forget" call with no reply tracking |
user_data | user-supplied data passed to the callback; must be `NULL` if `callback` is `NULL` |
destroy | called with the user_data as argument, after the call has succeeded, failed or been cancelled; must be `NULL` if `callback` is `NULL` |
weak_object | If not `NULL`, a GObject which will be weakly referenced; if it is destroyed, this call will automatically be cancelled. Must be `NULL` if `callback` is `NULL` |

#### Returns

a TpProxyPendingCall representing the call in progress. It is borrowed from the object, and will become invalid when the callback is called, the call is cancelled or the TpProxy becomes invalid.

### tp_cli_channel_request_callback_for_proceed ()

    void
    (*tp_cli_channel_request_callback_for_proceed)
                                   (TpChannelRequest *proxy,
                                    const GError *error,
                                    gpointer user_data,
                                    GObject *weak_object);

Signature of the callback called when a Proceed method call succeeds or fails.

#### Parameters

proxy | the proxy on which the call was made |
error | `NULL` on success, or an error on failure |
user_data | user-supplied data |
weak_object | user-supplied object |

### tp_cli_channel_request_call_proceed ()

    TpProxyPendingCall *
    tp_cli_channel_request_call_proceed (TpChannelRequest *proxy,
                                         gint timeout_ms,
                                         tp_cli_channel_request_callback_for_proceed callback,
                                         gpointer user_data,
                                         GDestroyNotify destroy,
                                         GObject *weak_object);

Start a Proceed method call.

<tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>Proceed with the channel request.</p> <tp:rationale> <p>The client that created this object calls this method when it has connected signal handlers for <tp:member-ref>Succeeded</tp:member-ref> and <tp:member-ref>Failed</tp:member-ref>.</p> </tp:rationale> <p>Clients other than the client which created the ChannelRequest MUST NOT call this method.</p> <p>This method SHOULD return immediately; on success, the request might still fail, but this will be indicated asynchronously by the <tp:member-ref>Failed</tp:member-ref> signal.</p> <p>Proceed cannot fail, unless clients have got the life-cycle of a ChannelRequest seriously wrong (e.g. a client calls this method twice, or a client that did not create the ChannelRequest calls this method). If it fails, clients SHOULD assume that the whole ChannelRequest has become useless.</p>

#### Parameters

proxy | the TpProxy |
timeout_ms | the timeout in milliseconds, or -1 to use the default |
callback | called when the method call succeeds or fails; may be `NULL` to make a "fire and forget" call with no reply tracking |
user_data | user-supplied data passed to the callback; must be `NULL` if `callback` is `NULL` |
destroy | called with the user_data as argument, after the call has succeeded, failed or been cancelled; must be `NULL` if `callback` is `NULL` |
weak_object | If not `NULL`, a GObject which will be weakly referenced; if it is destroyed, this call will automatically be cancelled. Must be `NULL` if `callback` is `NULL` |

#### Returns

a TpProxyPendingCall representing the call in progress. It is borrowed from the object, and will become invalid when the callback is called, the call is cancelled or the TpProxy becomes invalid.

### tp_cli_channel_request_signal_callback_failed ()

    void
    (*tp_cli_channel_request_signal_callback_failed)
                                   (TpChannelRequest *proxy,
                                    const gchar *arg_Error,
                                    const gchar *arg_Message,
                                    gpointer user_data,
                                    GObject *weak_object);

Represents the signature of a callback for the signal Failed.

#### Parameters

proxy | The proxy on which `tp_cli_channel_request_connect_to_failed()` was called |

arg_Error

<tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>The name of a D-Bus error. This can come from various sources, including the error raised by <tp:dbus-ref namespace="org.freedesktop.Telepathy.Connection.Interface.Requests">CreateChannel</tp:dbus-ref>, or an error generated to represent failure to establish the <tp:dbus-ref namespace="org.freedesktop.Telepathy">Connection</tp:dbus-ref>.</p>

arg_Message | If the first argument of the D-Bus error message was a string, that string. Otherwise, an empty string. |
user_data | User-supplied data |
weak_object | User-supplied weakly referenced object |

### tp_cli_channel_request_connect_to_failed ()

    TpProxySignalConnection *
    tp_cli_channel_request_connect_to_failed
                                   (TpChannelRequest *proxy,
                                    tp_cli_channel_request_signal_callback_failed callback,
                                    gpointer user_data,
                                    GDestroyNotify destroy,
                                    GObject *weak_object,
                                    GError **error);

Connect a handler to the signal Failed.

<tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>The channel request has failed. It is no longer present, and further methods must not be called on it.</p>

#### Parameters

proxy | A TpChannelRequest or subclass |
callback | Callback to be called when the signal is received |
user_data | User-supplied data for the callback |
destroy | Destructor for the user-supplied data, which will be called when this signal is disconnected, or before this function returns `NULL` |
weak_object | A GObject which will be weakly referenced; if it is destroyed, this callback will automatically be disconnected |
error | If not `NULL`, used to raise an error if `NULL` is returned |

#### Returns

a TpProxySignalConnection containing all of the above, which can be used to disconnect the signal; or `NULL` if the proxy does not have the desired interface or has become invalid.

### tp_cli_channel_request_signal_callback_succeeded ()

    void
    (*tp_cli_channel_request_signal_callback_succeeded)
                                   (TpChannelRequest *proxy,
                                    gpointer user_data,
                                    GObject *weak_object);

Represents the signature of a callback for the signal Succeeded.

#### Parameters

proxy | The proxy on which `tp_cli_channel_request_connect_to_succeeded()` was called |
user_data | User-supplied data |
weak_object | User-supplied weakly referenced object |

### tp_cli_channel_request_connect_to_succeeded ()

    TpProxySignalConnection *
    tp_cli_channel_request_connect_to_succeeded
                                   (TpChannelRequest *proxy,
                                    tp_cli_channel_request_signal_callback_succeeded callback,
                                    gpointer user_data,
                                    GDestroyNotify destroy,
                                    GObject *weak_object,
                                    GError **error);

Connect a handler to the signal Succeeded.

<tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>The channel request has succeeded. It is no longer present, and further methods must not be called on it.</p>

#### Parameters

proxy | A TpChannelRequest or subclass |
callback | Callback to be called when the signal is received |
user_data | User-supplied data for the callback |
destroy | Destructor for the user-supplied data, which will be called when this signal is disconnected, or before this function returns `NULL` |
weak_object | A GObject which will be weakly referenced; if it is destroyed, this callback will automatically be disconnected |
error | If not `NULL`, used to raise an error if `NULL` is returned |

#### Returns

a TpProxySignalConnection containing all of the above, which can be used to disconnect the signal; or `NULL` if the proxy does not have the desired interface or has become invalid.

### tp_cli_channel_request_signal_callback_succeeded_with_channel ()

    void
    (*tp_cli_channel_request_signal_callback_succeeded_with_channel)
                                   (TpChannelRequest *proxy,
                                    const gchar *arg_Connection,
                                    GHashTable *arg_Connection_Properties,
                                    const gchar *arg_Channel,
                                    GHashTable *arg_Channel_Properties,
                                    gpointer user_data,
                                    GObject *weak_object);

Represents the signature of a callback for the signal SucceededWithChannel.

#### Parameters

proxy | The proxy on which `tp_cli_channel_request_connect_to_succeeded_with_channel()` was called |
arg_Connection | <tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>The Connection owning the channel.</p> |
arg_Connection_Properties | <tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>A subset of the Connection's properties, currently unused. This parameter may be used in future.</p> |
arg_Channel | <tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>The channel which has been created.</p> |
arg_Channel_Properties | <tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>The same immutable properties of the Channel that would appear in a <tp:dbus-ref namespace="ofdT.Connection.Interface.Requests">NewChannels</tp:dbus-ref> signal.</p> |
user_data | User-supplied data |
weak_object | User-supplied weakly referenced object |

### tp_cli_channel_request_connect_to_succeeded_with_channel ()

    TpProxySignalConnection *
    tp_cli_channel_request_connect_to_succeeded_with_channel
                                   (TpChannelRequest *proxy,
                                    tp_cli_channel_request_signal_callback_succeeded_with_channel callback,
                                    gpointer user_data,
                                    GDestroyNotify destroy,
                                    GObject *weak_object,
                                    GError **error);

Connect a handler to the signal SucceededWithChannel.

<tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>Variant of the <tp:dbus-ref namespace="ofdT.ChannelRequest">Succeeded</tp:dbus-ref> signal allowing to get the channel which has been created.</p> <p>This signal MUST be emitted if the <tp:dbus-ref namespace="ofdT">ChannelDispatcher</tp:dbus-ref>'s <tp:dbus-ref namespace="ofdT.ChannelDispatcher">SupportsRequestHints</tp:dbus-ref> property is true. If supported, it MUST be emitted before the <tp:member-ref>Succeeded</tp:member-ref> signal.</p>

#### Parameters

proxy | A TpChannelRequest or subclass |
callback | Callback to be called when the signal is received |
user_data | User-supplied data for the callback |
destroy | Destructor for the user-supplied data, which will be called when this signal is disconnected, or before this function returns `NULL` |
weak_object | A GObject which will be weakly referenced; if it is destroyed, this callback will automatically be disconnected |
error | If not `NULL`, used to raise an error if `NULL` is returned |

#### Returns

a TpProxySignalConnection containing all of the above, which can be used to disconnect the signal; or `NULL` if the proxy does not have the desired interface or has become invalid.

## Types and Values

### struct TpChannelRequest

    struct TpChannelRequest;

Requesting a channel from the channel dispatcher can take some time, so an object is created in the channel dispatcher to represent each request. This proxy represents one of those objects.

Any client can call `tp_cli_channel_request_call_cancel()` at any time to attempt to cancel the request.

On success, the “succeeded” signal will be emitted. Immediately after that, the “invalidated” signal will be emitted, with the domain `TP_DBUS_ERRORS` and the error code `TP_DBUS_ERROR_OBJECT_REMOVED` (this is not an error condition, it merely indicates that the channel request no longer exists).

On failure, the “invalidated” signal will be emitted with some other suitable error, usually from the `TP_ERROR` domain.

If the channel dispatcher crashes or exits, the “invalidated” signal will be emitted with the domain `TP_DBUS_ERRORS` and the error code `TP_DBUS_ERROR_NAME_OWNER_LOST`.

Creating a TpChannelRequest directly is deprecated: it should only be created via a TpAccountChannelRequest or a TpBaseClient.

Since 0.16, TpChannelRequest always has a non-`NULL` “factory”, and its “factory” will be propagated to the TpAccount, TpConnection and TpChannel.

Since: 0.7.32

### struct TpChannelRequestClass

    struct TpChannelRequestClass {
    };

The class of a TpChannelRequest.

## Property Details

### The `“account”` property

      “account”                  TpAccount *

The TpAccount on which this request was made, not guaranteed to be prepared.

Read-only.

Owner: TpChannelRequest

Flags: Read

Since: 0.15.3

### The `“channel-factory”` property

      “channel-factory”          GObject *

The object implementing the TpClientChannelFactoryInterface interface that will be used to create channel proxies when the “succeeded-with-channel” signal is fired. This property can be changed using `tp_channel_request_set_channel_factory()`.

If no channel factory is specified then TpAutomaticProxyFactory is used.

`TpChannelRequest:channel-factory` is deprecated and should not be used in newly-written code.

since 0.15.5. Use “factory” instead.

Owner: TpChannelRequest

Flags: Read / Write / Construct

Since: 0.13.14

### The `“hints”` property

      “hints”                    GHashTable_gchararray+GValue_*

A TP_HASH_TYPE_STRING_VARIANT_MAP of metadata provided by the channel requester; or `NULL` if “immutable-properties” is not defined or if no hints has been defined.

Read-only.

Owner: TpChannelRequest

Flags: Read

Since: 0.13.14

### The `“hints-vardict”` property

      “hints-vardict”            GVariant *

A `G_VARIANT_TYPE_VARDICT` of metadata provided by the channel requester; or `NULL` if “immutable-properties” is not defined or if no hints have been defined.

Read-only.

Owner: TpChannelRequest

Flags: Read

Allowed values: GVariant<a{sv}>

Default value: NULL

Since: 0.19.10

### The `“immutable-properties”` property

      “immutable-properties”     GHashTable_gchararray+GValue_*

The immutable D-Bus properties of this channel request, represented by a GHashTable where the keys are D-Bus interface name + "." + property name, and the values are GValue instances.

Note that this property is set only if the immutable properties have been set during the construction of the TpChannelRequest.

Read-only except during construction.

Owner: TpChannelRequest

Flags: Read / Write / Construct Only

Since: 0.13.14

### The `“immutable-properties-vardict”` property

      “immutable-properties-vardict” GVariant *

The immutable D-Bus properties of this channel request, represented by a `G_VARIANT_TYPE_VARDICT` where the keys are D-Bus interface name + "." + property name.

Note that this property is set only if the immutable properties have been set during the construction of the TpChannelRequest.

Read-only except during construction.

Owner: TpChannelRequest

Flags: Read

Allowed values: GVariant<a{sv}>

Default value: NULL

Since: 0.19.10

### The `“preferred-handler”` property

      “preferred-handler”        gchar *

Either the well-known bus name (starting with TP_CLIENT_BUS_NAME_BASE) of the preferred handler for this channel request, or `NULL` to indicate that any handler would be acceptable.

Read-only.

Owner: TpChannelRequest

Flags: Read

Default value: NULL

Since: 0.15.3

### The `“user-action-time”` property

      “user-action-time”         gint64

The time at which user action occurred, or TP_USER_ACTION_TIME_NOT_USER_ACTION if this channel request is for some reason not involving user action.

Read-only.

Owner: TpChannelRequest

Flags: Read

Allowed values: >= 0

Default value: 0

Since: 0.15.3

## Signal Details

### The `“succeeded”` signal

    void
    user_function (TpChannelRequest *self,
                   gpointer          user_data)

Emitted when the channel request succeeds.

`TpChannelRequest::succeeded` is deprecated and should not be used in newly-written code.

since 0.13.14. Use “succeeded-with-channel”, which provides the resulting channel, instead.

#### Parameters

self | the channel request proxy |
user_data | user data set when the signal handler was connected. |

Flags: Has Details

### The `“succeeded-with-channel”` signal

    void
    user_function (TpChannelRequest *self,
                   TpConnection     *connection,
                   TpChannel        *channel,
                   gpointer          user_data)

Emitted when the channel request succeeds.

With telepathy-mission-control version 5.7.1 and earlier, `connection` and `channel` will be `NULL`. When using newer versions, they will be correctly set to the newly-created channel, and the connection which owns it.

The TpChannel is created using “channel-factory” or “factory” but the features of the factory are NOT prepared. It's up to the user to prepare the features returned by `tp_simple_client_factory_dup_channel_features()` himself.

#### Parameters

self | the channel request proxy |
connection | the TpConnection of `channel` , or `NULL` |
channel | the TpChannel created, or `NULL` |
user_data | user data set when the signal handler was connected. |

Flags: Has Details

Since: 0.13.14

## See Also

TpChannelDispatcher