empathy r542 - trunk/libempathy



Author: xclaesse
Date: Sat Jan 12 14:52:37 2008
New Revision: 542
URL: http://svn.gnome.org/viewvc/empathy?rev=542&view=rev

Log:
Add sanity check to public API


Modified:
   trunk/libempathy/empathy-tp-group.c

Modified: trunk/libempathy/empathy-tp-group.c
==============================================================================
--- trunk/libempathy/empathy-tp-group.c	(original)
+++ trunk/libempathy/empathy-tp-group.c	Sat Jan 12 14:52:37 2008
@@ -562,8 +562,8 @@
 	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 @@
 }
 
 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 @@
 	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 @@
 	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 @@
 {
 	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 @@
 	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 @@
 {
 	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 @@
 {
 	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;
 }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]