static gchar * test_get_free_busy (ECal *client) { /* TODO uses NULL for users and currently specific to file backend. */ GList *l, *freebusy = NULL; GError *error = NULL; icaltimezone *utc; time_t start, end; utc = icaltimezone_get_utc_timezone (); start = time_from_isodate ("20040212T000000Z"); end = time_add_day_with_zone (start, 2, utc); if (!e_cal_get_free_busy (client, NULL, start, end, &freebusy, &error)) { cl_printf (client, "Test free/busy : Could not retrieve free busy information : %s\n", error->message); return error->message; } if (freebusy) { cl_printf (client, "Printing free busy information\n"); for (l = freebusy; l; l = l->next) { gchar *comp_string; ECalComponent *comp = E_CAL_COMPONENT (l->data); comp_string = e_cal_component_get_as_string (comp); cl_printf (client, "%s\n\n", comp_string); g_object_unref (comp); g_free (comp_string); } } else { cl_printf (client, "free_busy was returned but NULL"); } return NULL; }
/** * e_cal_backend_sexp_func_make_time: * @esexp: An #ESExp object. * @argc: Number of arguments. * @argv: The arguments. * @data: Closure data. * * (make-time ISODATE) * ISODATE - string, ISO 8601 date/time representation * * Constructs a time_t value for the specified date. * * Returns: The result of the function. */ ESExpResult * e_cal_backend_sexp_func_make_time (ESExp *esexp, gint argc, ESExpResult **argv, gpointer data) { const gchar *str; time_t t; ESExpResult *result; if (argc != 1) { e_sexp_fatal_error (esexp, _("\"%s\" expects one argument"), "make-time"); return NULL; } if (argv[0]->type != ESEXP_RES_STRING) { e_sexp_fatal_error (esexp, _("\"%s\" expects the first " "argument to be a string"), "make-time"); return NULL; } str = argv[0]->value.string; if (!str || !*str) { e_sexp_fatal_error (esexp, _("\"%s\" expects the first " "argument to be a string"), "make-time"); return NULL; } t = time_from_isodate (str); if (t == -1) { e_sexp_fatal_error (esexp, _("\"%s\" expects the first " "argument to be an ISO 8601 " "date/time string"), "make-time"); return NULL; } result = e_sexp_result_new (esexp, ESEXP_RES_TIME); result->value.time = t; return result; }
static const gchar * test_get_alarms_in_range (ECal *client) { GSList *alarms; icaltimezone *utc; time_t start, end; gboolean compare; utc = icaltimezone_get_utc_timezone (); start = time_from_isodate ("20040212T000000Z"); end = time_add_day_with_zone (start, 2, utc); alarms = e_cal_get_alarms_in_range (client, start, end); compare = (g_slist_length (alarms) == 3); e_cal_free_alarms (alarms); mu_assert ("Test getting alarms in range\n", compare); return NULL; }