diff options
author | Xavier Claessens <xclaesse@src.gnome.org> | 2008-01-12 22:52:37 +0800 |
---|---|---|
committer | Xavier Claessens <xclaesse@src.gnome.org> | 2008-01-12 22:52:37 +0800 |
commit | d7f99a513854645843fcc3d935dcad356d1d7411 (patch) | |
tree | afbecd5dd552ab76c0e3eb415dc8a343cbd8a68a /libempathy/empathy-tp-group.c | |
parent | e9b4bd52c31c94a6cb2bd04a611cf7a024169f35 (diff) | |
download | gsoc2013-empathy-d7f99a513854645843fcc3d935dcad356d1d7411.tar gsoc2013-empathy-d7f99a513854645843fcc3d935dcad356d1d7411.tar.gz gsoc2013-empathy-d7f99a513854645843fcc3d935dcad356d1d7411.tar.bz2 gsoc2013-empathy-d7f99a513854645843fcc3d935dcad356d1d7411.tar.lz gsoc2013-empathy-d7f99a513854645843fcc3d935dcad356d1d7411.tar.xz gsoc2013-empathy-d7f99a513854645843fcc3d935dcad356d1d7411.tar.zst gsoc2013-empathy-d7f99a513854645843fcc3d935dcad356d1d7411.zip |
Add sanity check to public API
svn path=/trunk/; revision=542
Diffstat (limited to 'libempathy/empathy-tp-group.c')
-rw-r--r-- | libempathy/empathy-tp-group.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/libempathy/empathy-tp-group.c b/libempathy/empathy-tp-group.c index 9c70321d7..30a0097c6 100644 --- a/libempathy/empathy-tp-group.c +++ b/libempathy/empathy-tp-group.c @@ -562,8 +562,8 @@ empathy_tp_group_new (McAccount *account, DBusGProxy *group_iface; GError *error = NULL; - g_return_val_if_fail (TELEPATHY_IS_CHAN (tp_chan), NULL); g_return_val_if_fail (MC_IS_ACCOUNT (account), NULL); + g_return_val_if_fail (TELEPATHY_IS_CHAN (tp_chan), NULL); group_iface = tp_chan_get_interface (tp_chan, TP_IFACE_QUARK_CHANNEL_INTERFACE_GROUP); @@ -620,10 +620,12 @@ tp_group_async_cb (DBusGProxy *proxy, GError *error, gpointer user_data) } void -empathy_tp_group_close (EmpathyTpGroup *group) +empathy_tp_group_close (EmpathyTpGroup *group) { EmpathyTpGroupPriv *priv = GET_PRIV (group); + g_return_if_fail (EMPATHY_IS_TP_GROUP (group)); + tp_chan_close_async (DBUS_G_PROXY (priv->tp_chan), tp_group_async_cb, "Failed to close"); @@ -679,6 +681,9 @@ empathy_tp_group_add_member (EmpathyTpGroup *group, GArray *handles; guint handle; + g_return_if_fail (EMPATHY_IS_TP_GROUP (group)); + g_return_if_fail (EMPATHY_IS_CONTACT (contact)); + handle = empathy_contact_get_handle (contact); handles = g_array_new (FALSE, FALSE, sizeof (guint)); g_array_append_val (handles, handle); @@ -722,6 +727,9 @@ empathy_tp_group_remove_member (EmpathyTpGroup *group, GArray *handles; guint handle; + g_return_if_fail (EMPATHY_IS_TP_GROUP (group)); + g_return_if_fail (EMPATHY_IS_CONTACT (contact)); + handle = empathy_contact_get_handle (contact); handles = g_array_new (FALSE, FALSE, sizeof (guint)); g_array_append_val (handles, handle); @@ -740,6 +748,8 @@ empathy_tp_group_get_members (EmpathyTpGroup *group) { EmpathyTpGroupPriv *priv = GET_PRIV (group); + g_return_val_if_fail (EMPATHY_IS_TP_GROUP (group), NULL); + g_list_foreach (priv->members, (GFunc) g_object_ref, NULL); return g_list_copy (priv->members); @@ -751,6 +761,8 @@ empathy_tp_group_get_local_pendings (EmpathyTpGroup *group) EmpathyTpGroupPriv *priv = GET_PRIV (group); GList *pendings = NULL, *l; + g_return_val_if_fail (EMPATHY_IS_TP_GROUP (group), NULL); + for (l = priv->local_pendings; l; l = l->next) { EmpathyPendingInfo *info; EmpathyPendingInfo *new_info; @@ -770,6 +782,8 @@ empathy_tp_group_get_remote_pendings (EmpathyTpGroup *group) { EmpathyTpGroupPriv *priv = GET_PRIV (group); + g_return_val_if_fail (EMPATHY_IS_TP_GROUP (group), NULL); + g_list_foreach (priv->remote_pendings, (GFunc) g_object_ref, NULL); return g_list_copy (priv->remote_pendings); @@ -820,6 +834,9 @@ empathy_tp_group_is_member (EmpathyTpGroup *group, { EmpathyTpGroupPriv *priv = GET_PRIV (group); + g_return_val_if_fail (EMPATHY_IS_TP_GROUP (group), FALSE); + g_return_val_if_fail (EMPATHY_IS_CONTACT (contact), FALSE); + return g_list_find (priv->members, contact) != NULL; } |