Loading patches/029-add-jitsi-link.patch 0 → 100644 +32 −0 Original line number Diff line number Diff line From: Avinash Gusain <avinash.gusain.ext@murena.com> Date: Mon, 24 July 2023 11:50:00 +0530 Subject: [PATCH] Add jitsi link in location This patch creates a jitsi link in location if it is empty and attendee is added --- apps/dav/lib/CalDAV/CalDavBackend.php 2023-07-24 14:32:46.692916758 +0530 +++ apps/dav/lib/CalDAV/CalDavBackend-new.php 2023-07-24 13:59:24.132918240 +0530 @@ -1217,6 +1217,23 @@ * @return string */ public function createCalendarObject($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) { + // If attendee exist and + if (strpos($calendarData, 'ATTENDEE;') !== false && strpos($calendarData, 'LOCATION:') === false) { + $url = 'https://meet.jit.si/'; + $chars = '0123456789abcdefghijklmnopqrstuvwxyz'; + $result = ''; + $length = strlen($chars); + for ($i = $length; $i > 0; --$i) { + $result .= $chars[rand(0, strlen($chars) - 1)]; + } + + $todaynow = new DateTime(); + $randomString = $result . $todaynow->format('d') . $todaynow->format('m') . substr($todaynow->format('Y'), -2); + + $url = $url . $randomString; + $calendarData = preg_replace('/(SUMMARY:[^\r\n]*)/', "$1\nLOCATION: $url", $calendarData); + } + $extraData = $this->getDenormalizedData($calendarData); // Try to detect duplicates Loading
patches/029-add-jitsi-link.patch 0 → 100644 +32 −0 Original line number Diff line number Diff line From: Avinash Gusain <avinash.gusain.ext@murena.com> Date: Mon, 24 July 2023 11:50:00 +0530 Subject: [PATCH] Add jitsi link in location This patch creates a jitsi link in location if it is empty and attendee is added --- apps/dav/lib/CalDAV/CalDavBackend.php 2023-07-24 14:32:46.692916758 +0530 +++ apps/dav/lib/CalDAV/CalDavBackend-new.php 2023-07-24 13:59:24.132918240 +0530 @@ -1217,6 +1217,23 @@ * @return string */ public function createCalendarObject($calendarId, $objectUri, $calendarData, $calendarType = self::CALENDAR_TYPE_CALENDAR) { + // If attendee exist and + if (strpos($calendarData, 'ATTENDEE;') !== false && strpos($calendarData, 'LOCATION:') === false) { + $url = 'https://meet.jit.si/'; + $chars = '0123456789abcdefghijklmnopqrstuvwxyz'; + $result = ''; + $length = strlen($chars); + for ($i = $length; $i > 0; --$i) { + $result .= $chars[rand(0, strlen($chars) - 1)]; + } + + $todaynow = new DateTime(); + $randomString = $result . $todaynow->format('d') . $todaynow->format('m') . substr($todaynow->format('Y'), -2); + + $url = $url . $randomString; + $calendarData = preg_replace('/(SUMMARY:[^\r\n]*)/', "$1\nLOCATION: $url", $calendarData); + } + $extraData = $this->getDenormalizedData($calendarData); // Try to detect duplicates