diff options
author | Alvaro Soliverez <alvaro.soliverez@collabora.co.uk> | 2012-03-14 19:29:54 -0300 |
---|---|---|
committer | Olli Salli <olli.salli@collabora.co.uk> | 2012-03-15 22:03:10 +0200 |
commit | 19539e3418641cd379e80a69d3243db5537e0dc3 (patch) | |
tree | b204e7e8d1838173e38e89dc79e4cb88655b6607 /src/contact.c | |
parent | 5754bc81e3f94589d91820fe34975dfb63730f28 (diff) | |
download | telepathy-salut-19539e3418641cd379e80a69d3243db5537e0dc3.tar.gz |
Move plugin library-specific code from util.c into its own file, to
prevent dependency problems
As part of this, a new SalutPluginContactInterface had to be created to
access contact capabilities that were needed for the plugin utils.
Accessing SalutContact directly would bring most of salut core in, so a
GInterface is used, similar to what is done with SalutPluginConnection
Diffstat (limited to 'src/contact.c')
-rw-r--r-- | src/contact.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/contact.c b/src/contact.c index 004543a6..49059b8a 100644 --- a/src/contact.c +++ b/src/contact.c @@ -38,9 +38,15 @@ static void xep_0115_capabilities_iface_init (gpointer, gpointer); +static void +salut_plugin_contact_iface_init (SalutPluginContactInterface *iface, + gpointer iface_data); + G_DEFINE_TYPE_WITH_CODE (SalutContact, salut_contact, WOCKY_TYPE_LL_CONTACT, G_IMPLEMENT_INTERFACE (WOCKY_TYPE_XEP_0115_CAPABILITIES, xep_0115_capabilities_iface_init); + G_IMPLEMENT_INTERFACE (SALUT_TYPE_PLUGIN_CONTACT, + salut_plugin_contact_iface_init); ) /* properties */ @@ -907,3 +913,20 @@ xep_0115_capabilities_iface_init (gpointer g_iface, iface->get_data_forms = salut_contact_get_data_forms; } + +GabbleCapabilitySet * +salut_contact_get_capabilities (SalutPluginContact *plugin_contact) +{ + SalutContact *contact = SALUT_CONTACT (plugin_contact); + + g_return_val_if_fail (SALUT_IS_CONTACT (contact), NULL); + + return contact->caps; +} + +static void +salut_plugin_contact_iface_init (SalutPluginContactInterface *iface, + gpointer iface_data) +{ + iface->get_caps = salut_contact_get_capabilities; +} |