![]() |
![]() |
![]() |
telepathy-glib Reference Manual | ![]() |
---|---|---|---|---|
Top | Description | Object Hierarchy | Implemented Interfaces | Properties |
#include <telepathy-glib/base-client.h> TpBaseClient; 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 (*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
); gboolean tp_base_client_register (TpBaseClient *self
,GError **error
); const gchar * tp_base_client_get_bus_name (TpBaseClient *self
); const gchar * tp_base_client_get_object_path (TpBaseClient *self
);
TpBaseClient implements TpSvcDBusProperties, TpSvcClient, TpSvcClientObserver and TpSvcClientApprover.
"dbus-daemon" TpDBusDaemon* : Read / Write / Construct Only "name" gchar* : Read / Write / Construct Only "uniquify-name" gboolean : Read / Write / Construct Only
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.
See TpSimpleObserver for a class implementing a simple observer using TpBaseClient.
typedef struct _TpBaseClient TpBaseClient;
Data structure representing a generic TpSvcClient implementation.
Since 0.11.UNRELEASED
void tp_base_client_add_observer_filter (TpBaseClient *self
,GHashTable *filter
);
Register a new channel class as Observer.ObserverChannelFilter.
The observe_channels
virtual method set up using
tp_base_client_implement_observe_channels()
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 has called
tp_base_client_implement_observe_channels()
.
|
a TpBaseClient |
|
a TP_HASH_TYPE_CHANNEL_CLASS . transfer none. element-type utf8 GObject.Value. |
Since 0.11.UNRELEASED
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, ...)); |
|
a client |
|
a TP_HASH_TYPE_CHANNEL_CLASS , ownership of which is taken by self . transfer full. element-type utf8 GObject.Value. |
Since 0.11.UNRELEASED
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 has called
tp_base_client_implement_observe_channels()
.
|
a TpBaseClient |
|
the value of the Observer.Recover property |
Since 0.11.UNRELEASED
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.
|
a TpBaseClient instance |
|
a TpAccount having TP_ACCOUNT_FEATURE_CORE prepared if possible
|
|
a TpConnection having TP_CONNECTION_FEATURE_CORE prepared
if possible
|
|
a GList of TpChannel,
all having TP_CHANNEL_FEATURE_CORE prepared if possible. element-type TelepathyGLib.Channel. |
|
a TpChannelDispatchOperation or NULL ;
the dispatch_operation is not guaranteed to be prepared. allow-none. |
|
a GList of TpChannelRequest having their object-path defined but are not guaranteed to be prepared.. element-type TelepathyGLib.ChannelRequest. |
|
a TpObserveChannelsContext representing the context of this D-Bus call |
Since 0.11.UNRELEASED
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.
|
the TpBaseClientClass of the object |
|
the TpBaseClientClassObserveChannelsImpl function implementing
ObserveChannels()
|
Since 0.11.UNRELEASED
void tp_base_client_add_approver_filter (TpBaseClient *self
,GHashTable *filter
);
Register a new channel class as Approver.ApproverChannelFilter.
The add_dispatch_operation
virtual method set up using
tp_base_client_implement_add_dispatch_operation()
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 has called
tp_base_client_implement_add_dispatch_operation()
.
|
a TpBaseClient |
|
a TP_HASH_TYPE_CHANNEL_CLASS . transfer none. element-type utf8 GObject.Value. |
Since 0.11.UNRELEASED
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, ...)); |
|
a client |
|
a TP_HASH_TYPE_CHANNEL_CLASS , ownership of which is taken by self . transfer full. element-type utf8 GObject.Value. |
Since 0.11.UNRELEASED
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".
|
a TpBaseClient instance |
|
a TpAccount having TP_ACCOUNT_FEATURE_CORE prepared if possible
|
|
a TpConnection having TP_CONNECTION_FEATURE_CORE prepared
if possible
|
|
a GList of TpChannel,
all having TP_CHANNEL_FEATURE_CORE prepared if possible. element-type TelepathyGLib.Channel. |
|
a TpChannelDispatchOperation having
TP_CHANNEL_DISPATCH_OPERATION_FEATURE_CORE prepared if possible
|
|
a TpObserveChannelsContext representing the context of this D-Bus call |
Since 0.11.UNRELEASED
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.
|
the TpBaseClientClass of the object |
|
the TpBaseClientClassAddDispatchOperationImpl function implementing
AddDispatchOperation()
|
Since 0.11.UNRELEASED
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.
|
a TpBaseClient, which must not have been registered with
tp_base_client_register() yet
|
|
used to indicate the error if FALSE is returned
|
Returns : |
TRUE if the client was registered successfully
|
Since 0.11.UNRELEASED
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.
|
a TpBaseClient |
Returns : |
the bus name of the client |
Since 0.11.UNRELEASED
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.
|
a TpBaseClient |
Returns : |
the object path of the client |
Since 0.11.UNRELEASED
"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
.
Since 0.11.UNRELEASED
"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.UNRELEASED
"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.UNRELEASED