* Copyright (C) 2006 Xavier Claessens <xclaesse@gmail.com>
* Copyright (C) 2007 Collabora Ltd.
*
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
*
- * This program is distributed in the hope that it will be useful,
+ * This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Authors: Xavier Claessens <xclaesse@gmail.com>
*/
if (error) {
empathy_debug (DEBUG_DOMAIN, "Failed to get members: %s",
error->message);
+ g_object_unref (group);
return;
}
group);
g_array_free (handles, TRUE);
+ g_object_unref (group);
}
static void
EmpathyTpGroup *group = user_data;
EmpathyTpGroupPriv *priv = GET_PRIV (group);
GArray *handles;
- guint i;
+ guint i = 0;
if (error) {
empathy_debug (DEBUG_DOMAIN, "Failed to get local pendings: %s",
error->message);
+ g_object_unref (group);
return;
}
handles = g_array_sized_new (FALSE, FALSE, sizeof (guint), 1);
+ g_array_append_val (handles, i);
for (i = 0; array->len > i; i++) {
GValueArray *pending_struct;
const gchar *message;
reason = g_value_get_uint (g_value_array_get_nth (pending_struct, 2));
message = g_value_get_string (g_value_array_get_nth (pending_struct, 3));
- g_array_insert_val (handles, 0, member_handle);
+ g_array_index (handles, guint, 0) = member_handle;
tp_group_members_changed_cb (priv->group_iface,
message, /* message */
NULL, /* added */
}
g_ptr_array_free (array, TRUE);
g_array_free (handles, TRUE);
+ g_object_unref (group);
}
static void
if (error) {
empathy_debug (DEBUG_DOMAIN, "Failed to get remote pendings: %s",
error->message);
+ g_object_unref (group);
return;
}
group);
g_array_free (handles, TRUE);
+ g_object_unref (group);
}
static void
{
EmpathyTpGroupPriv *priv = GET_PRIV (object);
+ empathy_debug (DEBUG_DOMAIN, "finalize: %p");
+
tp_group_disconnect (EMPATHY_TP_GROUP (object));
if (priv->tp_chan) {
G_SIGNAL_RUN_LAST,
0,
NULL, NULL,
- empathy_marshal_VOID__OBJECT_OBJECT_UINT_STRING,
+ _empathy_marshal_VOID__OBJECT_OBJECT_UINT_STRING,
G_TYPE_NONE,
4, EMPATHY_TYPE_CONTACT, EMPATHY_TYPE_CONTACT, G_TYPE_UINT, G_TYPE_STRING);
G_SIGNAL_RUN_LAST,
0,
NULL, NULL,
- empathy_marshal_VOID__OBJECT_OBJECT_UINT_STRING,
+ _empathy_marshal_VOID__OBJECT_OBJECT_UINT_STRING,
G_TYPE_NONE,
4, EMPATHY_TYPE_CONTACT, EMPATHY_TYPE_CONTACT, G_TYPE_UINT, G_TYPE_STRING);
G_SIGNAL_RUN_LAST,
0,
NULL, NULL,
- empathy_marshal_VOID__OBJECT_OBJECT_UINT_STRING,
+ _empathy_marshal_VOID__OBJECT_OBJECT_UINT_STRING,
G_TYPE_NONE,
4, EMPATHY_TYPE_CONTACT, EMPATHY_TYPE_CONTACT, G_TYPE_UINT, G_TYPE_STRING);
G_SIGNAL_RUN_LAST,
0,
NULL, NULL,
- empathy_marshal_VOID__OBJECT_OBJECT_UINT_STRING,
+ _empathy_marshal_VOID__OBJECT_OBJECT_UINT_STRING,
G_TYPE_NONE,
4, EMPATHY_TYPE_CONTACT, EMPATHY_TYPE_CONTACT, G_TYPE_UINT, G_TYPE_STRING);
EmpathyTpGroup *group;
EmpathyTpGroupPriv *priv;
DBusGProxy *group_iface;
- GError *error;
+ 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,
- TELEPATHY_CHAN_IFACE_GROUP_QUARK);
+ TP_IFACE_QUARK_CHANNEL_INTERFACE_GROUP);
g_return_val_if_fail (group_iface != NULL, NULL);
group = g_object_new (EMPATHY_TYPE_TP_GROUP, NULL);
tp_chan_iface_group_get_members_async (priv->group_iface,
tp_group_get_members_cb,
- group);
+ g_object_ref (group));
tp_chan_iface_group_get_local_pending_members_with_info_async (priv->group_iface,
tp_group_get_local_pending_cb,
- group);
+ g_object_ref (group));
tp_chan_iface_group_get_remote_pending_members_async (priv->group_iface,
tp_group_get_remote_pending_cb,
- group);
+ g_object_ref (group));
return group;
}
}
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");
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);
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);
{
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);
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;
{
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);
{
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;
}