static gboolean
manage_result (GSList *users,
               icalcomponent *modified_icalcomp)
{
	g_print ("Wishes to send to %d users", g_slist_length (users));
	if (users) {
		GSList *u;

		g_print (": ");

		for (u = users; u; u = u->next)
			g_print ("%s%s", u == users ? "" : ", ", (const gchar *) u->data);
	}
	g_print ("\n");

	if (!modified_icalcomp)
		g_print ("No modified icalcomp, would send the same\n");
	else
		print_icomp (modified_icalcomp);

	e_client_util_free_string_slist (users);
	if (modified_icalcomp)
		icalcomponent_free (modified_icalcomp);

	return TRUE;
}
enum OpenAB_Storage::Storage::eAddItem EDSCalendarStorage::addObjects(const std::vector<std::string> & iCals,
                                                                   OpenAB::PIMItem::IDs & newIds,
                                                                   OpenAB::PIMItem::Revisions & revisions)
{
  GError *gerror = NULL;
  GSList * events = NULL;
  GSList * new_uids;

  OpenAB::PIMItem::IDs emptyIds;
  std::vector<icaltimezone*> timezones;
  events = toICalComponentsList(iCals, emptyIds, timezones);

  if (NULL == events)
  {
    LOG_DEBUG() << "Cannot parse vevent" << std::endl;
    return eAddItemFail;
  }

  std::vector<icaltimezone*>::iterator it;
  for (it = timezones.begin(); it != timezones.end(); ++it)
  {
    e_cal_client_add_timezone_sync (client, (*it), NULL, &gerror);
    GERROR_FREE(gerror);
  }

  if (!e_cal_client_create_objects_sync (client, events, &new_uids, NULL, &gerror))
  {
    LOG_ERROR() << "Error e_cal_client_create_object_sync results: " << GERROR_MESSAGE(gerror)<<std::endl;
    g_slist_free_full(events, (GDestroyNotify) icalcomponent_free);
    GERROR_FREE(gerror);
    return eAddItemFail;
  }



  GSList *l = new_uids;
  newIds.clear();
  while(l)
  {
    //check if we've added ocurring event in that case do not duplicate UID
    std::string id = (const gchar*)l->data;
    if (!OpenAB::contains(newIds, id))
    {
      newIds.push_back(id);
      LOG_DEBUG()<<"UID "<<id<<std::endl;
    }

    l = g_slist_next(l);
  }

  g_slist_free_full(events, (GDestroyNotify) icalcomponent_free);
  e_client_util_free_string_slist(new_uids);

  revisions = getRevisions(newIds);

  return eAddItemOk;
}
static gboolean
manage_result (GSList *attachment_uris)
{
	gboolean res;

	g_return_val_if_fail (attachment_uris != NULL, FALSE);
	g_return_val_if_fail (g_slist_length (attachment_uris) == 3, FALSE);

	res = g_slist_find_custom (attachment_uris, ATTACH1, g_str_equal)
	   && g_slist_find_custom (attachment_uris, ATTACH2, g_str_equal)
	   && g_slist_find_custom (attachment_uris, ATTACH3, g_str_equal);

	if (!res) {
		GSList *au;

		g_printerr ("Failed: didn't return same three attachment uris, got instead:\n");
		for (au = attachment_uris; au; au = au->next)
			g_printerr ("\t'%s'\n", (const gchar *) au->data);
	}

	e_client_util_free_string_slist (attachment_uris);

	return res;
}