<?php
declare(strict_types=1);
/**
* @copyright Copyright (c) 2020 Julien Veyssier <eneiluj@posteo.net>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
namespace OCA\Talk;
use OCP\IConfig;
use OCP\IDBConnection;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IL10N;
use OCP\IUserManager;
use OCP\Files\IAppData;
use OCP\Files\NotFoundException;
use OCP\Files\SimpleFS\ISimpleFolder;
use OCP\IURLGenerator;
use OC\Authentication\Token\IProvider as IAuthTokenProvider;
use OC\Authentication\Token\IToken;
use OCP\Security\ISecureRandom;
use OCP\IAvatarManager;
use Doctrine\DBAL\Exception\UniqueConstraintViolationException;
use Psr\Log\LoggerInterface;
use OCA\Talk\Exceptions\ImpossibleToKillException;
use OCA\Talk\Exceptions\WrongPermissionsException;
use OCA\Talk\Exceptions\ParticipantNotFoundException;
class MatterbridgeManager {
/** @var IDBConnection */
private $db;
/** @var IConfig */
private $config;
/** @var IAppData */
private $appData;
/** @var IL10N */
private $l;
/** @var IUserManager */
private $userManager;
/** @var IAuthTokenProvider */
private $tokenProvider;
/** @var ISecureRandom */
private $random;
public function __construct(IDBConnection $db,
IConfig $config,
IAppData $appData,
IURLGenerator $urlGenerator,
IUserManager $userManager,
Manager $manager,
IAuthTokenProvider $tokenProvider,
ISecureRandom $random,
IAvatarManager $avatarManager,
LoggerInterface $logger,
IL10N $l) {
$this->avatarManager = $avatarManager;
$this->db = $db;
$this->config = $config;
$this->urlGenerator = $urlGenerator;
$this->appData = $appData;
$this->userManager = $userManager;
$this->manager = $manager;
$this->tokenProvider = $tokenProvider;
$this->random = $random;
$this->logger = $logger;
$this->l = $l;
}
/**
* Get bridge information for a specific room
*
* @param Room $room the room
* @return array decoded json bridge information
*/
public function getBridgeOfRoom(Room $room): array {
return $this->getBridgeFromDb($room);
}
/**
*