|  |  |  | telepathy-glib API Reference Manual |  | 
|---|---|---|---|---|
| Top | Description | Object Hierarchy | Implemented Interfaces | Properties | ||||
| TpSimpleObserverTpSimpleObserver — a subclass of TpBaseClient implementing a simple Observer | 
#include <telepathy-glib/telepathy-glib.h>
                    TpSimpleObserver;
void                (*TpSimpleObserverObserveChannelsImpl)
                                                        (TpSimpleObserver *observer,
                                                         TpAccount *account,
                                                         TpConnection *connection,
                                                         GList *channels,
                                                         TpChannelDispatchOperation *dispatch_operation,
                                                         GList *requests,
                                                         TpObserveChannelsContext *context,
                                                         gpointer user_data);
TpBaseClient *      tp_simple_observer_new              (TpDBusDaemon *dbus,
                                                         gboolean recover,
                                                         const gchar *name,
                                                         gboolean uniquify,
                                                         TpSimpleObserverObserveChannelsImpl callback,
                                                         gpointer user_data,
                                                         GDestroyNotify destroy);
TpBaseClient *      tp_simple_observer_new_with_am      (TpAccountManager *account_manager,
                                                         gboolean recover,
                                                         const gchar *name,
                                                         gboolean uniquify,
                                                         TpSimpleObserverObserveChannelsImpl callback,
                                                         gpointer user_data,
                                                         GDestroyNotify destroy);
TpBaseClient *      tp_simple_observer_new_with_factory (TpSimpleClientFactory *factory,
                                                         gboolean recover,
                                                         const gchar *name,
                                                         gboolean uniquify,
                                                         TpSimpleObserverObserveChannelsImpl callback,
                                                         gpointer user_data,
                                                         GDestroyNotify destroy);
TpSimpleObserver implements TpSvcDBusProperties, TpSvcClient, TpSvcClientObserver, TpSvcClientApprover, TpSvcClientHandler and TpSvcClientInterfaceRequests.
"callback" gpointer : Write / Construct Only "destroy" gpointer : Write / Construct Only "recover" gboolean : Write / Construct Only "user-data" gpointer : Write / Construct Only
This class makes it easier to write TpSvcClient implementing the TpSvcClientObserver interface.
A typical simple observer 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 26 | static void my_observe_channels (TpSimpleObserver *observer, TpAccount *account, TpConnection *connection, GList *channels, TpChannelDispatchOperation *dispatch_operation, GList *requests, TpObserveChannelsContext *context, gpointer user_data) { /* do something useful with the channels here */ tp_observe_channels_context_accept (context); } factory = tp_automatic_client_factory_new (dbus); client = tp_simple_observer_new_with_factory (factory, TRUE, "MyObserver", FALSE, my_observe_channels, user_data); g_object_unref (factory); 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, NULL)); tp_base_client_register (client, NULL); | 
See examples/client/media-observer.c for a complete example.
typedef struct _TpSimpleObserver TpSimpleObserver;
Data structure representing a simple Observer implementation.
Since 0.11.5
void (*TpSimpleObserverObserveChannelsImpl) (TpSimpleObserver *observer,TpAccount *account,TpConnection *connection,GList *channels,TpChannelDispatchOperation *dispatch_operation,GList *requests,TpObserveChannelsContext *context,gpointer user_data);
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 TpSimpleObserver instance | 
| 
 | a TpAccount having TP_ACCOUNT_FEATURE_COREprepared if possible | 
| 
 | a TpConnection having TP_CONNECTION_FEATURE_COREprepared
if possible | 
| 
 | a GList of TpChannel,
all having TP_CHANNEL_FEATURE_COREprepared 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, all 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 | 
| 
 | arbitrary user-supplied data passed to tp_simple_observer_new() | 
Since 0.11.5
TpBaseClient * tp_simple_observer_new (TpDBusDaemon *dbus,gboolean recover,const gchar *name,gboolean uniquify,TpSimpleObserverObserveChannelsImpl callback,gpointer user_data,GDestroyNotify destroy);
tp_simple_observer_new is deprecated and should not be used in newly-written code. New code should use tp_simple_observer_new_with_am() instead.
Convenient function to create a new TpSimpleObserver instance.
If dbus is not the result of tp_dbus_daemon_dup(), you should call
tp_simple_observer_new_with_am() instead, so that TpAccount,
TpConnection and TpContact instances can be shared between modules.
| 
 | a TpDBusDaemon object, may not be NULL | 
| 
 | the value of the Observer.Recover D-Bus property | 
| 
 | the name of the Observer (see "name": for details) | 
| 
 | the value of the "uniquify-name": property | 
| 
 | the function called when ObserveChannels is called | 
| 
 | arbitrary user-supplied data passed to callback | 
| 
 | called with the user_data as argument, when the TpSimpleObserver is destroyed | 
| Returns : | a new TpSimpleObserver. [type TelepathyGLib.SimpleObserver] | 
Since 0.11.5
TpBaseClient * tp_simple_observer_new_with_am (TpAccountManager *account_manager,gboolean recover,const gchar *name,gboolean uniquify,TpSimpleObserverObserveChannelsImpl callback,gpointer user_data,GDestroyNotify destroy);
Convenient function to create a new TpSimpleObserver instance with a specified TpAccountManager.
It is not necessary to prepare any features on account_manager before
calling this function.
| 
 | an account manager, which may not be NULL | 
| 
 | the value of the Observer.Recover D-Bus property | 
| 
 | the name of the Observer (see "name": for details) | 
| 
 | the value of the "uniquify-name": property | 
| 
 | the function called when ObserveChannels is called | 
| 
 | arbitrary user-supplied data passed to callback | 
| 
 | called with the user_data as argument, when the TpSimpleObserver is destroyed | 
| Returns : | a new TpSimpleObserver. [type TelepathyGLib.SimpleObserver] | 
Since 0.11.14
TpBaseClient * tp_simple_observer_new_with_factory (TpSimpleClientFactory *factory,gboolean recover,const gchar *name,gboolean uniquify,TpSimpleObserverObserveChannelsImpl callback,gpointer user_data,GDestroyNotify destroy);
Convenient function to create a new TpSimpleObserver instance with a specified TpSimpleClientFactory.
| 
 | a TpSimpleClientFactory, which may not be NULL | 
| 
 | the value of the Observer.Recover D-Bus property | 
| 
 | the name of the Observer (see "name": for details) | 
| 
 | the value of the "uniquify-name": property | 
| 
 | the function called when ObserveChannels is called | 
| 
 | arbitrary user-supplied data passed to callback | 
| 
 | called with the user_data as argument, when the TpSimpleObserver is destroyed | 
| Returns : | a new TpSimpleObserver. [type TelepathyGLib.SimpleObserver] | 
Since 0.15.5
"callback" property"callback" gpointer : Write / Construct Only
The TpSimpleObserverObserveChannelsImpl callback implementing the ObserveChannels D-Bus method.
This property can't be NULL.
Since 0.11.5
"destroy" property"destroy" gpointer : Write / Construct Only
The GDestroyNotify function called to free the user-data pointer when the TpSimpleObserver is destroyed.
Since 0.11.5
"recover" property"recover" gboolean : Write / Construct Only
The value of the Observer.Recover D-Bus property.
Default value: FALSE
Since 0.11.5
"user-data" property"user-data" gpointer : Write / Construct Only
The user-data pointer passed to the callback implementing the ObserveChannels D-Bus method.
Since 0.11.5