TpContactsMixin

TpContactsMixin — a mixin implementation of the contacts connection interface

Synopsis


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

                    TpContactsMixin;
                    TpContactsMixinClass;
void                tp_contacts_mixin_add_contact_attributes_iface
                                                        (GObject *obj,
                                                         const gchar *interface,
                                                         TpContactsMixinFillContactAttributesFunc fill_contact_attributes);
void                tp_contacts_mixin_class_init        (GObjectClass *obj_cls,
                                                         glong offset);
void                tp_contacts_mixin_finalize          (GObject *obj);
void                tp_contacts_mixin_iface_init        (gpointer g_iface,
                                                         gpointer iface_data);
void                tp_contacts_mixin_init              (GObject *obj,
                                                         gsize offset);
void                tp_contacts_mixin_set_contact_attribute
                                                        (GHashTable *contact_attributes,
                                                         TpHandle handle,
                                                         gchar *attribute,
                                                         GValue *value);
void                (*TpContactsMixinFillContactAttributesFunc)
                                                        (GObject *obj,
                                                         const GArray *contacts,
                                                         GHashTable *attributes_hash);

Description

This mixin can be added to a TpBaseConnection subclass to implement the Contacts interface in a generic way.

To use the contacts mixin, include a TpContactsMixinClass somewhere in your class structure and a TpContactsMixin somewhere in your instance structure, and call tp_contacts_mixin_class_init() from your class_init function, tp_contacts_mixin_init() from your init function or constructor, and tp_contacts_mixin_finalize() from your dispose or finalize function.

To use the contacts mixin as the implementation of TpSvcConnectionInterfaceContacts, in the function you pass to G_IMPLEMENT_INTERFACE, you should call tp_contacts_mixin_iface_init. TpContactsMixin implements all of the D-Bus methods and properties in the Contacts interface.

To add interfaces with contact attributes to this interface use tp_contacts_mixin_add_contact_attributes_iface:

Details

TpContactsMixin

typedef struct {
} TpContactsMixin;

Structure to be included in the instance structure of objects that use this mixin. Initialize it with tp_contacts_mixin_init().

There are no public fields.


TpContactsMixinClass

typedef struct {
} TpContactsMixinClass;

Structure to be included in the class structure of objects that use this mixin. Initialize it with tp_contacts_mixin_class_init().

There are no public fields.


tp_contacts_mixin_add_contact_attributes_iface ()

void                tp_contacts_mixin_add_contact_attributes_iface
                                                        (GObject *obj,
                                                         const gchar *interface,
                                                         TpContactsMixinFillContactAttributesFunc fill_contact_attributes);

Declare that the given interface has contact attributes which can be added to the attributes hash using the filler function. All the handles in the handle array passed to the filler function are guaranteed to be valid and referenced.

obj : An instance of the implementation that uses this mixin
interface : Name of the interface that has ContactAttributes
fill_contact_attributes : Contact attribute filler function

Since 0.7.14


tp_contacts_mixin_class_init ()

void                tp_contacts_mixin_class_init        (GObjectClass *obj_cls,
                                                         glong offset);

Initialize the contacts mixin. Should be called from the implementation's class_init function like so:

tp_contacts_mixin_class_init ((GObjectClass *) klass,
                         G_STRUCT_OFFSET (SomeObjectClass, contacts_mixin));

obj_cls : The class of the implementation that uses this mixin
offset : The byte offset of the TpContactsMixinClass within the class structure

Since 0.7.14


tp_contacts_mixin_finalize ()

void                tp_contacts_mixin_finalize          (GObject *obj);

Free resources held by the contacts mixin.

obj : An object with this mixin.

Since 0.7.14


tp_contacts_mixin_iface_init ()

void                tp_contacts_mixin_iface_init        (gpointer g_iface,
                                                         gpointer iface_data);

Fill in the vtable entries needed to implement the contacts interface using this mixin. This function should usually be called via G_IMPLEMENT_INTERFACE.

g_iface : A pointer to the TpSvcConnectionInterfaceContacts in an object class
iface_data : Ignored

Since 0.7.14


tp_contacts_mixin_init ()

void                tp_contacts_mixin_init              (GObject *obj,
                                                         gsize offset);

Initialize the contacts mixin. Should be called from the implementation's instance init function like so:

tp_contacts_mixin_init ((GObject *) self,
                    G_STRUCT_OFFSET (SomeObject, contacts_mixin));

obj : An instance of the implementation that uses this mixin
offset : The byte offset of the TpContactsMixin within the object structure

Since 0.7.14


tp_contacts_mixin_set_contact_attribute ()

void                tp_contacts_mixin_set_contact_attribute
                                                        (GHashTable *contact_attributes,
                                                         TpHandle handle,
                                                         gchar *attribute,
                                                         GValue *value);

Utility function to set attribute for handle to value in the attributes hash as passed to a TpContactsMixinFillContactAttributesFunc.

contact_attributes : contacts attribute hash as passed to TpContactsMixinFillContactAttributesFunc
handle : Handle to set the attribute on
attribute : attribute name
value : slice allocated GValue containing the value of the attribute, for instance with tp_g_value_slice_new. Ownership of the GValue is taken over by the mixin

Since 0.7.14


TpContactsMixinFillContactAttributesFunc ()

void                (*TpContactsMixinFillContactAttributesFunc)
                                                        (GObject *obj,
                                                         const GArray *contacts,
                                                         GHashTable *attributes_hash);

This function is called to add attributes of contacts

obj : An object implementing the presence interface with this mixin
contacts : The contacts for which attributes are requested
attributes_hash : hash of handle => hash of attributes, containing all the contacts in the contacts array

See Also

TpSvcConnectionInterfaceContacts