Add a Jitsi video conference to events on Core calendars

The event editor offers "Add Video Conference" on the calendars of a
Federated Computer Core. It makes a room with an unguessable name, like
BraveOttersSing-k3f9x2m7, on the Core's Jitsi at jitsi.<CORE_DOMAIN>,
and shows its link with Copy and Remove buttons.

The link goes at the end of the event's notes, which reach everyone
invited whatever their mail app, and in an RFC 7986 CONFERENCE property.
Saving puts the link back in the notes if it was taken out, and "All
events" copies the conference to the whole series.

Existing conferences are found in CONFERENCE, or as Jitsi links in the
notes or location, so the editor doesn't offer a second one and the
popover shows a Join button. The popover now keeps showing a place in
the location alongside a meeting.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-28 07:28:20 -07:00
co-authored by Claude Opus 5.5
parent 0304695ab2
commit 3c118fbb9d
23 changed files with 1809 additions and 61 deletions
+131
View File
@@ -86,6 +86,16 @@
"RECURRENCE-ID:20180714T000000Z\n" \
"END:VEVENT\n"
#define STUB_EVENT_WITH_CONFERENCE "BEGIN:VEVENT\n" \
"SUMMARY:Stub event\n" \
"UID:example@uid\n" \
"DTSTAMP:19970114T170000Z\n" \
"DTSTART:20180714T170000Z\n" \
"DTEND:20180715T035959Z\n" \
"CONFERENCE;VALUE=URI;FEATURE=PHONE;LABEL=Dial in:tel:+1-555-0100\n" \
"CONFERENCE;VALUE=URI;FEATURE=VIDEO:https://example.com/room\n" \
"END:VEVENT\n"
/*
* Auxiliary methods
*/
@@ -670,6 +680,124 @@ event_schedule_equal (void)
/*********************************************************************************************************************/
#define ROOM_URL "https://jitsi.example.com/BraveOttersSing-k3f9x2m7"
static void
event_add_conference (void)
{
g_autoptr (GcalEvent) reloaded = NULL;
g_autoptr (GcalEvent) event = NULL;
g_autoptr (GString) unfolded = NULL;
g_autoptr (GError) error = NULL;
g_autofree gchar *string = NULL;
g_autofree gchar *url = NULL;
event = create_event_for_string (STUB_EVENT, &error);
g_assert_no_error (error);
g_assert_null (gcal_event_dup_conference_url (event));
gcal_event_add_conference (event, ROOM_URL, "Jitsi");
/* Adding the same conference again doesn't duplicate it */
gcal_event_add_conference (event, ROOM_URL, "Jitsi");
url = gcal_event_dup_conference_url (event);
g_assert_cmpstr (url, ==, ROOM_URL);
string = e_cal_component_get_as_string (gcal_event_get_component (event));
g_test_message ("%s", string);
/* Unfold the long lines */
unfolded = g_string_new (string);
g_string_replace (unfolded, "\r\n ", "", 0);
g_string_replace (unfolded, "\n ", "", 0);
g_free (string);
string = g_string_free (g_steal_pointer (&unfolded), FALSE);
g_assert_nonnull (strstr (string, "CONFERENCE;"));
g_assert_nonnull (strstr (string, "VALUE=URI"));
g_assert_nonnull (strstr (string, "FEATURE=AUDIO,VIDEO"));
g_assert_nonnull (strstr (string, "LABEL=Jitsi"));
g_assert_nonnull (strstr (string, ":" ROOM_URL));
g_assert_null (strstr (strstr (string, "CONFERENCE;") + 1, "CONFERENCE;"));
/* It survives a round trip through the iCalendar text, as on a server */
reloaded = create_event_for_string (string, &error);
g_assert_no_error (error);
g_assert_true (gcal_event_conferences_equal (event, reloaded));
g_clear_pointer (&url, g_free);
url = gcal_event_dup_conference_url (reloaded);
g_assert_cmpstr (url, ==, ROOM_URL);
gcal_event_remove_conference (event, ROOM_URL);
g_assert_null (gcal_event_dup_conference_url (event));
g_assert_false (gcal_event_conferences_equal (event, reloaded));
}
static void
event_remove_conference (void)
{
g_autoptr (GcalEvent) event = NULL;
g_autoptr (GError) error = NULL;
g_autofree gchar *url = NULL;
event = create_event_for_string (STUB_EVENT_WITH_CONFERENCE, &error);
g_assert_no_error (error);
/* The first conference that has a URL */
url = gcal_event_dup_conference_url (event);
g_assert_cmpstr (url, ==, "tel:+1-555-0100");
g_clear_pointer (&url, g_free);
/* Only the conference that's removed goes */
gcal_event_remove_conference (event, "tel:+1-555-0100");
url = gcal_event_dup_conference_url (event);
g_assert_cmpstr (url, ==, "https://example.com/room");
g_clear_pointer (&url, g_free);
gcal_event_remove_conference (event, "https://example.com/other-room");
url = gcal_event_dup_conference_url (event);
g_assert_cmpstr (url, ==, "https://example.com/room");
g_clear_pointer (&url, g_free);
gcal_event_remove_conference (event, "https://example.com/room");
g_assert_null (gcal_event_dup_conference_url (event));
}
static void
event_copy_conferences (void)
{
g_autoptr (GcalEvent) with_conference = NULL;
g_autoptr (GcalEvent) clone = NULL;
g_autoptr (GcalEvent) event = NULL;
g_autoptr (GError) error = NULL;
g_autofree gchar *url = NULL;
with_conference = create_event_for_string (STUB_EVENT_WITH_CONFERENCE, &error);
g_assert_no_error (error);
event = create_event_for_string (STUB_EVENT, &error);
g_assert_no_error (error);
gcal_event_add_conference (event, ROOM_URL, "Jitsi");
g_assert_false (gcal_event_conferences_equal (event, with_conference));
/* Copying replaces the conferences, rather than adding to them */
gcal_event_copy_conferences (event, with_conference);
g_assert_true (gcal_event_conferences_equal (event, with_conference));
url = gcal_event_dup_conference_url (event);
g_assert_cmpstr (url, ==, "tel:+1-555-0100");
/* The event editor works on a clone */
clone = gcal_event_new_from_event (with_conference);
g_assert_true (gcal_event_conferences_equal (clone, with_conference));
}
/*********************************************************************************************************************/
gint
main (gint argc,
gchar *argv[])
@@ -694,6 +822,9 @@ main (gint argc,
g_test_add_func ("/event/attendees/invite", event_invite_attendees);
g_test_add_func ("/event/attendees/copy", event_copy_attendees);
g_test_add_func ("/event/equal/schedule", event_schedule_equal);
g_test_add_func ("/event/conference/add", event_add_conference);
g_test_add_func ("/event/conference/remove", event_remove_conference);
g_test_add_func ("/event/conference/copy", event_copy_conferences);
return g_test_run ();
}