01acfa3b40
Type checking / changes (push) Has been cancelled
Type checking / test (push) Has been cancelled
Type checking / typescript-summary (push) Has been cancelled
Node tests / changes (push) Has been cancelled
Node tests / test (push) Has been cancelled
Node tests / test-summary (push) Has been cancelled
Источник: https://github.com/nextcloud/spreed/archive/refs/tags/v22.0.12.tar.gz С этого коммита ветка официального Nextcloud Talk отрезана (решение владельца 2026-07-06). Все дальнейшие изменения — только наши; версии релизов: 22.0.12-f7.N.
72 lines
1.8 KiB
PHP
72 lines
1.8 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
/**
|
|
* SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
*/
|
|
|
|
namespace OCA\Talk\OCP;
|
|
|
|
use OCA\Talk\Manager;
|
|
use OCA\Talk\Model\Attendee;
|
|
use OCA\Talk\Participant;
|
|
use OCA\Talk\Room;
|
|
use OCA\Talk\Service\ParticipantService;
|
|
use OCA\Talk\Service\RoomService;
|
|
use OCP\IURLGenerator;
|
|
use OCP\Talk\IConversation;
|
|
use OCP\Talk\IConversationOptions;
|
|
use OCP\Talk\ITalkBackend;
|
|
|
|
class TalkBackend implements ITalkBackend {
|
|
|
|
public function __construct(
|
|
protected Manager $manager,
|
|
protected ParticipantService $participantService,
|
|
protected RoomService $roomService,
|
|
protected IURLGenerator $url,
|
|
) {
|
|
}
|
|
|
|
#[\Override]
|
|
public function createConversation(string $name, array $moderators, IConversationOptions $options): IConversation {
|
|
$objectType = $objectId = '';
|
|
if (method_exists($options, 'getMeetingStartDate')) {
|
|
if ($options->getMeetingStartDate() !== null) {
|
|
$objectType = Room::OBJECT_TYPE_EVENT;
|
|
$objectId = $options->getMeetingStartDate()->getTimestamp() . '#' . $options->getMeetingEndDate()->getTimestamp();
|
|
}
|
|
}
|
|
|
|
$room = $this->manager->createRoom(
|
|
$options->isPublic() ? Room::TYPE_PUBLIC : Room::TYPE_GROUP,
|
|
$name,
|
|
$objectType,
|
|
$objectId,
|
|
);
|
|
|
|
if (!empty($moderators)) {
|
|
$users = [];
|
|
foreach ($moderators as $moderator) {
|
|
$users[] = [
|
|
'actorType' => Attendee::ACTOR_USERS,
|
|
'actorId' => $moderator->getUID(),
|
|
'participantType' => Participant::MODERATOR,
|
|
];
|
|
}
|
|
|
|
$this->participantService->addUsers($room, $users);
|
|
}
|
|
|
|
return new Conversation($this->url, $room);
|
|
}
|
|
|
|
#[\Override]
|
|
public function deleteConversation(string $id): void {
|
|
$room = $this->manager->getRoomByToken($id);
|
|
$this->roomService->deleteRoom($room);
|
|
}
|
|
}
|