| telepathy-glib Reference Manual | ||||
|---|---|---|---|---|
| Top | Description | Object Hierarchy | Implemented Interfaces | Properties | ||||
TpSimpleHandlerTpSimpleHandler — a subclass of TpBaseClient implementing a simple Handler |
#include <telepathy-glib/simple-handler.h>
TpSimpleHandler;
void (*TpSimpleHandlerHandleChannelsImpl)
(TpSimpleHandler *self,
TpAccount *account,
TpConnection *connection,
GList *channels,
GList *requests_satisfied,
gint64 user_action_time,
TpHandleChannelsContext *context,
gpointer user_data);
TpBaseClient * tp_simple_handler_new (TpDBusDaemon *dbus,
gboolean bypass_approval,
gboolean requests,
const gchar *name,
gboolean unique,
TpSimpleHandlerHandleChannelsImpl callback,
gpointer user_data,
GDestroyNotify destroy);
TpSimpleHandler implements TpSvcDBusProperties, TpSvcClient, TpSvcClientObserver, TpSvcClientApprover, TpSvcClientHandler and TpSvcClientInterfaceRequests.
"bypass-approval" gboolean : Write / Construct Only "callback" gpointer : Write / Construct Only "destroy" gpointer : Write / Construct Only "requests" gboolean : Write / Construct Only "user-data" gpointer : Write / Construct Only
This class makes it easier to write TpSvcClient implementing the TpSvcClientHandler interface.
A typical simple handler would look liks this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
static void my_handle_channels (TpSimpleHandler *self, TpAccount *account, TpConnection *connection, GList *channels, GList *requests_satisfied, gint64 user_action_time, GList *requests, TpHandleChannelsContext *context, gpointer user_data) { /* start handling the channels here */ tp_handle_channels_context_accept (context); } client = tp_simple_handler_new (dbus, FALSE, FALSE, "MyHandler", FALSE, my_handle_channels, user_data); 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, NULL)); tp_base_client_register (client, NULL); |
See examples/client/text-handler.c for a complete example.
typedef struct _TpSimpleHandler TpSimpleHandler;
Data structure representing a simple Handler implementation.
Since 0.11.6
void (*TpSimpleHandlerHandleChannelsImpl) (TpSimpleHandler *self,TpAccount *account,TpConnection *connection,GList *channels,GList *requests_satisfied,gint64 user_action_time,TpHandleChannelsContext *context,gpointer user_data);
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.
|
a TpSimpleHandler 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 GList of TpChannelRequest having their object-path defined but are not guaranteed to be prepared. [element-type TelepathyGLib.ChannelRequest] |
|
the time at which user action occurred, or 0 if this channel is to be handled for some reason not involving user action. |
|
a TpHandleChannelsContext representing the context of this D-Bus call |
|
arbitrary user-supplied data passed to tp_simple_handler_new()
|
Since 0.11.6
TpBaseClient * tp_simple_handler_new (TpDBusDaemon *dbus,gboolean bypass_approval,gboolean requests,const gchar *name,gboolean unique,TpSimpleHandlerHandleChannelsImpl callback,gpointer user_data,GDestroyNotify destroy);
Convenient function to create a new TpSimpleHandler instance.
|
a TpDBusDaemon object, may not be NULL
|
|
the value of the Handler.BypassApproval D-Bus property
(see tp_base_client_set_handler_bypass_approval() for details)
|
|
if this handler implement Requests (see
tp_base_client_set_handler_request_notification() for details)
|
|
the name of the Handler (see "name": for details) |
|
the value of the TpBaseClient:uniquify-name: property |
|
the function called when HandleChannels is called |
|
arbitrary user-supplied data passed to callback
|
|
called with the user_data as argument, when the TpSimpleHandler is destroyed |
Returns : |
a new TpSimpleHandler. [type TelepathyGLib.SimpleHandler] |
Since 0.11.6
"bypass-approval" property"bypass-approval" gboolean : Write / Construct Only
The value of the Handler.BypassApproval D-Bus property.
Default value: FALSE
Since 0.11.6
"callback" property"callback" gpointer : Write / Construct Only
The TpSimpleHandlerHandleChannelsImpl callback implementing the HandleChannels D-Bus method.
This property can't be NULL.
Since 0.11.6
"destroy" property"destroy" gpointer : Write / Construct Only
The GDestroyNotify function called to free the user-data pointer when the TpSimpleHandler is destroyed.
Since 0.11.6
"requests" property"requests" gboolean : Write / Construct Only
If TRUE, the Handler will implement the Requests interface
Default value: FALSE
Since 0.11.6
"user-data" property"user-data" gpointer : Write / Construct Only
The user-data pointer passed to the callback implementing the HandleChannels D-Bus method.
Since 0.11.6