Invite people to events on Federated Core calendars

This commit is contained in:
2026-10-29 08:18:52 -06:00
parent eeea79bb9f
commit 8d9eb034c7
24 changed files with 1324 additions and 19 deletions
+47
View File
@@ -233,6 +233,52 @@ test_first_weekday (void)
/*********************************************************************************************************************/
static void
parse_email_address (void)
{
struct {
const gchar *text;
const gchar *email;
const gchar *name;
} valid[] = {
{ "ana@example.com", "ana@example.com", NULL },
{ " ana@example.com ", "ana@example.com", NULL },
{ "mailto:ana@example.com", "ana@example.com", NULL },
{ "Ana Lima <ana@example.com>", "ana@example.com", "Ana Lima" },
{ "\"Lima, Ana\" <ana@example.com>", "ana@example.com", "Lima, Ana" },
{ "<ana@example.com>", "ana@example.com", NULL },
{ "ana.lima+work@mail.example.co.uk", "ana.lima+work@mail.example.co.uk", NULL },
};
const gchar *invalid[] = {
NULL,
"",
"ana",
"ana@",
"@example.com",
"ana@example",
"ana@example.",
"ana@.example.com",
"ana@@example.com",
"ana lima@example.com",
"Ana Lima <ana>",
};
for (gsize i = 0; i < G_N_ELEMENTS (valid); i++)
{
g_autofree gchar *email = NULL;
g_autofree gchar *name = NULL;
g_assert_true (gcal_util_parse_email_address (valid[i].text, &email, &name));
g_assert_cmpstr (email, ==, valid[i].email);
g_assert_cmpstr (name, ==, valid[i].name);
}
for (gsize i = 0; i < G_N_ELEMENTS (invalid); i++)
g_assert_false (gcal_util_parse_email_address (invalid[i], NULL, NULL));
}
/*********************************************************************************************************************/
gint
main (gint argc,
gchar *argv[])
@@ -245,6 +291,7 @@ main (gint argc,
g_test_add_func ("/utils/date-time/date_time_from_icaltime", date_time_from_icaltime);
g_test_add_func ("/utils/misc/extract_meeting_url", extract_meeting_url);
g_test_add_func ("/utils/misc/get_first_weekday", test_first_weekday);
g_test_add_func ("/utils/misc/parse_email_address", parse_email_address);
return g_test_run ();
}