## TpBaseClient

TpBaseClient — base class for Telepathy clients on D-Bus

## Synopsis

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

                        TpBaseClient;
    struct              TpBaseClientClass;
    void                tp_base_client_add_observer_filter  (TpBaseClient *self,
                                                             GHashTable *filter);
    void                tp_base_client_take_observer_filter (TpBaseClient *self,
                                                             GHashTable *filter);
    void                tp_base_client_set_observer_recover (TpBaseClient *self,
                                                             gboolean recover);
    void                tp_base_client_set_observer_delay_approvers
                                                            (TpBaseClient *self,
                                                             gboolean delay);
    void                (*TpBaseClientClassObserveChannelsImpl)
                                                            (TpBaseClient *client,
                                                             TpAccount *account,
                                                             TpConnection *connection,
                                                             GList *channels,
                                                             TpChannelDispatchOperation *dispatch_operation,
                                                             GList *requests,
                                                             TpObserveChannelsContext *context);
    void                tp_base_client_implement_observe_channels
                                                            (TpBaseClientClass *klass,
                                                             TpBaseClientClassObserveChannelsImpl impl);
    void                tp_base_client_add_approver_filter  (TpBaseClient *self,
                                                             GHashTable *filter);
    void                tp_base_client_take_approver_filter (TpBaseClient *self,
                                                             GHashTable *filter);
    void                (*TpBaseClientClassAddDispatchOperationImpl)
                                                            (TpBaseClient *client,
                                                             TpAccount *account,
                                                             TpConnection *connection,
                                                             GList *channels,
                                                             TpChannelDispatchOperation *dispatch_operation,
                                                             TpAddDispatchOperationContext *context);
    void                tp_base_client_implement_add_dispatch_operation
                                                            (TpBaseClientClass *klass,
                                                             TpBaseClientClassAddDispatchOperationImpl impl);
    void                tp_base_client_add_handler_capabilities
                                                            (TpBaseClient *self,
                                                             const gchar * const *tokens);
    void                tp_base_client_add_handler_capabilities_varargs
                                                            (TpBaseClient *self,
                                                             const gchar *first_token,
                                                             ...);
    void                tp_base_client_add_handler_capability
                                                            (TpBaseClient *self,
                                                             const gchar *token);
    void                tp_base_client_add_handler_filter   (TpBaseClient *self,
                                                             GHashTable *filter);
    void                tp_base_client_take_handler_filter  (TpBaseClient *self,
                                                             GHashTable *filter);
    void                tp_base_client_be_a_handler         (TpBaseClient *self);
    void                (*TpBaseClientClassHandleChannelsImpl)
                                                            (TpBaseClient *client,
                                                             TpAccount *account,
                                                             TpConnection *connection,
                                                             GList *channels,
                                                             GList *requests_satisfied,
                                                             gint64 user_action_time,
                                                             TpHandleChannelsContext *context);
    void                tp_base_client_implement_handle_channels
                                                            (TpBaseClientClass *klass,
                                                             TpBaseClientClassHandleChannelsImpl impl);
    void                tp_base_client_add_account_features (TpBaseClient *self,
                                                             const GQuark *features,
                                                             gssize n);
    void                tp_base_client_add_account_features_varargs
                                                            (TpBaseClient *self,
                                                             GQuark feature,
                                                             ...);
    void                tp_base_client_add_connection_features
                                                            (TpBaseClient *self,
                                                             const GQuark *features,
                                                             gssize n);
    void                tp_base_client_add_connection_features_varargs
                                                            (TpBaseClient *self,
                                                             GQuark feature,
                                                             ...);
    void                tp_base_client_add_channel_features (TpBaseClient *self,
                                                             const GQuark *features,
                                                             gssize n);
    void                tp_base_client_add_channel_features_varargs
                                                            (TpBaseClient *self,
                                                             GQuark feature,
                                                             ...);
    GList *             tp_base_client_get_handled_channels (TpBaseClient *self);
    gboolean            tp_base_client_is_handling_channel  (TpBaseClient *self,
                                                             TpChannel *channel);
    void                tp_base_client_delegate_channels_async
                                                            (TpBaseClient *self,
                                                             GList *channels,
                                                             gint64 user_action_time,
                                                             const gchar *preferred_handler,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    gboolean            tp_base_client_delegate_channels_finish
                                                            (TpBaseClient *self,
                                                             GAsyncResult *result,
                                                             GPtrArray **delegated,
                                                             GHashTable **not_delegated,
                                                             GError **error);
    void                (*TpBaseClientDelegatedChannelsCb)  (TpBaseClient *client,
                                                             GPtrArray *channels,
                                                             gpointer user_data);
    void                tp_base_client_set_delegated_channels_callback
                                                            (TpBaseClient *self,
                                                             TpBaseClientDelegatedChannelsCb callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy);
    void                tp_channel_dispatcher_present_channel_async
                                                            (TpChannelDispatcher *self,
                                                             TpChannel *channel,
                                                             gint64 user_action_time,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);
    gboolean            tp_channel_dispatcher_present_channel_finish
                                                            (TpChannelDispatcher *self,
                                                             GAsyncResult *result,
                                                             GError **error);
    GList *             tp_base_client_get_pending_requests (TpBaseClient *self);
    void                tp_base_client_set_handler_bypass_approval
                                                            (TpBaseClient *self,
                                                             gboolean bypass_approval);
    void                tp_base_client_set_handler_request_notification
                                                            (TpBaseClient *self);
    gboolean            tp_base_client_register             (TpBaseClient *self,
                                                             GError **error);
    void                tp_base_client_unregister           (TpBaseClient *self);
    const gchar *       tp_base_client_get_bus_name         (TpBaseClient *self);
    const gchar *       tp_base_client_get_object_path      (TpBaseClient *self);
    TpDBusDaemon *      tp_base_client_get_dbus_daemon      (TpBaseClient *self);
    const gchar *       tp_base_client_get_name             (TpBaseClient *self);
    gboolean            tp_base_client_get_uniquify_name    (TpBaseClient *self);
    TpAccountManager *  tp_base_client_get_account_manager  (TpBaseClient *self);
    void                tp_base_client_set_channel_factory  (TpBaseClient *self,
                                                             TpClientChannelFactory *factory);
    TpClientChannelFactory * tp_base_client_get_channel_factory
                                                            (TpBaseClient *self);

## Object Hierarchy

      GObject
       +----TpBaseClient
             +----TpSimpleApprover
             +----TpSimpleHandler
             +----TpSimpleObserver

## Implemented Interfaces

TpBaseClient implements TpSvcDBusProperties, TpSvcClient, TpSvcClientObserver, TpSvcClientApprover, TpSvcClientHandler and TpSvcClientInterfaceRequests.

## Properties

      "account-manager"          TpAccountManager*     : Read / Write / Construct Only
      "channel-factory"          GObject*              : Read / Write / Construct Only
      "dbus-daemon"              TpDBusDaemon*         : Read / Write / Construct Only
      "factory"                  TpSimpleClientFactory*  : Read / Write / Construct Only
      "name"                     gchar*                : Read / Write / Construct Only
      "uniquify-name"            gboolean              : Read / Write / Construct Only

## Signals

      "request-added"                                  : Has Details
      "request-removed"                                : Has Details

## Description

This base class makes it easier to write TpSvcClient implementations. Subclasses should usually pass the filters they want and override the D-Bus methods they implement.

For many applications, the provided TpSimpleObserver, TpSimpleApprover and TpSimpleHandler subclasses can be used instead of deriving from this class.

## Details

### TpBaseClient

    typedef struct _TpBaseClient TpBaseClient;

Data structure representing a generic TpSvcClient implementation.

Since 0.11.5

### struct TpBaseClientClass

    struct TpBaseClientClass {
        GObjectClass parent_class;
        TpBaseClientClassObserveChannelsImpl observe_channels;
        TpBaseClientClassAddDispatchOperationImpl add_dispatch_operation;
        TpBaseClientClassHandleChannelsImpl handle_channels;
    };

The class of a TpBaseClient.

The virtual methods `observe_channels`, `add_dispatch_operation` and `handle_channels` can be also implemented by calling `tp_base_client_implement_observe_channels()`, `tp_base_client_implement_add_dispatch_operation()` and `tp_base_client_implement_handle_channels()`. This is compatible with telepathy-glib versions older than 0.11.13.

GObjectClass `parent_class`; | the parent class
TpBaseClientClassObserveChannelsImpl `observe_channels`; | the function called to observe newly-created channels matching this client's observer filter (since 0.11.13)
TpBaseClientClassAddDispatchOperationImpl `add_dispatch_operation`; | the function called to request user approval of unrequested (incoming) channels matching this client's approver filter (since 0.11.13)
TpBaseClientClassHandleChannelsImpl `handle_channels`; | the function called to handle channels matching this client's handler filter (since 0.11.13)

Since 0.11.5

### tp_base_client_add_observer_filter ()

    void                tp_base_client_add_observer_filter  (TpBaseClient *self,
                                                             GHashTable *filter);

Register a new channel class as Observer.ObserverChannelFilter. The TpBaseClientClass.observe_channels virtual method will be called whenever a new channel's properties match the ones in `filter`.

This method may only be called before `tp_base_client_register()` is called, and may only be called on objects whose class implements TpBaseClientClass.observe_channels.

`self` : | a TpBaseClient
`filter` : | a `TP_HASH_TYPE_CHANNEL_CLASS`. [transfer none][element-type utf8 GObject.Value]

Since 0.11.5

### tp_base_client_take_observer_filter ()

    void                tp_base_client_take_observer_filter (TpBaseClient *self,
                                                             GHashTable *filter);

The same as `tp_base_client_add_observer_filter()`, but ownership of `filter` is taken by `self`. This makes it convenient to call using `tp_asv_new()`:

    1
    2
    3
    4
    5
    6
    7

    tp_base_client_take_observer_filter (client,
       tp_asv_new (
           TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING,
               TP_IFACE_CHANNEL_TYPE_TEXT,
           TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT,
               TP_HANDLE_TYPE_CONTACT,
           ...));

`self` : | a client
`filter` : | a `TP_HASH_TYPE_CHANNEL_CLASS`, ownership of which is taken by `self`. [transfer full][element-type utf8 GObject.Value]

Since 0.11.5

### tp_base_client_set_observer_recover ()

    void                tp_base_client_set_observer_recover (TpBaseClient *self,
                                                             gboolean recover);

Set whether the channel dispatcher should attempt to recover this Observer if it crashes. (This is implemented by setting the value of its Recover D-Bus property.)

Normally, Observers are only notified when new channels appear. If an Observer is set to recover, when it registers with `tp_base_client_register()`, it will also be told about any channels that already existed before it started.

For Observers that are activatable as a D-Bus service, if the Observer exits or crashes while there are any channels that match its filter, it will automatically be restarted by service-activation.

This method may only be called before `tp_base_client_register()` is called, and may only be called on objects whose class implements TpBaseClientClass.observe_channels.

`self` : | a TpBaseClient
`recover` : | the value of the Observer.Recover property

Since 0.11.5

### tp_base_client_set_observer_delay_approvers ()

    void                tp_base_client_set_observer_delay_approvers
                                                            (TpBaseClient *self,
                                                             gboolean delay);

Set whether the channel dispatcher should wait for `tp_observe_channels_context_accept()` or `tp_observe_channels_context_fail()` to be called before calling TpBaseClientClass.add_dispatch_operation on appropriate Approvers.

This is implemented by setting the value of the DelayApprovers D-Bus property.

This method may only be called before `tp_base_client_register()` is called, and may only be called on objects whose class implements TpBaseClientClass.observe_channels.

`self` : | a TpBaseClient
`delay` : | the value of the Observer.DelayApprovers property

Since 0.13.16

### TpBaseClientClassObserveChannelsImpl ()

    void                (*TpBaseClientClassObserveChannelsImpl)
                                                            (TpBaseClient *client,
                                                             TpAccount *account,
                                                             TpConnection *connection,
                                                             GList *channels,
                                                             TpChannelDispatchOperation *dispatch_operation,
                                                             GList *requests,
                                                             TpObserveChannelsContext *context);

Signature of the implementation of the ObserveChannels method.

This function must call either `tp_observe_channels_context_accept()`, `tp_observe_channels_context_delay()` or `tp_observe_channels_context_fail()` on `context` before it returns.

`client` : | a TpBaseClient instance
`account` : | a TpAccount with `TP_ACCOUNT_FEATURE_CORE`, and any other features added via `tp_base_client_add_account_features()` or `tp_simple_client_factory_add_account_features()`, prepared if possible
`connection` : | a TpConnection with `TP_CONNECTION_FEATURE_CORE`, and any other features added via `tp_base_client_add_connection_features()`, or `tp_simple_client_factory_add_connection_features()`, prepared if possible
`channels` : | a GList of TpChannel, each with `TP_CHANNEL_FEATURE_CORE`, and any other features added via `tp_base_client_add_channel_features()` or `tp_simple_client_factory_add_channel_features()`, prepared if possible. [element-type TelepathyGLib.Channel]
`dispatch_operation` : | a TpChannelDispatchOperation or `NULL`; the dispatch_operation is not guaranteed to be prepared. [allow-none]
`requests` : | a GList of TpChannelRequest having their object-path defined but are not guaranteed to be prepared. [element-type TelepathyGLib.ChannelRequest]
`context` : | a TpObserveChannelsContext representing the context of this D-Bus call

Since 0.11.5

### tp_base_client_implement_observe_channels ()

    void                tp_base_client_implement_observe_channels
                                                            (TpBaseClientClass *klass,
                                                             TpBaseClientClassObserveChannelsImpl impl);

Called by subclasses to define the actual implementation of the `ObserveChannels()` D-Bus method.

Since 0.11.13 this is exactly equivalent to setting the TpBaseClientClass.observe_channels function pointer.

`klass` : | the TpBaseClientClass of the object
`impl` : | the TpBaseClientClassObserveChannelsImpl function implementing `ObserveChannels()`

Since 0.11.5

### tp_base_client_add_approver_filter ()

    void                tp_base_client_add_approver_filter  (TpBaseClient *self,
                                                             GHashTable *filter);

Register a new channel class as Approver.ApproverChannelFilter. The TpBaseClientClass.add_dispatch_operation virtual method will be called whenever a new channel's properties match the ones in `filter`.

This method may only be called before `tp_base_client_register()` is called, and may only be called on objects whose class implements TpBaseClientClass.add_dispatch_operation.

`self` : | a TpBaseClient
`filter` : | a `TP_HASH_TYPE_CHANNEL_CLASS`. [transfer none][element-type utf8 GObject.Value]

Since 0.11.5

### tp_base_client_take_approver_filter ()

    void                tp_base_client_take_approver_filter (TpBaseClient *self,
                                                             GHashTable *filter);

The same as `tp_base_client_add_approver_filter()`, but ownership of `filter` is taken by `self`. This makes it convenient to call using `tp_asv_new()`:

    1
    2
    3
    4
    5
    6
    7

    tp_base_client_take_approver_filter (client,
       tp_asv_new (
           TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING,
               TP_IFACE_CHANNEL_TYPE_TEXT,
           TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT,
               TP_HANDLE_TYPE_CONTACT,
           ...));

`self` : | a client
`filter` : | a `TP_HASH_TYPE_CHANNEL_CLASS`, ownership of which is taken by `self`. [transfer full][element-type utf8 GObject.Value]

Since 0.11.5

### TpBaseClientClassAddDispatchOperationImpl ()

    void                (*TpBaseClientClassAddDispatchOperationImpl)
                                                            (TpBaseClient *client,
                                                             TpAccount *account,
                                                             TpConnection *connection,
                                                             GList *channels,
                                                             TpChannelDispatchOperation *dispatch_operation,
                                                             TpAddDispatchOperationContext *context);

Signature of the implementation of the AddDispatchOperation method.

This function must call either `tp_add_dispatch_operation_context_accept()`, `tp_add_dispatch_operation_context_delay()` or `tp_add_dispatch_operation_context_fail()` on `context` before it returns.

The implementation can then use `tp_channel_dispatch_operation_handle_with_async()` to approve handling of the channels, or `tp_channel_dispatch_operation_claim_async()` to take responsibility for handling or closing them".

`client` : | a TpBaseClient instance
`account` : | a TpAccount with `TP_ACCOUNT_FEATURE_CORE`, and any other features added via `tp_base_client_add_account_features()` or `tp_simple_client_factory_add_account_features()`, prepared if possible
`connection` : | a TpConnection with `TP_CONNECTION_FEATURE_CORE`, and any other features added via `tp_base_client_add_connection_features()`, or `tp_simple_client_factory_add_connection_features()`, prepared if possible
`channels` : | a GList of TpChannel, each with `TP_CHANNEL_FEATURE_CORE`, and any other features added via `tp_base_client_add_channel_features()` or `tp_simple_client_factory_add_channel_features()`, prepared if possible. [element-type TelepathyGLib.Channel]
`dispatch_operation` : | a TpChannelDispatchOperation having `TP_CHANNEL_DISPATCH_OPERATION_FEATURE_CORE` prepared if possible
`context` : | a TpObserveChannelsContext representing the context of this D-Bus call

Since 0.11.5

### tp_base_client_implement_add_dispatch_operation ()

    void                tp_base_client_implement_add_dispatch_operation
                                                            (TpBaseClientClass *klass,
                                                             TpBaseClientClassAddDispatchOperationImpl impl);

Called by subclasses to define the actual implementation of the `AddDispatchOperation()` D-Bus method.

Since 0.11.13 this is exactly equivalent to setting the TpBaseClientClass.add_dispatch_operation function pointer.

`klass` : | the TpBaseClientClass of the object
`impl` : | the TpBaseClientClassAddDispatchOperationImpl function implementing `AddDispatchOperation()`

Since 0.11.5

### tp_base_client_add_handler_capabilities ()

    void                tp_base_client_add_handler_capabilities
                                                            (TpBaseClient *self,
                                                             const gchar * const *tokens);

Add several capability tokens to this client. These are used to signal that Telepathy connection managers should advertise certain capabilities to other contacts, such as the ability to receive audio/video calls using particular streaming protocols and codecs.

This method may only be called before `tp_base_client_register()` is called, and may only be called on objects whose class implements TpBaseClientClass.handle_channels.

`self` : | a client, which must not have been registered with `tp_base_client_register()` yet
`tokens` : | capability tokens as defined by the Telepathy D-Bus API Specification. [array zero-terminated=1][element-type utf8]

Since 0.11.6

### tp_base_client_add_handler_capabilities_varargs ()

    void                tp_base_client_add_handler_capabilities_varargs
                                                            (TpBaseClient *self,
                                                             const gchar *first_token,
                                                             ...);

Convenience C API equivalent to calling `tp_base_client_add_handler_capability()` for each capability token.

This method may only be called before `tp_base_client_register()` is called, and may only be called on objects whose class implements TpBaseClientClass.handle_channels.

`self` : | a client, which must not have been registered with `tp_base_client_register()` yet
`first_token` : | a capability token from the Telepathy D-Bus API Specification
`...` : | more tokens, ending with `NULL`

Since 0.11.6

### tp_base_client_add_handler_capability ()

    void                tp_base_client_add_handler_capability
                                                            (TpBaseClient *self,
                                                             const gchar *token);

Add one capability token to this client, as if via `tp_base_client_add_handler_capabilities()`.

This method may only be called before `tp_base_client_register()` is called, and may only be called on objects whose class implements TpBaseClientClass.handle_channels.

`self` : | a client, which must not have been registered with `tp_base_client_register()` yet
`token` : | a capability token as defined by the Telepathy D-Bus API Specification

Since 0.11.6

### tp_base_client_add_handler_filter ()

    void                tp_base_client_add_handler_filter   (TpBaseClient *self,
                                                             GHashTable *filter);

Register a new channel class as Handler.HandlerChannelFilter. The TpBaseClientClass.handle_channels virtual method will be called whenever a new channel's properties match the ones in `filter`.

This method may only be called before `tp_base_client_register()` is called, and may only be called on objects whose class implements TpBaseClientClass.handle_channels.

`self` : | a TpBaseClient
`filter` : | a `TP_HASH_TYPE_CHANNEL_CLASS`. [transfer none][element-type utf8 GObject.Value]

Since 0.11.6

### tp_base_client_take_handler_filter ()

    void                tp_base_client_take_handler_filter  (TpBaseClient *self,
                                                             GHashTable *filter);

The same as `tp_base_client_add_handler_filter()`, but ownership of `filter` is taken by `self`. This makes it convenient to call using `tp_asv_new()`:

    1
    2
    3
    4
    5
    6
    7

    tp_base_client_take_handler_filter (client,
       tp_asv_new (
           TP_PROP_CHANNEL_CHANNEL_TYPE, G_TYPE_STRING,
               TP_IFACE_CHANNEL_TYPE_TEXT,
           TP_PROP_CHANNEL_TARGET_HANDLE_TYPE, G_TYPE_UINT,
               TP_HANDLE_TYPE_CONTACT,
           ...));

`self` : | a TpBaseClient
`filter` : | a `TP_HASH_TYPE_CHANNEL_CLASS`, ownership of which is taken by `self`. [transfer full][element-type utf8 GObject.Value]

Since 0.11.6

### tp_base_client_be_a_handler ()

    void                tp_base_client_be_a_handler         (TpBaseClient *self);

Register `self` as a Client.Handler with an empty list of filters. This is useful if you want to create a client that only handle channels for which it's the PreferredHandler.

This method may only be called before `tp_base_client_register()` is called, and may only be called on objects whose class implements TpBaseClientClass.handle_channels.

`self` : | a TpBaseClient

Since 0.11.6

### TpBaseClientClassHandleChannelsImpl ()

    void                (*TpBaseClientClassHandleChannelsImpl)
                                                            (TpBaseClient *client,
                                                             TpAccount *account,
                                                             TpConnection *connection,
                                                             GList *channels,
                                                             GList *requests_satisfied,
                                                             gint64 user_action_time,
                                                             TpHandleChannelsContext *context);

Signature of the implementation of the HandleChannels method.

This function must call either `tp_handle_channels_context_accept()`, `tp_handle_channels_context_delay()` or `tp_handle_channels_context_fail()` on `context` before it returns.

`client` : | a TpBaseClient instance
`account` : | a TpAccount with `TP_ACCOUNT_FEATURE_CORE`, and any other features added via `tp_base_client_add_account_features()` or `tp_simple_client_factory_add_account_features()`, prepared if possible
`connection` : | a TpConnection with `TP_CONNECTION_FEATURE_CORE`, and any other features added via `tp_base_client_add_connection_features()`, or `tp_simple_client_factory_add_connection_features()`, prepared if possible
`channels` : | a GList of TpChannel, each with `TP_CHANNEL_FEATURE_CORE`, and any other features added via `tp_base_client_add_channel_features()` or `tp_simple_client_factory_add_channel_features()`, prepared if possible. [element-type TelepathyGLib.Channel]
`requests_satisfied` : | a GList of TpChannelRequest having their object-path defined but are not guaranteed to be prepared. [element-type TelepathyGLib.ChannelRequest]
`user_action_time` : | the time at which user action occurred, or one of the special values `TP_USER_ACTION_TIME_NOT_USER_ACTION` or `TP_USER_ACTION_TIME_CURRENT_TIME` (see "user-action-time" for details)
`context` : | a TpHandleChannelsContext representing the context of this D-Bus call

Since 0.11.6

### tp_base_client_implement_handle_channels ()

    void                tp_base_client_implement_handle_channels
                                                            (TpBaseClientClass *klass,
                                                             TpBaseClientClassHandleChannelsImpl impl);

Called by subclasses to define the actual implementation of the `HandleChannels()` D-Bus method.

Since 0.11.13 this is exactly equivalent to setting the TpBaseClientClass.handle_channels function pointer.

`klass` : | the TpBaseClientClass of the object
`impl` : | the TpBaseClientClassHandleChannelsImpl function implementing `HandleCHannels()`

Since 0.11.6

### tp_base_client_add_account_features ()

    void                tp_base_client_add_account_features (TpBaseClient *self,
                                                             const GQuark *features,
                                                             gssize n);

### Warning

`tp_base_client_add_account_features` is deprecated and should not be used in newly-written code. New code should use `tp_simple_client_factory_add_account_features()` instead.

Request that the given features are prepared on each TpAccount (in addition to `TP_ACCOUNT_FEATURE_CORE`) before calling TpBaseClientClass.observe_channels, TpBaseClientClass.add_dispatch_operation or TpBaseClientClass.handle_channels, or emitting "request-added".

`self` : | a client
`features` : | the features. [array length=n]
`n` : | the number of features, or -1 if `features` is 0-terminated

Since 0.11.14

### tp_base_client_add_account_features_varargs ()

    void                tp_base_client_add_account_features_varargs
                                                            (TpBaseClient *self,
                                                             GQuark feature,
                                                             ...);

### Warning

`tp_base_client_add_account_features_varargs` is deprecated and should not be used in newly-written code. New code should use `tp_simple_client_factory_add_account_features_varargs()` instead.

The same as `tp_base_client_add_account_features()`, but with a more convenient calling convention from C.

`self` : | a client
`feature` : | the first feature
`...` : | the second and subsequent features, if any, ending with 0

Since 0.11.14

### tp_base_client_add_connection_features ()

    void                tp_base_client_add_connection_features
                                                            (TpBaseClient *self,
                                                             const GQuark *features,
                                                             gssize n);

### Warning

`tp_base_client_add_connection_features` is deprecated and should not be used in newly-written code. New code should use `tp_simple_client_factory_add_connection_features()` instead.

Request that the given features are prepared on each TpConnection (in addition to `TP_CONNECTION_FEATURE_CORE`) before calling TpBaseClientClass.observe_channels, TpBaseClientClass.add_dispatch_operation or TpBaseClientClass.handle_channels.

`self` : | a client
`features` : | the features. [array length=n]
`n` : | the number of features, or -1 if `features` is 0-terminated

Since 0.11.14

### tp_base_client_add_connection_features_varargs ()

    void                tp_base_client_add_connection_features_varargs
                                                            (TpBaseClient *self,
                                                             GQuark feature,
                                                             ...);

### Warning

`tp_base_client_add_connection_features_varargs` is deprecated and should not be used in newly-written code. New code should use `tp_simple_client_factory_add_connection_features_varargs()` instead.

The same as `tp_base_client_add_connection_features()`, but with a more convenient calling convention from C.

`self` : | a client
`feature` : | the first feature
`...` : | the second and subsequent features, if any, ending with 0

Since 0.11.14

### tp_base_client_add_channel_features ()

    void                tp_base_client_add_channel_features (TpBaseClient *self,
                                                             const GQuark *features,
                                                             gssize n);

### Warning

`tp_base_client_add_channel_features` is deprecated and should not be used in newly-written code. New code should use `tp_simple_client_factory_add_channel_features()` instead.

Request that the given features are prepared on each TpChannel (in addition to `TP_CHANNEL_FEATURE_CORE`) before calling TpBaseClientClass.observe_channels, TpBaseClientClass.add_dispatch_operation or TpBaseClientClass.handle_channels.

`self` : | a client
`features` : | the features. [array length=n]
`n` : | the number of features, or -1 if `features` is 0-terminated

Since 0.11.14

### tp_base_client_add_channel_features_varargs ()

    void                tp_base_client_add_channel_features_varargs
                                                            (TpBaseClient *self,
                                                             GQuark feature,
                                                             ...);

### Warning

`tp_base_client_add_channel_features_varargs` is deprecated and should not be used in newly-written code. New code should use `tp_simple_client_factory_add_channel_features_varargs()` instead.

The same as `tp_base_client_add_channel_features()`, but with a more convenient calling convention from C.

`self` : | a client
`feature` : | the first feature
`...` : | the second and subsequent features, if any, ending with 0

Since 0.11.14

### tp_base_client_get_handled_channels ()

    GList *             tp_base_client_get_handled_channels (TpBaseClient *self);

Returns the set of channels currently handled by this base client or by any other TpBaseClient with which it shares a unique name.

`self` : | a TpBaseClient
Returns : | the handled channels. [transfer container][element-type TelepathyGLib.Channel]

Since 0.11.6

### tp_base_client_is_handling_channel ()

    gboolean            tp_base_client_is_handling_channel  (TpBaseClient *self,
                                                             TpChannel *channel);

Check if `self` is currently handling `channel`.

`self` : | a TpBaseClient
`channel` : | a TpChannel
Returns : | `TRUE` if `self` is handling `channel`, `FALSE` otherwise

Since 0.14.5

### tp_base_client_delegate_channels_async ()

    void                tp_base_client_delegate_channels_async
                                                            (TpBaseClient *self,
                                                             GList *channels,
                                                             gint64 user_action_time,
                                                             const gchar *preferred_handler,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Asynchronously calls DelegateChannels on the ChannelDispatcher to try stopping handling `channels` and pass them to another Handler. You can then call `tp_base_client_delegate_channels_finish()` to get the result of the operation.

`self` : | a TpBaseClient
`channels` : | a GList of TpChannel handled by `self`. [element-type TelepathyGLib.Channel]
`user_action_time` : | the time at which user action occurred, or TP_USER_ACTION_TIME_NOT_USER_ACTION if this delegation request is for some reason not involving user action.
`preferred_handler` : | Either the well-known bus name (starting with `TP_CLIENT_BUS_NAME_BASE`) of the preferred handler for the channels, or `NULL` to indicate that any handler but `self` would be acceptable.
`callback` : | a callback to call when the request is satisfied
`user_data` : | data to pass to `callback`

Since 0.15.0

### tp_base_client_delegate_channels_finish ()

    gboolean            tp_base_client_delegate_channels_finish
                                                            (TpBaseClient *self,
                                                             GAsyncResult *result,
                                                             GPtrArray **delegated,
                                                             GHashTable **not_delegated,
                                                             GError **error);

Finishes an async channels delegation request started using `tp_base_client_delegate_channels_async()`.

`self` : | a TpBaseClient
`result` : | a GAsyncResult
`delegated` : | if not `NULL`, used to return a GPtrArray containing the TpChannels which have been properly delegated. [out][element-type TelepathyGLib.Channel][transfer container]
`not_delegated` : | if not not `NULL`, used to return a GHashTable mapping TpChannels which have not been delegated to a GError explaining the reason of the failure. [out][element-type TelepathyGLib.Channel GLib.Error][transfer container]
`error` : | a GError to fill
Returns : | `TRUE` if the operation succeed, `delegated` and `not_delegated` can be used to know the channels that `self` is not handling any more, otherwise `FALSE`.

Since 0.15.0

### TpBaseClientDelegatedChannelsCb ()

    void                (*TpBaseClientDelegatedChannelsCb)  (TpBaseClient *client,
                                                             GPtrArray *channels,
                                                             gpointer user_data);

Called when a client asked us to delegate `channels` to another Handler. When this function is called `client` is not longer handling `channels`.

`client` : | a TpBaseClient instance
`channels` : | a GPtrArray of TpChannel. [element-type TelepathyGLib.Channel]
`user_data` : | arbitrary user-supplied data passed to `tp_base_client_set_delegated_channels_callback()`

Since 0.15.3

### tp_base_client_set_delegated_channels_callback ()

    void                tp_base_client_set_delegated_channels_callback
                                                            (TpBaseClient *self,
                                                             TpBaseClientDelegatedChannelsCb callback,
                                                             gpointer user_data,
                                                             GDestroyNotify destroy);

Turn on support for the org.freedesktop.Telepathy.ChannelRequest.DelegateToPreferredHandler hint.

When receiving a request containing this hint, `self` will automatically delegate the channels to the preferred handler of the request and then call `callback` to inform the client that it is no longer handling those channels.

`self` : | a TpBaseClient implementing Handler
`callback` : | function called when channels currently handled by `self` are delegated, may not be `NULL`
`user_data` : | arbitrary user-supplied data passed to `callback`
`destroy` : | called with the `user_data` as argument, when `self` is destroyed

Since 0.15.3

### tp_channel_dispatcher_present_channel_async ()

    void                tp_channel_dispatcher_present_channel_async
                                                            (TpChannelDispatcher *self,
                                                             TpChannel *channel,
                                                             gint64 user_action_time,
                                                             GAsyncReadyCallback callback,
                                                             gpointer user_data);

Asynchronously calls PresentChannel on the ChannelDispatcher to ask to the handler of `channel` to re-present it to the user. You can then call `tp_channel_dispatcher_present_channel_finish()` to get the result of the operation.

`self` : | a TpChannelDispatcher
`channel` : | a TpChannel
`user_action_time` : | the time at which user action occurred, or TP_USER_ACTION_TIME_NOT_USER_ACTION if this presentation request is for some reason not involving user action.
`callback` : | a callback to call when the request is satisfied
`user_data` : | data to pass to `callback`

Since 0.15.0

### tp_channel_dispatcher_present_channel_finish ()

    gboolean            tp_channel_dispatcher_present_channel_finish
                                                            (TpChannelDispatcher *self,
                                                             GAsyncResult *result,
                                                             GError **error);

Finishes an async channel presentation request started using `tp_channel_dispatcher_present_channel_async()`.

`self` : | a TpBaseClient
`result` : | a GAsyncResult
`error` : | a GError to fill
Returns : | `TRUE` if the call succeeded, otherwise `FALSE`.

Since 0.15.0

### tp_base_client_get_pending_requests ()

    GList *             tp_base_client_get_pending_requests (TpBaseClient *self);

Only works if `tp_base_client_set_handler_request_notification()` has been called. Returns the list of requests `self` is likely be asked to handle.

`self` : | a TpBaseClient
Returns : | a GList of TpChannelRequest. [transfer container][element-type TelepathyGLib.ChannelRequest]

Since 0.11.6

### tp_base_client_set_handler_bypass_approval ()

    void                tp_base_client_set_handler_bypass_approval
                                                            (TpBaseClient *self,
                                                             gboolean bypass_approval);

Set whether the channels destined for this handler are automatically handled, without invoking approvers. (This is implemented by setting the value of its BypassApproval D-Bus property.)

This method may only be called before `tp_base_client_register()` is called, and may only be called on objects whose class implements TpBaseClientClass.handle_channels.

`self` : | a TpBaseClient
`bypass_approval` : | the value of the Handler.BypassApproval property

Since 0.11.6

### tp_base_client_set_handler_request_notification ()

    void                tp_base_client_set_handler_request_notification
                                                            (TpBaseClient *self);

Indicate that `self` is a Handler willing to be notified about requests for channels that it is likely to be asked to handle. This means that the "request-added" and "request-removed" signals will be fired and `tp_base_client_get_pending_requests()` will return the list of pending requests.

This method may only be called before `tp_base_client_register()` is called, and may only be called on objects whose class implements TpBaseClientClass.handle_channels.

`self` : | a TpBaseClient

Since 0.11.6

### tp_base_client_register ()

    gboolean            tp_base_client_register             (TpBaseClient *self,
                                                             GError **error);

Publish `self` as an available client. After this method is called, as long as it continues to exist, it will receive and process whatever events were requested via the various filters.

Methods that set the filters and other immutable state, such as `tp_base_client_add_observer_filter()`, cannot be called after this one.

`self` : | a TpBaseClient, which must not have been registered with `tp_base_client_register()` yet
`error` : | used to indicate the error if `FALSE` is returned
Returns : | `TRUE` if the client was registered successfully

Since 0.11.5

### tp_base_client_unregister ()

    void                tp_base_client_unregister           (TpBaseClient *self);

Remove this client object from D-Bus, if `tp_base_client_register()` has already been called.

If the object is not registered, this method may be called, but has no effect.

Releasing the last reference to the object also has the same effect as calling this method, but this method should be preferred, as it has more deterministic behaviour.

If the object still exists, `tp_base_client_register()` may be used to attempt to register it again.

`self` : | a client, which may already have been registered with `tp_base_client_register()`, or not

Since 0.11.6

### tp_base_client_get_bus_name ()

    const gchar *       tp_base_client_get_bus_name         (TpBaseClient *self);

Return the bus name of `self`. Note that doesn't mean the client is actually owning this name; for example if `tp_base_client_register()` has not been called yet or failed.

`self` : | a TpBaseClient
Returns : | the bus name of the client

Since 0.11.5

### tp_base_client_get_object_path ()

    const gchar *       tp_base_client_get_object_path      (TpBaseClient *self);

Return the object path of `self`. Note that doesn't mean the client is actually registered on this path; for example if `tp_base_client_register()` has not been called yet or failed.

`self` : | a TpBaseClient
Returns : | the object path of the client

Since 0.11.5

### tp_base_client_get_dbus_daemon ()

    TpDBusDaemon *      tp_base_client_get_dbus_daemon      (TpBaseClient *self);

Return the "dbus-daemon" construct-only property, which represents the D-Bus connection used to export this client object.

The returned object's reference count is not incremented, so it is not necessarily valid after `self` is destroyed.

`self` : | a TpBaseClient
Returns : | the value of "dbus-daemon". [transfer none]

Since 0.11.11

### tp_base_client_get_name ()

    const gchar *       tp_base_client_get_name             (TpBaseClient *self);

Return the "name" construct-only property, which is used as part of the bus name and object path.

`self` : | a TpBaseClient
Returns : | the value of "name"

Since 0.11.11

### tp_base_client_get_uniquify_name ()

    gboolean            tp_base_client_get_uniquify_name    (TpBaseClient *self);

Return the "uniquify-name" construct-only property; if this is true, the bus name and object path will be made unique by appending a suffix that includes the D-Bus unique name and a per-process counter.

`self` : | a TpBaseClient
Returns : | the value of "uniquify-name"

Since 0.11.11

### tp_base_client_get_account_manager ()

    TpAccountManager *  tp_base_client_get_account_manager  (TpBaseClient *self);

### Warning

`tp_base_client_get_account_manager` is deprecated and should not be used in newly-written code. New code should not use this function, it may return `NULL` in the case `self` was constructed with a TpSimpleClientFactory.

Return the "account-manager" construct-only property, which is the account manager used to look up or create TpAccount objects.

The returned object's reference count is not incremented, so it is not necessarily valid after `self` is destroyed.

It is not guaranteed that any particular features are prepared on this object; enable and wait for features with `tp_proxy_prepare_async()`.

`self` : | a TpBaseClient
Returns : | the value of "account-manager". [transfer none]

Since 0.11.14

### tp_base_client_set_channel_factory ()

    void                tp_base_client_set_channel_factory  (TpBaseClient *self,
                                                             TpClientChannelFactory *factory);

### Warning

`tp_base_client_set_channel_factory` is deprecated and should not be used in newly-written code. since 0.15.5. The factory is taken from "account-manager".

Change the value of the "channel-factory" property. It can't be changed once `self` has been registered.

`self` : | a TpBaseClient
`factory` : | an object implementing the TpClientChannelFactoryInterface interface

Since 0.13.2

### tp_base_client_get_channel_factory ()

    TpClientChannelFactory * tp_base_client_get_channel_factory
                                                            (TpBaseClient *self);

### Warning

`tp_base_client_get_channel_factory` is deprecated and should not be used in newly-written code. since 0.15.5. The factory is taken from "account-manager".

Return the "channel-factory" property.

`self` : | a TpBaseClient
Returns : | the value of "channel-factory"

Since 0.13.2

## Property Details

### The `"account-manager"` property

      "account-manager"          TpAccountManager*     : Read / Write / Construct Only

### Warning

`TpBaseClient:account-manager` is deprecated and should not be used in newly-written code. New code should not use this property, it may be `NULL` in the case `self` was constructed with a TpSimpleClientFactory.

Account manager for this base client, used to look up or create TpAccount objects. This may be specified in the constructor in order to get existing TpAccount objects.

It is not guaranteed that any of its features have been prepared, and it is not necessary to wait for any features before specifying this property in the constructor.

Clients that interact with the TpAccount should usually set this property instead of "dbus-daemon". Doing this will ensure that each account, connection or contact is represented by a single TpAccount, TpConnection or TpContact object, shared between all the cooperating modules that have the same TpAccountManager.

If the "dbus-daemon" is set to the result of `tp_dbus_daemon_dup()`, then this property defaults to the result of `tp_account_manager_dup()`.

This property may be `NULL` initially, but will always be non-`NULL` after the TpBaseClient has been constructed.

It is an error to specify both a non-`NULL` account manager, and a non-`NULL` "dbus-daemon" that is not the same as the account manager's "dbus-daemon".

Since 0.11.14

### The `"channel-factory"` property

      "channel-factory"          GObject*              : Read / Write / Construct Only

### Warning

`TpBaseClient:channel-factory` is deprecated and should not be used in newly-written code. since 0.15.5. The factory is taken from "account-manager".

The object implementing the TpClientChannelFactoryInterface interface that will be used to create channel proxies. While `tp_base_client_register()` has not yet been called, this property can be changed using `tp_base_client_set_channel_factory()`.

If no channel factory is specified then TpAutomaticProxyFactory is used.

Since 0.13.2

### The `"dbus-daemon"` property

      "dbus-daemon"              TpDBusDaemon*         : Read / Write / Construct Only

TpDBusDaemon object encapsulating this object's connection to D-Bus. Read-only except during construction.

This property can't be `NULL` after construction.

Since 0.11.14 this property may be `NULL` or unspecified in `g_object_new()`, but only if "account-manager" is provided instead, in which case its "dbus-daemon" property will be used.

Since 0.11.5

### The `"factory"` property

      "factory"                  TpSimpleClientFactory*  : Read / Write / Construct Only

Factory for this base client, used to look up or create TpAccount objects.

Since 0.15.5

### The `"name"` property

      "name"                     gchar*                : Read / Write / Construct Only

The name of the client. This is used to register the D-Bus service name and object path of the service.

This property can't be `NULL`.

Default value: NULL

Since 0.11.5

### The `"uniquify-name"` property

      "uniquify-name"            gboolean              : Read / Write / Construct Only

If `TRUE`, `tp_base_client_register()` will append an unique token to the service bus name and object path to ensure they are unique.

Default value: FALSE

Since 0.11.5

## Signal Details

### The `"request-added"` signal

    void                user_function                      (TpBaseClient     *self,
                                                            TpAccount        *account,
                                                            TpChannelRequest *request,
                                                            gpointer          user_data)      : Has Details

Emitted when a channels have been requested, and that if the request is successful, they will probably be handled by this Handler.

This signal is only fired if `tp_base_client_set_handler_request_notification()` has been called on `self` previously.

`self` : | a TpBaseClient
`account` : | the TpAccount on which the request was made, with `TP_ACCOUNT_FEATURE_CORE`, and any other features added via `tp_base_client_add_account_features()` or `tp_simple_client_factory_add_account_features()`, prepared if possible
`request` : | a TpChannelRequest having its object-path defined but is not guaranteed to be prepared.
`user_data` : | user data set when the signal handler was connected.

Since 0.11.6

### The `"request-removed"` signal

    void                user_function                      (TpBaseClient     *self,
                                                            TpChannelRequest *request,
                                                            gchar            *error,
                                                            gchar            *message,
                                                            gpointer          user_data)      : Has Details

Emitted when a request has failed and should be disregarded.

This signal is only fired if `tp_base_client_set_handler_request_notification()` has been called on `self` previously.

`self` : | a TpBaseClient
`request` : | the TpChannelRequest being removed
`error` : | the name of the D-Bus error with which the request failed.
`message` : | any message supplied with the D-Bus error.
`user_data` : | user data set when the signal handler was connected.

Since 0.11.6