## Service-side Protocol interface

Service-side Protocol interface — GInterface for Telepathy Protocol objects

## Synopsis

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

                        TpSvcProtocol;
                        TpSvcProtocolClass;

    void                (*tp_svc_protocol_identify_account_impl)
                                                            (TpSvcProtocol *self,
                                                             GHashTable *in_Parameters,
                                                             DBusGMethodInvocation *context);
    void                tp_svc_protocol_implement_identify_account
                                                            (TpSvcProtocolClass *klass,
                                                             tp_svc_protocol_identify_account_impl impl);
    void                tp_svc_protocol_implement_normalize_contact
                                                            (TpSvcProtocolClass *klass,
                                                             tp_svc_protocol_normalize_contact_impl impl);
    void                (*tp_svc_protocol_normalize_contact_impl)
                                                            (TpSvcProtocol *self,
                                                             const gchar *in_Contact_ID,
                                                             DBusGMethodInvocation *context);
    void                tp_svc_protocol_return_from_identify_account
                                                            (DBusGMethodInvocation *context,
                                                             const gchar *out_Account_ID);
    void                tp_svc_protocol_return_from_normalize_contact
                                                            (DBusGMethodInvocation *context,
                                                             const gchar *out_Normalized_Contact_ID);

                        TpSvcProtocolInterfaceAddressing;
                        TpSvcProtocolInterfaceAddressingClass;

                        TpSvcProtocolInterfacePresence;
                        TpSvcProtocolInterfacePresenceClass;

                        TpSvcProtocolInterfaceAvatars;
                        TpSvcProtocolInterfaceAvatarsClass;

## Object Hierarchy

      GInterface
       +----TpSvcProtocol

      GInterface
       +----TpSvcProtocolInterfaceAddressing

      GInterface
       +----TpSvcProtocolInterfacePresence

      GInterface
       +----TpSvcProtocolInterfaceAvatars

## Known Implementations

TpSvcProtocol is implemented by TpBaseProtocol.

TpSvcProtocolInterfaceAddressing is implemented by TpBaseProtocol.

TpSvcProtocolInterfacePresence is implemented by TpBaseProtocol.

TpSvcProtocolInterfaceAvatars is implemented by TpBaseProtocol.

## Description

The TpSvcProtocol interface (auto-generated from the Telepathy spec) makes it easier to export an object implementing the Telepathy Protocol interface.

## Details

### TpSvcProtocol

    typedef struct _TpSvcProtocol TpSvcProtocol;

Dummy typedef representing any implementation of this interface.

### TpSvcProtocolClass

    typedef struct _TpSvcProtocolClass TpSvcProtocolClass;

The class of TpSvcProtocol.

In a full implementation of this interface (i.e. all methods implemented), the interface initialization function used in `G_IMPLEMENT_INTERFACE()` would typically look like this:

    static void
    implement_protocol (gpointer klass,
        gpointer unused G_GNUC_UNUSED)
    {
    #define IMPLEMENT(x) tp_svc_protocol_implement_##x (\
      klass, my_object_##x)
      IMPLEMENT (identify_account);
      IMPLEMENT (normalize_contact);
    #undef IMPLEMENT
    }

### tp_svc_protocol_identify_account_impl ()

    void                (*tp_svc_protocol_identify_account_impl)
                                                            (TpSvcProtocol *self,
                                                             GHashTable *in_Parameters,
                                                             DBusGMethodInvocation *context);

The signature of an implementation of the D-Bus method IdentifyAccount on interface org.freedesktop.Telepathy.Protocol.

`self` : | The object implementing this interface
`in_Parameters` : | GHashTable * (FIXME, generate documentation)
`context` : | Used to return values or throw an error

### tp_svc_protocol_implement_identify_account ()

    void                tp_svc_protocol_implement_identify_account
                                                            (TpSvcProtocolClass *klass,
                                                             tp_svc_protocol_identify_account_impl impl);

Register an implementation for the IdentifyAccount method in the vtable of an implementation of this interface. To be called from the interface init function.

`klass` : | A class whose instances implement this interface
`impl` : | A callback used to implement the IdentifyAccount D-Bus method

### tp_svc_protocol_implement_normalize_contact ()

    void                tp_svc_protocol_implement_normalize_contact
                                                            (TpSvcProtocolClass *klass,
                                                             tp_svc_protocol_normalize_contact_impl impl);

Register an implementation for the NormalizeContact method in the vtable of an implementation of this interface. To be called from the interface init function.

`klass` : | A class whose instances implement this interface
`impl` : | A callback used to implement the NormalizeContact D-Bus method

### tp_svc_protocol_normalize_contact_impl ()

    void                (*tp_svc_protocol_normalize_contact_impl)
                                                            (TpSvcProtocol *self,
                                                             const gchar *in_Contact_ID,
                                                             DBusGMethodInvocation *context);

The signature of an implementation of the D-Bus method NormalizeContact on interface org.freedesktop.Telepathy.Protocol.

`self` : | The object implementing this interface
`in_Contact_ID` : | const gchar * (FIXME, generate documentation)
`context` : | Used to return values or throw an error

### tp_svc_protocol_return_from_identify_account ()

    void                tp_svc_protocol_return_from_identify_account
                                                            (DBusGMethodInvocation *context,
                                                             const gchar *out_Account_ID);

Return successfully by calling `dbus_g_method_return()`. This inline function exists only to provide type-safety.

`context` : | The D-Bus method invocation context
`out_Account_ID` : | const gchar * (FIXME, generate documentation)

### tp_svc_protocol_return_from_normalize_contact ()

    void                tp_svc_protocol_return_from_normalize_contact
                                                            (DBusGMethodInvocation *context,
                                                             const gchar *out_Normalized_Contact_ID);

Return successfully by calling `dbus_g_method_return()`. This inline function exists only to provide type-safety.

`context` : | The D-Bus method invocation context
`out_Normalized_Contact_ID` : | const gchar * (FIXME, generate documentation)

### TpSvcProtocolInterfaceAddressing

    typedef struct _TpSvcProtocolInterfaceAddressing TpSvcProtocolInterfaceAddressing;

Dummy typedef representing any implementation of this interface.

### TpSvcProtocolInterfaceAddressingClass

    typedef struct _TpSvcProtocolInterfaceAddressingClass TpSvcProtocolInterfaceAddressingClass;

The class of TpSvcProtocolInterfaceAddressing.

In a full implementation of this interface (i.e. all methods implemented), the interface initialization function used in `G_IMPLEMENT_INTERFACE()` would typically look like this:

    static void
    implement_protocol_interface_addressing (gpointer klass,
        gpointer unused G_GNUC_UNUSED)
    {
    #define IMPLEMENT(x) tp_svc_protocol_interface_addressing_implement_##x (\
      klass, my_object_##x)
      IMPLEMENT (normalize_vcard_address);
      IMPLEMENT (normalize_contact_uri);
    #undef IMPLEMENT
    }

### TpSvcProtocolInterfacePresence

    typedef struct _TpSvcProtocolInterfacePresence TpSvcProtocolInterfacePresence;

Dummy typedef representing any implementation of this interface.

### TpSvcProtocolInterfacePresenceClass

    typedef struct _TpSvcProtocolInterfacePresenceClass TpSvcProtocolInterfacePresenceClass;

The class of TpSvcProtocolInterfacePresence. This interface has no D-Bus methods, so an implementation can typically pass `NULL` to `G_IMPLEMENT_INTERFACE()` as the interface initialization function.

### TpSvcProtocolInterfaceAvatars

    typedef struct _TpSvcProtocolInterfaceAvatars TpSvcProtocolInterfaceAvatars;

Dummy typedef representing any implementation of this interface.

### TpSvcProtocolInterfaceAvatarsClass

    typedef struct _TpSvcProtocolInterfaceAvatarsClass TpSvcProtocolInterfaceAvatarsClass;

The class of TpSvcProtocolInterfaceAvatars. This interface has no D-Bus methods, so an implementation can typically pass `NULL` to `G_IMPLEMENT_INTERFACE()` as the interface initialization function.

## See Also

TpBaseProtocol