## TpChannel

TpChannel — proxy object for a Telepathy channel

## Synopsis

    #include <telepathy-glib/channel.h>

                        TpChannel;
                        TpChannelClass;
    TpChannel *         tp_channel_new                      (TpConnection *conn,
                                                             const gchar *object_path,
                                                             const gchar *optional_channel_type,
                                                             TpHandleType optional_handle_type,
                                                             TpHandle optional_handle,
                                                             GError **error);
    TpChannel *         tp_channel_new_from_properties      (TpConnection *conn,
                                                             const gchar *object_path,
                                                             const GHashTable *immutable_properties,
                                                             GError **error);
    gboolean            tp_channel_run_until_ready          (TpChannel *self,
                                                             GError **error,
                                                             GMainLoop **loop);
    void                (*TpChannelWhenReadyCb)             (TpChannel *channel,
                                                             const GError *error,
                                                             gpointer user_data);
    void                tp_channel_call_when_ready          (TpChannel *self,
                                                             TpChannelWhenReadyCb callback,
                                                             gpointer user_data);
    void                tp_channel_init_known_interfaces    (void);
    TpConnection *      tp_channel_borrow_connection        (TpChannel *self);
    GHashTable *        tp_channel_borrow_immutable_properties
                                                            (TpChannel *self);
    const gchar *       tp_channel_get_channel_type         (TpChannel *self);
    GQuark              tp_channel_get_channel_type_id      (TpChannel *self);
    TpHandle            tp_channel_get_handle               (TpChannel *self,
                                                             TpHandleType *handle_type);
    const gchar *       tp_channel_get_identifier           (TpChannel *self);
    gboolean            tp_channel_is_ready                 (TpChannel *self);

    TpChannelGroupFlags  tp_channel_group_get_flags         (TpChannel *self);
    TpHandle            tp_channel_group_get_handle_owner   (TpChannel *self,
                                                             TpHandle handle);
    TpHandle            tp_channel_group_get_self_handle    (TpChannel *self);
    const TpIntSet *    tp_channel_group_get_local_pending  (TpChannel *self);
    const TpIntSet *    tp_channel_group_get_members        (TpChannel *self);
    const TpIntSet *    tp_channel_group_get_remote_pending (TpChannel *self);
    gboolean            tp_channel_group_get_local_pending_info
                                                            (TpChannel *self,
                                                             TpHandle local_pending,
                                                             TpHandle *actor,
                                                             TpChannelGroupChangeReason *reason,
                                                             const gchar **message);
    #define             TP_ERRORS_REMOVED_FROM_GROUP

    TpProxyPendingCall * tp_cli_channel_call_close          (TpChannel *proxy,
                                                             gint timeout_ms,
                                                             tp_cli_channel_callback_for_close callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object);
    TpProxyPendingCall * tp_cli_channel_call_get_channel_type
                                                            (TpChannel *proxy,
                                                             gint timeout_ms,
                                                             tp_cli_channel_callback_for_get_channel_type callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object);
    TpProxyPendingCall * tp_cli_channel_call_get_handle     (TpChannel *proxy,
                                                             gint timeout_ms,
                                                             tp_cli_channel_callback_for_get_handle callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object);
    TpProxyPendingCall * tp_cli_channel_call_get_interfaces (TpChannel *proxy,
                                                             gint timeout_ms,
                                                             tp_cli_channel_callback_for_get_interfaces callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object);
    void                (*tp_cli_channel_callback_for_close)
                                                            (TpChannel *proxy,
                                                             const GError *error,
                                                             gpointer user_data,
                                                             GObject *weak_object);
    void                (*tp_cli_channel_callback_for_get_channel_type)
                                                            (TpChannel *proxy,
                                                             const gchar *out_Channel_Type,
                                                             const GError *error,
                                                             gpointer user_data,
                                                             GObject *weak_object);
    void                (*tp_cli_channel_callback_for_get_handle)
                                                            (TpChannel *proxy,
                                                             guint out_Target_Handle_Type,
                                                             guint out_Target_Handle,
                                                             const GError *error,
                                                             gpointer user_data,
                                                             GObject *weak_object);
    void                (*tp_cli_channel_callback_for_get_interfaces)
                                                            (TpChannel *proxy,
                                                             const gchar **out_Interfaces,
                                                             const GError *error,
                                                             gpointer user_data,
                                                             GObject *weak_object);
    gboolean            tp_cli_channel_run_close            (TpChannel *proxy,
                                                             gint timeout_ms,
                                                             GError **error,
                                                             GMainLoop **loop);
    gboolean            tp_cli_channel_run_get_channel_type (TpChannel *proxy,
                                                             gint timeout_ms,
                                                             gchar **out_Channel_Type,
                                                             GError **error,
                                                             GMainLoop **loop);
    gboolean            tp_cli_channel_run_get_handle       (TpChannel *proxy,
                                                             gint timeout_ms,
                                                             guint *out_Target_Handle_Type,
                                                             guint *out_Target_Handle,
                                                             GError **error,
                                                             GMainLoop **loop);
    gboolean            tp_cli_channel_run_get_interfaces   (TpChannel *proxy,
                                                             gint timeout_ms,
                                                             gchar ***out_Interfaces,
                                                             GError **error,
                                                             GMainLoop **loop);
    TpProxySignalConnection * tp_cli_channel_connect_to_closed
                                                            (TpChannel *proxy,
                                                             tp_cli_channel_signal_callback_closed callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object,
                                                             GError **error);
    void                (*tp_cli_channel_signal_callback_closed)
                                                            (TpChannel *proxy,
                                                             gpointer user_data,
                                                             GObject *weak_object);

    TpProxyPendingCall * tp_cli_channel_interface_destroyable_call_destroy
                                                            (TpChannel *proxy,
                                                             gint timeout_ms,
                                                             tp_cli_channel_interface_destroyable_callback_for_destroy callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object);
    void                (*tp_cli_channel_interface_destroyable_callback_for_destroy)
                                                            (TpChannel *proxy,
                                                             const GError *error,
                                                             gpointer user_data,
                                                             GObject *weak_object);
    gboolean            tp_cli_channel_interface_destroyable_run_destroy
                                                            (TpChannel *proxy,
                                                             gint timeout_ms,
                                                             GError **error,
                                                             GMainLoop **loop);

## Object Hierarchy

      GObject
       +----TpProxy
             +----TpChannel

## Implemented Interfaces

TpChannel implements TpChannelIface.

## Properties

      "channel-properties"       GHashTable_gchararray+GValue_*  : Read / Write / Construct Only
      "channel-ready"            gboolean              : Read
      "connection"               TpConnection*         : Read / Write / Construct Only
      "group-flags"              guint                 : Read
      "group-self-handle"        guint                 : Read
      "identifier"               gchar*                : Read

## Signals

      "group-flags-changed"                            : Run Last / Has Details
      "group-members-changed"                          : Run Last / Has Details
      "group-members-changed-detailed"                 : Run Last / Has Details

## Description

TpChannel objects provide convenient access to Telepathy channels.

Compared with a simple proxy for method calls, they add the following features:

* calling `GetChannelType()`, `GetInterfaces()`, `GetHandles()` automatically

This section also documents the auto-generated C wrappers for the Channel D-Bus interface. Of these, in general, only `tp_cli_channel_call_close()` and `tp_cli_channel_run_close()` are useful (the TpChannel object provides a more convenient API for the rest).

## Details

### TpChannel

    typedef struct _TpChannel TpChannel;

A proxy object for a Telepathy channel.

(Changed in 0.7.12: the layout of the structure is visible, allowing subclassing.)

Since 0.7.1

### TpChannelClass

    typedef struct {
        TpProxyClass parent_class;
    } TpChannelClass;

The class of a TpChannel. In addition to `parent_class` there are four pointers reserved for possible future use.

(Changed in 0.7.12: the layout of the structure is visible, allowing subclassing.)

TpProxyClass `parent_class`; | parent class

Since 0.7.1

### tp_channel_new ()

    TpChannel *         tp_channel_new                      (TpConnection *conn,
                                                             const gchar *object_path,
                                                             const gchar *optional_channel_type,
                                                             TpHandleType optional_handle_type,
                                                             TpHandle optional_handle,
                                                             GError **error);

`conn` : | a connection; may not be `NULL`
`object_path` : | the object path of the channel; may not be `NULL`
`optional_channel_type` : | the channel type if already known, or `NULL` if not
`optional_handle_type` : | the handle type if already known, or `TP_UNKNOWN_HANDLE_TYPE` if not
`optional_handle` : | the handle if already known, or 0 if not (if `optional_handle_type` is `TP_UNKNOWN_HANDLE_TYPE` or `TP_HANDLE_TYPE_NONE`, this must be 0)
`error` : | used to indicate the error if `NULL` is returned
Returns : | a new channel proxy, or `NULL` on invalid arguments.

Since 0.7.1

### tp_channel_new_from_properties ()

    TpChannel *         tp_channel_new_from_properties      (TpConnection *conn,
                                                             const gchar *object_path,
                                                             const GHashTable *immutable_properties,
                                                             GError **error);

`conn` : | a connection; may not be `NULL`
`object_path` : | the object path of the channel; may not be `NULL`
`immutable_properties` : | the immutable properties of the channel, as signalled by the NewChannel D-Bus signal or returned by the CreateChannel and EnsureChannel D-Bus methods: a mapping from strings (D-Bus interface name + "." + property name) to GValue instances
`error` : | used to indicate the error if `NULL` is returned
Returns : | a new channel proxy, or `NULL` on invalid arguments

Since 0.7.19

### tp_channel_run_until_ready ()

    gboolean            tp_channel_run_until_ready          (TpChannel *self,
                                                             GError **error,
                                                             GMainLoop **loop);

If `self` is ready for use (introspection has finished, etc.), return immediately. Otherwise, re-enter the main loop until the channel either becomes invalid or becomes ready for use, or until the main loop stored via `loop` is cancelled.

`self` : | a channel
`error` : | if not `NULL` and `FALSE` is returned, used to raise an error
`loop` : | if not `NULL`, a GMainLoop is placed here while it is being run (so calling code can call `g_main_loop_quit()` to abort), and `NULL` is placed here after the loop has been run
Returns : | `TRUE` if the channel has been introspected and is ready for use, `FALSE` if the channel has become invalid.

Since 0.7.1

### TpChannelWhenReadyCb ()

    void                (*TpChannelWhenReadyCb)             (TpChannel *channel,
                                                             const GError *error,
                                                             gpointer user_data);

Signature of a callback passed to `tp_channel_call_when_ready()`, which will be called exactly once, when the channel becomes ready or invalid (whichever happens first)

`channel` : | the channel (which may be in the middle of being disposed, if error is non-`NULL`, error->domain is TP_DBUS_ERRORS and error->code is TP_DBUS_ERROR_PROXY_UNREFERENCED)
`error` : | `NULL` if the channel is ready for use, or the error with which it was invalidated if it is now invalid
`user_data` : | whatever was passed to `tp_channel_call_when_ready()`

### tp_channel_call_when_ready ()

    void                tp_channel_call_when_ready          (TpChannel *self,
                                                             TpChannelWhenReadyCb callback,
                                                             gpointer user_data);

If `self` is ready for use or has been invalidated, call `callback` immediately, then return. Otherwise, arrange for `callback` to be called when `self` either becomes ready for use or becomes invalid.

`self` : | a channel
`callback` : | called when the channel becomes ready or invalidated, whichever happens first
`user_data` : | arbitrary user-supplied data passed to the callback

Since 0.7.7

### tp_channel_init_known_interfaces ()

    void                tp_channel_init_known_interfaces    (void);

Ensure that the known interfaces for TpChannel 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`.

Since 0.7.6

### tp_channel_borrow_connection ()

    TpConnection *      tp_channel_borrow_connection        (TpChannel *self);

Returns the connection for this channel. The returned pointer is only valid while this channel is valid - reference it with `g_object_ref()` if needed.

`self` : | a channel
Returns : | the value of "connection"

Since 0.7.12

### tp_channel_borrow_immutable_properties ()

    GHashTable *        tp_channel_borrow_immutable_properties
                                                            (TpChannel *self);

Returns the immutable D-Bus properties of this channel, the same as "channel-properties".

The returned hash table should not be altered, and is not necessarily valid after the main loop is next re-entered. Copy it with `g_boxed_copy()` (its type is `TP_HASH_TYPE_QUALIFIED_PROPERTY_VALUE_MAP`) if a copy that remains valid must be kept.

If the "channel-properties" property was not set during construction (e.g. by calling `tp_channel_new_from_properties()`), a reasonable but possibly incomplete version will be made up from the values of individual properties; reading this property repeatedly may yield progressively more complete values until "channel-ready" becomes `TRUE`.

`self` : | a channel
Returns : | a GHashTable where the keys are strings, D-Bus interface name + "." + property name, and the values are GValue instances

### tp_channel_get_channel_type ()

    const gchar *       tp_channel_get_channel_type         (TpChannel *self);

Get the D-Bus interface name representing this channel's type, if it has been discovered.

This is the same as the "channel-type" property.

`self` : | a channel
Returns : | the channel type, if the channel is ready; either the channel type or `NULL`, if the channel is not yet ready.

Since 0.7.12

### tp_channel_get_channel_type_id ()

    GQuark              tp_channel_get_channel_type_id      (TpChannel *self);

Get the D-Bus interface name representing this channel's type, as a GQuark, if it has been discovered.

This is the same as the "channel-type" property, except that it is a GQuark rather than a string.

`self` : | a channel
Returns : | the channel type, if the channel is ready; either the channel type or 0, if the channel is not yet ready.

Since 0.7.12

### tp_channel_get_handle ()

    TpHandle            tp_channel_get_handle               (TpChannel *self,
                                                             TpHandleType *handle_type);

Get the handle representing the contact, chatroom, etc. with which this channel communicates for its whole lifetime, or 0 if there is no such handle or it has not yet been discovered.

This is the same as the "handle" property.

If `handle_type` is not `NULL`, the type of handle is written into it. This will be `TP_UNKNOWN_HANDLE_TYPE` if the handle has not yet been discovered, or `TP_HANDLE_TYPE_NONE` if there is no handle with which this channel will always communicate. This is the same as the "handle-type" property.

`self` : | a channel
`handle_type` : | if not `NULL`, used to return the type of this handle
Returns : | the handle

Since 0.7.12

### tp_channel_get_identifier ()

    const gchar *       tp_channel_get_identifier           (TpChannel *self);

This channel's associated identifier, or NULL if no identifier or unknown.

The identifier is the result of inspecting "handle". This is the same as the "identifier" property.

`self` : | a channel
Returns : | the identifier

Since 0.7.21

### tp_channel_is_ready ()

    gboolean            tp_channel_is_ready                 (TpChannel *self);

Returns the same thing as the "channel-ready" property.

`self` : | a channel
Returns : | `TRUE` if introspection has completed

Since 0.7.12

### tp_channel_group_get_flags ()

    TpChannelGroupFlags  tp_channel_group_get_flags         (TpChannel *self);

Return the "group-flags" property (see the description of that property for notes on validity).

`self` : | a channel
Returns : | the group flags, or 0

Since 0.7.12

### tp_channel_group_get_handle_owner ()

    TpHandle            tp_channel_group_get_handle_owner   (TpChannel *self,
                                                             TpHandle handle);

Synopsis (see below for further explanation):

- if `self` is not a group or `handle` is not a member of this channel, result is undefined; - if `self` does not have "ready" = TRUE, result is undefined; - if `self` does not have flags that include `TP_CHANNEL_FLAG_PROPERTIES`, result is undefined; - if `handle` is channel-specific and its globally valid "owner" is known, return that owner; - if `handle` is channel-specific and its globally valid "owner" is unknown, return zero; - if `handle` is globally valid, return `handle` itself

Some channels (those with flags that include `TP_CHANNEL_FLAG_CHANNEL_SPECIFIC_HANDLES`) have a concept of "channel-specific handles". These are handles that only have meaning within the context of the channel - for instance, in XMPP Multi-User Chat, participants in a chatroom are identified by an in-room JID consisting of the JID of the chatroom plus a local nickname.

Depending on the protocol and configuration, it might be possible to find out what globally valid handle (i.e. an identifier that you could add to your contact list) "owns" a channel-specific handle. For instance, in most XMPP MUC chatrooms, normal users cannot see what global JID corresponds to an in-room JID, but moderators can.

This is further complicated by the fact that channels with channel-specific handles can sometimes have members with globally valid handles (for instance, if you invite someone to an XMPP MUC using their globally valid JID, you would expect to see the handle representing that JID in the Group's remote-pending set).

This function's result is undefined unless the channel is ready and its flags include `TP_CHANNEL_FLAG_PROPERTIES` (an implementation without extra D-Bus round trips is not possible using the older API).

`self` : | a channel
`handle` : | a handle which is a member of this channel
Returns : | the global handle that owns the given handle, or 0

Since 0.7.12

### tp_channel_group_get_self_handle ()

    TpHandle            tp_channel_group_get_self_handle    (TpChannel *self);

Return the "group-self-handle" property (see the description of that property for notes on validity).

`self` : | a channel
Returns : | the handle representing the user, or 0

Since 0.7.12

### tp_channel_group_get_local_pending ()

    const TpIntSet *    tp_channel_group_get_local_pending  (TpChannel *self);

If `self` is ready and is a group, return a TpIntSet containing its local-pending members.

If `self` is a group but is not ready, the result may either be a set of local-pending members, or `NULL`.

If `self` is not a group, return `NULL`.

`self` : | a channel
Returns : | the local-pending members, or `NULL`

Since 0.7.12

### tp_channel_group_get_members ()

    const TpIntSet *    tp_channel_group_get_members        (TpChannel *self);

If `self` is ready and is a group, return a TpIntSet containing its members.

If `self` is a group but is not ready, the result may either be a set of members, or `NULL`.

If `self` is not a group, return `NULL`.

`self` : | a channel
Returns : | the members, or `NULL`

Since 0.7.12

### tp_channel_group_get_remote_pending ()

    const TpIntSet *    tp_channel_group_get_remote_pending (TpChannel *self);

If `self` is ready and is a group, return a TpIntSet containing its remote-pending members.

If `self` is a group but is not ready, the result may either be a set of remote-pending members, or `NULL`.

If `self` is not a group, return `NULL`.

`self` : | a channel
Returns : | the remote-pending members, or `NULL`

Since 0.7.12

### tp_channel_group_get_local_pending_info ()

    gboolean            tp_channel_group_get_local_pending_info
                                                            (TpChannel *self,
                                                             TpHandle local_pending,
                                                             TpHandle *actor,
                                                             TpChannelGroupChangeReason *reason,
                                                             const gchar **message);

If `local_pending` is actually the handle of a local-pending contact, write additional information into `actor`, `reason` and `message` and return `TRUE`. The handle and message are not referenced or copied, and can only be assumed to remain valid until the main loop is re-entered.

If `local_pending` is not the handle of a local-pending contact, write 0 into `actor`, `TP_CHANNEL_GROUP_CHANGE_REASON_NONE` into `reason` and "" into `message`, and return `FALSE`.

`self` : | a channel
`local_pending` : | the handle of a local-pending contact about whom more information is needed
`actor` : | either `NULL` or a location to return the contact who requested the change
`reason` : | either `NULL` or a location to return the reason for the change
`message` : | either `NULL` or a location to return the user-supplied message
Returns : | `TRUE` if the contact is in fact local-pending

Since 0.7.12

### TP_ERRORS_REMOVED_FROM_GROUP

    #define TP_ERRORS_REMOVED_FROM_GROUP (tp_errors_removed_from_group_quark ())

GError domain representing the local user being removed from a channel with the Group interface. The `code` in a GError with this domain must be a member of TpChannelGroupChangeReason.

This error may be raised on non-Group channels with certain reason codes if there's no better error code to use (mainly `TP_CHANNEL_GROUP_CHANGE_REASON_NONE`).

This macro expands to a function call returning a GQuark.

Since 0.7.1

### tp_cli_channel_call_close ()

    TpProxyPendingCall * tp_cli_channel_call_close          (TpChannel *proxy,
                                                             gint timeout_ms,
                                                             tp_cli_channel_callback_for_close callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object);

Start a Close method call.

Request that the channel be closed. This is not the case until the <tp:member-ref>Closed</tp:member-ref> signal has been emitted, and depending on the connection manager this may simply remove you from the channel on the server, rather than causing it to stop existing entirely. Some channels such as contact list channels may not be closed.

`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_call_get_channel_type ()

    TpProxyPendingCall * tp_cli_channel_call_get_channel_type
                                                            (TpChannel *proxy,
                                                             gint timeout_ms,
                                                             tp_cli_channel_callback_for_get_channel_type callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object);

Start a GetChannelType method call.

Returns the interface name for the type of this channel. Clients SHOULD use the <tp:member-ref>ChannelType</tp:member-ref> property instead, falling back to this method only if necessary. <tp:rationale> The GetAll method lets clients retrieve all properties in one round-trip. </tp:rationale>

`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_call_get_handle ()

    TpProxyPendingCall * tp_cli_channel_call_get_handle     (TpChannel *proxy,
                                                             gint timeout_ms,
                                                             tp_cli_channel_callback_for_get_handle callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object);

Start a GetHandle method call.

Returns the handle type and number if this channel represents a communication with a particular contact, room or server-stored list, or zero if it is transient and defined only by its contents. Clients SHOULD use the <tp:member-ref>TargetHandle</tp:member-ref> and <tp:member-ref>TargetHandleType</tp:member-ref> properties instead, falling back to this method only if necessary. <tp:rationale> The GetAll method lets clients retrieve all properties in one round-trip. </tp:rationale>

`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_call_get_interfaces ()

    TpProxyPendingCall * tp_cli_channel_call_get_interfaces (TpChannel *proxy,
                                                             gint timeout_ms,
                                                             tp_cli_channel_callback_for_get_interfaces callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object);

Start a GetInterfaces method call.

Get the optional interfaces implemented by the channel. Clients SHOULD use the <tp:member-ref>Interfaces</tp:member-ref> property instead, falling back to this method only if necessary. <tp:rationale> The GetAll method lets clients retrieve all properties in one round-trip. </tp:rationale>

`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_callback_for_close ()

    void                (*tp_cli_channel_callback_for_close)
                                                            (TpChannel *proxy,
                                                             const GError *error,
                                                             gpointer user_data,
                                                             GObject *weak_object);

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

`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_callback_for_get_channel_type ()

    void                (*tp_cli_channel_callback_for_get_channel_type)
                                                            (TpChannel *proxy,
                                                             const gchar *out_Channel_Type,
                                                             const GError *error,
                                                             gpointer user_data,
                                                             GObject *weak_object);

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

`proxy` : | the proxy on which the call was made
`out_Channel_Type` : | Used to return an 'out' argument if `error` is `NULL`: The interface name
`error` : | `NULL` on success, or an error on failure
`user_data` : | user-supplied data
`weak_object` : | user-supplied object

### tp_cli_channel_callback_for_get_handle ()

    void                (*tp_cli_channel_callback_for_get_handle)
                                                            (TpChannel *proxy,
                                                             guint out_Target_Handle_Type,
                                                             guint out_Target_Handle,
                                                             const GError *error,
                                                             gpointer user_data,
                                                             GObject *weak_object);

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

`proxy` : | the proxy on which the call was made
`out_Target_Handle_Type` : | Used to return an 'out' argument if `error` is `NULL`: The same as TargetHandleType.
`out_Target_Handle` : | Used to return an 'out' argument if `error` is `NULL`: The same as TargetHandle.
`error` : | `NULL` on success, or an error on failure
`user_data` : | user-supplied data
`weak_object` : | user-supplied object

### tp_cli_channel_callback_for_get_interfaces ()

    void                (*tp_cli_channel_callback_for_get_interfaces)
                                                            (TpChannel *proxy,
                                                             const gchar **out_Interfaces,
                                                             const GError *error,
                                                             gpointer user_data,
                                                             GObject *weak_object);

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

`proxy` : | the proxy on which the call was made
`out_Interfaces` : | Used to return an 'out' argument if `error` is `NULL`: An array of the D-Bus interface names
`error` : | `NULL` on success, or an error on failure
`user_data` : | user-supplied data
`weak_object` : | user-supplied object

### tp_cli_channel_run_close ()

    gboolean            tp_cli_channel_run_close            (TpChannel *proxy,
                                                             gint timeout_ms,
                                                             GError **error,
                                                             GMainLoop **loop);

Call the method Close and run the main loop until it returns. Before calling this method, you must add a reference to any borrowed objects you need to keep, and generally ensure that everything is in a consistent state.

Request that the channel be closed. This is not the case until the <tp:member-ref>Closed</tp:member-ref> signal has been emitted, and depending on the connection manager this may simply remove you from the channel on the server, rather than causing it to stop existing entirely. Some channels such as contact list channels may not be closed.

`proxy` : | A TpChannel or subclass
`timeout_ms` : | Timeout in milliseconds, or -1 for default
`error` : | If not `NULL`, used to return errors if `FALSE` is returned
`loop` : | If not `NULL`, set before re-entering the main loop, to point to a GMainLoop which can be used to cancel this call with `g_main_loop_quit()`, causing a return of `FALSE` with `error` set to `TP_DBUS_ERROR_CANCELLED`
Returns : | TRUE on success, FALSE and sets `error` on error

### tp_cli_channel_run_get_channel_type ()

    gboolean            tp_cli_channel_run_get_channel_type (TpChannel *proxy,
                                                             gint timeout_ms,
                                                             gchar **out_Channel_Type,
                                                             GError **error,
                                                             GMainLoop **loop);

Call the method GetChannelType and run the main loop until it returns. Before calling this method, you must add a reference to any borrowed objects you need to keep, and generally ensure that everything is in a consistent state.

Returns the interface name for the type of this channel. Clients SHOULD use the <tp:member-ref>ChannelType</tp:member-ref> property instead, falling back to this method only if necessary. <tp:rationale> The GetAll method lets clients retrieve all properties in one round-trip. </tp:rationale>

`proxy` : | A TpChannel or subclass
`timeout_ms` : | Timeout in milliseconds, or -1 for default
`out_Channel_Type` : | Used to return an 'out' argument if `TRUE` is returned: The interface name
`error` : | If not `NULL`, used to return errors if `FALSE` is returned
`loop` : | If not `NULL`, set before re-entering the main loop, to point to a GMainLoop which can be used to cancel this call with `g_main_loop_quit()`, causing a return of `FALSE` with `error` set to `TP_DBUS_ERROR_CANCELLED`
Returns : | TRUE on success, FALSE and sets `error` on error

### tp_cli_channel_run_get_handle ()

    gboolean            tp_cli_channel_run_get_handle       (TpChannel *proxy,
                                                             gint timeout_ms,
                                                             guint *out_Target_Handle_Type,
                                                             guint *out_Target_Handle,
                                                             GError **error,
                                                             GMainLoop **loop);

Call the method GetHandle and run the main loop until it returns. Before calling this method, you must add a reference to any borrowed objects you need to keep, and generally ensure that everything is in a consistent state.

Returns the handle type and number if this channel represents a communication with a particular contact, room or server-stored list, or zero if it is transient and defined only by its contents. Clients SHOULD use the <tp:member-ref>TargetHandle</tp:member-ref> and <tp:member-ref>TargetHandleType</tp:member-ref> properties instead, falling back to this method only if necessary. <tp:rationale> The GetAll method lets clients retrieve all properties in one round-trip. </tp:rationale>

`proxy` : | A TpChannel or subclass
`timeout_ms` : | Timeout in milliseconds, or -1 for default
`out_Target_Handle_Type` : | Used to return an 'out' argument if `TRUE` is returned: The same as TargetHandleType.
`out_Target_Handle` : | Used to return an 'out' argument if `TRUE` is returned: The same as TargetHandle.
`error` : | If not `NULL`, used to return errors if `FALSE` is returned
`loop` : | If not `NULL`, set before re-entering the main loop, to point to a GMainLoop which can be used to cancel this call with `g_main_loop_quit()`, causing a return of `FALSE` with `error` set to `TP_DBUS_ERROR_CANCELLED`
Returns : | TRUE on success, FALSE and sets `error` on error

### tp_cli_channel_run_get_interfaces ()

    gboolean            tp_cli_channel_run_get_interfaces   (TpChannel *proxy,
                                                             gint timeout_ms,
                                                             gchar ***out_Interfaces,
                                                             GError **error,
                                                             GMainLoop **loop);

Call the method GetInterfaces and run the main loop until it returns. Before calling this method, you must add a reference to any borrowed objects you need to keep, and generally ensure that everything is in a consistent state.

Get the optional interfaces implemented by the channel. Clients SHOULD use the <tp:member-ref>Interfaces</tp:member-ref> property instead, falling back to this method only if necessary. <tp:rationale> The GetAll method lets clients retrieve all properties in one round-trip. </tp:rationale>

`proxy` : | A TpChannel or subclass
`timeout_ms` : | Timeout in milliseconds, or -1 for default
`out_Interfaces` : | Used to return an 'out' argument if `TRUE` is returned: An array of the D-Bus interface names
`error` : | If not `NULL`, used to return errors if `FALSE` is returned
`loop` : | If not `NULL`, set before re-entering the main loop, to point to a GMainLoop which can be used to cancel this call with `g_main_loop_quit()`, causing a return of `FALSE` with `error` set to `TP_DBUS_ERROR_CANCELLED`
Returns : | TRUE on success, FALSE and sets `error` on error

### tp_cli_channel_connect_to_closed ()

    TpProxySignalConnection * tp_cli_channel_connect_to_closed
                                                            (TpChannel *proxy,
                                                             tp_cli_channel_signal_callback_closed callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object,
                                                             GError **error);

Connect a handler to the signal Closed.

Emitted when the channel has been closed. Method calls on the channel are no longer valid after this signal has been emitted, and the connection manager may then remove the object from the bus at any point.

`proxy` : | A TpChannel 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_signal_callback_closed ()

    void                (*tp_cli_channel_signal_callback_closed)
                                                            (TpChannel *proxy,
                                                             gpointer user_data,
                                                             GObject *weak_object);

Represents the signature of a callback for the signal Closed.

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

### tp_cli_channel_interface_destroyable_call_destroy ()

    TpProxyPendingCall * tp_cli_channel_interface_destroyable_call_destroy
                                                            (TpChannel *proxy,
                                                             gint timeout_ms,
                                                             tp_cli_channel_interface_destroyable_callback_for_destroy callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy,
                                                             GObject *weak_object);

Start a Destroy method call.

<tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>Close the channel abruptly, possibly with loss of data. The connection manager MUST NOT re-create the channel unless/until more events occur.</p> <tp:rationale> <p>The main motivating situation for this method is that when a Text channel with pending messages is closed with Close, it comes back as an incoming channel (to avoid a race between Close and an incoming message). If Destroy is called on a Text channel, the CM should delete all pending messages and close the channel, and the channel shouldn't be re-created until/unless another message arrives.</p> </tp:rationale> <p>Most clients SHOULD call <tp:dbus-ref namespace="org.freedesktop.Telepathy">Channel.Close</tp:dbus-ref> instead. However, if a client explicitly intends to destroy the channel with possible loss of data, it SHOULD call this method if this interface is supported (according to the <tp:dbus-ref namespace="org.freedesktop.Telepathy">Channel.Interfaces</tp:dbus-ref> property), falling back to Close if not.</p> <p>In particular, channel dispatchers SHOULD use this method if available when terminating channels that cannot be handled correctly (for instance, if no handler has been installed for a channel type, or if the handler crashes repeatedly).</p> <p>Connection managers do not need to implement this interface on channels where Close and Destroy would be equivalent.</p> <tp:rationale> <p>Callers need to be able to fall back to Close in any case.</p> </tp:rationale>

`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_interface_destroyable_callback_for_destroy ()

    void                (*tp_cli_channel_interface_destroyable_callback_for_destroy)
                                                            (TpChannel *proxy,
                                                             const GError *error,
                                                             gpointer user_data,
                                                             GObject *weak_object);

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

`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_interface_destroyable_run_destroy ()

    gboolean            tp_cli_channel_interface_destroyable_run_destroy
                                                            (TpChannel *proxy,
                                                             gint timeout_ms,
                                                             GError **error,
                                                             GMainLoop **loop);

Call the method Destroy and run the main loop until it returns. Before calling this method, you must add a reference to any borrowed objects you need to keep, and generally ensure that everything is in a consistent state.

<tp:docstring xmlns="http://www.w3.org/1999/xhtml"> <p>Close the channel abruptly, possibly with loss of data. The connection manager MUST NOT re-create the channel unless/until more events occur.</p> <tp:rationale> <p>The main motivating situation for this method is that when a Text channel with pending messages is closed with Close, it comes back as an incoming channel (to avoid a race between Close and an incoming message). If Destroy is called on a Text channel, the CM should delete all pending messages and close the channel, and the channel shouldn't be re-created until/unless another message arrives.</p> </tp:rationale> <p>Most clients SHOULD call <tp:dbus-ref namespace="org.freedesktop.Telepathy">Channel.Close</tp:dbus-ref> instead. However, if a client explicitly intends to destroy the channel with possible loss of data, it SHOULD call this method if this interface is supported (according to the <tp:dbus-ref namespace="org.freedesktop.Telepathy">Channel.Interfaces</tp:dbus-ref> property), falling back to Close if not.</p> <p>In particular, channel dispatchers SHOULD use this method if available when terminating channels that cannot be handled correctly (for instance, if no handler has been installed for a channel type, or if the handler crashes repeatedly).</p> <p>Connection managers do not need to implement this interface on channels where Close and Destroy would be equivalent.</p> <tp:rationale> <p>Callers need to be able to fall back to Close in any case.</p> </tp:rationale>

`proxy` : | A TpChannel or subclass
`timeout_ms` : | Timeout in milliseconds, or -1 for default
`error` : | If not `NULL`, used to return errors if `FALSE` is returned
`loop` : | If not `NULL`, set before re-entering the main loop, to point to a GMainLoop which can be used to cancel this call with `g_main_loop_quit()`, causing a return of `FALSE` with `error` set to `TP_DBUS_ERROR_CANCELLED`
Returns : | TRUE on success, FALSE and sets `error` on error

## Property Details

### The `"channel-properties"` property

      "channel-properties"       GHashTable_gchararray+GValue_*  : Read / Write / Construct Only

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

Read-only except during construction. If this is not provided during construction, a reasonable (but possibly incomplete) version will be made up from the values of individual properties; reading this property repeatedly may yield progressively more complete values until "channel-ready" becomes `TRUE`.

### The `"channel-ready"` property

      "channel-ready"            gboolean              : Read

Initially `FALSE`; changes to `TRUE` when introspection of the channel has finished and it's ready for use.

By the time this property becomes `TRUE`, the following will be true:

- "channel-type" set, unless introspection failed - "handle-type" and "handle" set, unless introspection failed - any extra interfaces will have been set up in TpProxy (i.e. "interfaces" contains at least all extra Channel interfaces)

In addition, if "interfaces" includes the Group interface:

- the initial value of the "group-self-handle" property will have been fetched and change notification will have been set up - the initial value of the "group-flags" property will have been fetched and change notification will have been set up

Change notification is via notify::channel-ready.

Default value: FALSE

### The `"connection"` property

      "connection"               TpConnection*         : Read / Write / Construct Only

The TpConnection to which this TpChannel belongs. Used for e.g. handle manipulation.

### The `"group-flags"` property

      "group-flags"              guint                 : Read

If this channel is ready ("channel-ready") and is a group, TpChannelGroupFlags indicating the capabilities and behaviour of that group.

Otherwise, 0.

Change notification is via notify::group-flags or TpChannel::group-flags-changed.

Default value: 0

Since 0.7.12

### The `"group-self-handle"` property

      "group-self-handle"        guint                 : Read

If this channel is ready ("channel-ready") and is a group, and the user is a member of it, the TpHandle representing them in this group.

Otherwise, either a handle representing the user, or 0.

Change notification is via notify::group-self-handle.

Default value: 0

Since 0.7.12

### The `"identifier"` property

      "identifier"               gchar*                : Read

This channel's associated identifier, or NULL if no identifier or unknown.

The identifier is the result of inspecting "handle".

Default value: NULL

## Signal Details

### The `"group-flags-changed"` signal

    void                user_function                      (TpChannel *self,
                                                            guint      added,
                                                            guint      removed,
                                                            gpointer   user_data)      : Run Last / Has Details

Emitted when the "group-flags" property changes while the channel is ready.

`self` : | a channel
`added` : | TpChannelGroupFlags which are newly set
`removed` : | TpChannelGroupFlags which are no longer set
`user_data` : | user data set when the signal handler was connected.

Since 0.7.12

### The `"group-members-changed"` signal

    void                user_function                      (TpChannel     *self,
                                                            gchar         *message,
                                                            GArray_guint_ *added,
                                                            GArray_guint_ *removed,
                                                            GArray_guint_ *local_pending,
                                                            GArray_guint_ *remote_pending,
                                                            guint          actor,
                                                            guint          reason,
                                                            gpointer       user_data)           : Run Last / Has Details

Emitted when the group members change in a Group channel that is ready.

`self` : | a channel
`message` : | an optional textual message
`added` : | a GArray of guint containing the full members added
`removed` : | a GArray of guint containing the members (full, local-pending or remote-pending) removed
`local_pending` : | a GArray of guint containing the local-pending members added
`remote_pending` : | a GArray of guint containing the remote-pending members added
`actor` : | the TpHandle of the contact causing the change, or 0
`reason` : | the reason for the change as a TpChannelGroupChangeReason
`user_data` : | user data set when the signal handler was connected.

Since 0.7.12

### The `"group-members-changed-detailed"` signal

    void                user_function                      (TpChannel     *self,
                                                            GArray_guint_ *added,
                                                            GArray_guint_ *removed,
                                                            GArray_guint_ *local_pending,
                                                            GArray_guint_ *remote_pending,
                                                            gpointer       user_data)           : Run Last / Has Details

Emitted when the group members change in a Group channel that is ready. Contains a superset of the information in the TpChannel::group-members-changed signal, and is emitted at the same time; applications can connect to this signal and ignore the other.

`self` : | a channel
`added` : | a GArray of guint containing the full members added
`removed` : | a GArray of guint containing the members (full, local-pending or remote-pending) removed
`local_pending` : | a GArray of guint containing the local-pending members added
`remote_pending` : | a GArray of guint containing the remote-pending members added
`details` : | a GHashTable mapping (gchar *) to GValue containing details about the change, as described in the specification of the MembersChangedDetailed signal.
`user_data` : | user data set when the signal handler was connected.

Since 0.7.21

## See Also

#TpConnection, channel-group, channel-text, channel-media