EmpathyContactListStore *
empathy_contact_list_store_new (EmpathyContactList *list_iface)
{
	g_return_val_if_fail (EMPATHY_IS_CONTACT_LIST (list_iface), NULL);

	return g_object_new (EMPATHY_TYPE_CONTACT_LIST_STORE,
			     "contact-list", list_iface,
			     NULL);
}
EmpathyContactListFlags
empathy_contact_list_get_flags (EmpathyContactList *list)
{
	g_return_val_if_fail (EMPATHY_IS_CONTACT_LIST (list), 0);

	if (EMPATHY_CONTACT_LIST_GET_IFACE (list)->get_flags) {
		return EMPATHY_CONTACT_LIST_GET_IFACE (list)->get_flags (list);
	} else {
		return 0;
	}
}
void
empathy_contact_list_remove_group (EmpathyContactList *list,
				   const gchar *group)
{
	g_return_if_fail (EMPATHY_IS_CONTACT_LIST (list));
	g_return_if_fail (group != NULL);

	if (EMPATHY_CONTACT_LIST_GET_IFACE (list)->remove_group) {
		EMPATHY_CONTACT_LIST_GET_IFACE (list)->remove_group (list, group);
	}
}
GList *
empathy_contact_list_get_all_groups (EmpathyContactList *list)
{
	g_return_val_if_fail (EMPATHY_IS_CONTACT_LIST (list), NULL);

	if (EMPATHY_CONTACT_LIST_GET_IFACE (list)->get_all_groups) {
		return EMPATHY_CONTACT_LIST_GET_IFACE (list)->get_all_groups (list);
	}

	return NULL;
}
EmpathyContactMonitor *
empathy_contact_monitor_new_for_iface (EmpathyContactList *iface)
{
  EmpathyContactMonitor *retval;

  g_return_val_if_fail (EMPATHY_IS_CONTACT_LIST (iface), NULL);

  retval = g_object_new (EMPATHY_TYPE_CONTACT_MONITOR,
                         "iface", iface, NULL);

  return retval;
}
void
empathy_contact_list_remove (EmpathyContactList *list,
			     EmpathyContact     *contact,
			     const gchar        *message)
{
	g_return_if_fail (EMPATHY_IS_CONTACT_LIST (list));
	g_return_if_fail (EMPATHY_IS_CONTACT (contact));

	if (EMPATHY_CONTACT_LIST_GET_IFACE (list)->remove) {
		EMPATHY_CONTACT_LIST_GET_IFACE (list)->remove (list, contact, message);
	}
}
void
empathy_contact_list_rename_group (EmpathyContactList *list,
				   const gchar        *old_group,
				   const gchar        *new_group)
{
	g_return_if_fail (EMPATHY_IS_CONTACT_LIST (list));
	g_return_if_fail (old_group != NULL);
	g_return_if_fail (new_group != NULL);

	if (EMPATHY_CONTACT_LIST_GET_IFACE (list)->rename_group) {
		EMPATHY_CONTACT_LIST_GET_IFACE (list)->rename_group (list, old_group, new_group);
	}
}
void
empathy_contact_monitor_set_iface (EmpathyContactMonitor *self,
                                   EmpathyContactList *iface)
{
  EmpathyContactMonitorPriv *priv;

  g_return_if_fail (EMPATHY_IS_CONTACT_MONITOR (self));
  g_return_if_fail (EMPATHY_IS_CONTACT_LIST (iface));

  priv = GET_PRIV (self);

  if (priv->contacts != NULL)
    {
      g_list_foreach (priv->contacts,
                      (GFunc) contact_remove_foreach, self);
      g_list_free (priv->contacts);
      priv->contacts = NULL;
    }

  priv->iface = iface;

  g_signal_connect (iface, "members-changed",
                    G_CALLBACK (cl_members_changed_cb), self);
}