Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Rudolf <github.com@daniel-rudolf.de>2020-05-13 16:54:12 +0300
committerDaniel Rudolf <github.com@daniel-rudolf.de>2020-05-13 16:54:12 +0300
commit408baed9a63235ef02650bb82cee0769592f1bce (patch)
tree93d563ec5e6dcfd9ded46719823b08f3eed457fe /lib
parent5cb784bde78ff90ade25eab21cb718cff6d2c688 (diff)
parentbf95303f9fee010149dd67f07049c6d6c277c9fc (diff)
Merge branch 'master' into feature/cmd-room-followup
Diffstat (limited to 'lib')
-rw-r--r--lib/Activity/Listener.php7
-rw-r--r--lib/Activity/Provider/Base.php1
-rw-r--r--lib/Activity/Provider/Call.php2
-rw-r--r--lib/Activity/Provider/Invitation.php2
-rw-r--r--lib/Activity/Setting.php3
-rw-r--r--lib/AppInfo/Application.php11
-rw-r--r--lib/BackgroundJob/ExpireSignalingMessage.php1
-rw-r--r--lib/BackgroundJob/RemoveEmptyRooms.php1
-rw-r--r--lib/BackgroundJob/ResetAssignedSignalingServer.php50
-rw-r--r--lib/Capabilities.php1
-rw-r--r--lib/Chat/AutoComplete/SearchPlugin.php2
-rw-r--r--lib/Chat/AutoComplete/Sorter.php8
-rw-r--r--lib/Chat/Changelog/Listener.php4
-rw-r--r--lib/Chat/Changelog/Manager.php2
-rw-r--r--lib/Chat/ChatManager.php2
-rw-r--r--lib/Chat/Command/Executor.php9
-rw-r--r--lib/Chat/Command/Listener.php4
-rw-r--r--lib/Chat/Command/ShellExecutor.php3
-rw-r--r--lib/Chat/CommentsManager.php2
-rw-r--r--lib/Chat/MessageParser.php7
-rw-r--r--lib/Chat/Notifier.php2
-rw-r--r--lib/Chat/Parser/Changelog.php2
-rw-r--r--lib/Chat/Parser/Command.php1
-rw-r--r--lib/Chat/Parser/Listener.php10
-rw-r--r--lib/Chat/Parser/SystemMessage.php60
-rw-r--r--lib/Chat/Parser/UserMention.php3
-rw-r--r--lib/Chat/SystemMessage/Listener.php40
-rw-r--r--lib/Collaboration/Collaborators/Listener.php4
-rw-r--r--lib/Collaboration/Collaborators/RoomPlugin.php2
-rw-r--r--lib/Collaboration/Resources/ConversationProvider.php7
-rw-r--r--lib/Collaboration/Resources/Listener.php12
-rw-r--r--lib/Command/Command/Add.php3
-rw-r--r--lib/Command/Command/AddSamples.php4
-rw-r--r--lib/Command/Command/Delete.php1
-rw-r--r--lib/Command/Command/ListCommand.php2
-rw-r--r--lib/Command/Command/TRenderCommand.php5
-rw-r--r--lib/Command/Command/Update.php2
-rw-r--r--lib/Command/Room/Add.php1
-rw-r--r--lib/Command/Room/Create.php1
-rw-r--r--lib/Command/Room/Delete.php1
-rw-r--r--lib/Command/Room/Demote.php1
-rw-r--r--lib/Command/Room/Promote.php1
-rw-r--r--lib/Command/Room/Remove.php1
-rw-r--r--lib/Command/Room/TRoomCommand.php4
-rw-r--r--lib/Command/Room/Update.php1
-rw-r--r--lib/Command/Signaling/Add.php1
-rw-r--r--lib/Command/Signaling/Delete.php3
-rw-r--r--lib/Command/Signaling/ListCommand.php2
-rw-r--r--lib/Command/Stun/Add.php1
-rw-r--r--lib/Command/Stun/Delete.php3
-rw-r--r--lib/Command/Stun/ListCommand.php2
-rw-r--r--lib/Command/Turn/Add.php1
-rw-r--r--lib/Command/Turn/Delete.php3
-rw-r--r--lib/Command/Turn/ListCommand.php2
-rw-r--r--lib/Config.php74
-rw-r--r--lib/ContactsMenu/Providers/CallProvider.php4
-rw-r--r--lib/Controller/AEnvironmentAwareController.php2
-rw-r--r--lib/Controller/CallController.php2
-rw-r--r--lib/Controller/ChatController.php10
-rw-r--r--lib/Controller/CommandController.php2
-rw-r--r--lib/Controller/FilesIntegrationController.php2
-rw-r--r--lib/Controller/GuestController.php2
-rw-r--r--lib/Controller/PageController.php7
-rw-r--r--lib/Controller/PublicShareAuthController.php1
-rw-r--r--lib/Controller/RoomController.php18
-rw-r--r--lib/Controller/SettingsController.php1
-rw-r--r--lib/Controller/SignalingController.php84
-rw-r--r--lib/Controller/WebinarController.php1
-rw-r--r--lib/Events/AddEmailEvent.php2
-rw-r--r--lib/Events/AddParticipantsEvent.php2
-rw-r--r--lib/Events/ChatEvent.php2
-rw-r--r--lib/Events/ChatMessageEvent.php2
-rw-r--r--lib/Events/ChatParticipantEvent.php2
-rw-r--r--lib/Events/CommandEvent.php2
-rw-r--r--lib/Events/CreateRoomTokenEvent.php3
-rw-r--r--lib/Events/JoinRoomGuestEvent.php3
-rw-r--r--lib/Events/JoinRoomUserEvent.php3
-rw-r--r--lib/Events/ModifyLobbyEvent.php3
-rw-r--r--lib/Events/ModifyParticipantEvent.php2
-rw-r--r--lib/Events/ModifyRoomEvent.php2
-rw-r--r--lib/Events/ParticipantEvent.php2
-rw-r--r--lib/Events/RemoveParticipantEvent.php2
-rw-r--r--lib/Events/RemoveUserEvent.php2
-rw-r--r--lib/Events/RoomEvent.php2
-rw-r--r--lib/Events/SignalingEvent.php2
-rw-r--r--lib/Events/SignalingRoomPropertiesEvent.php2
-rw-r--r--lib/Events/UserEvent.php2
-rw-r--r--lib/Events/VerifyRoomPasswordEvent.php2
-rw-r--r--lib/Exceptions/ForbiddenException.php2
-rw-r--r--lib/Exceptions/InvalidPasswordException.php2
-rw-r--r--lib/Exceptions/ParticipantNotFoundException.php2
-rw-r--r--lib/Exceptions/RoomNotFoundException.php2
-rw-r--r--lib/Exceptions/UnauthorizedException.php2
-rw-r--r--lib/Files/Listener.php8
-rw-r--r--lib/Files/TemplateLoader.php6
-rw-r--r--lib/Files/Util.php6
-rw-r--r--lib/Flow/Operation.php17
-rw-r--r--lib/GuestManager.php3
-rw-r--r--lib/Listener.php3
-rw-r--r--lib/Listener/CSPListener.php2
-rw-r--r--lib/Listener/FeaturePolicyListener.php3
-rw-r--r--lib/Listener/RestrictStartingCalls.php4
-rw-r--r--lib/Manager.php30
-rw-r--r--lib/Middleware/CanUseTalkMiddleware.php1
-rw-r--r--lib/Middleware/Exceptions/CanNotUseTalkException.php1
-rw-r--r--lib/Middleware/Exceptions/LobbyException.php1
-rw-r--r--lib/Middleware/Exceptions/NotAModeratorException.php1
-rw-r--r--lib/Middleware/Exceptions/ReadOnlyException.php1
-rw-r--r--lib/Middleware/InjectionMiddleware.php1
-rw-r--r--lib/Migration/ClearResourceAccessCache.php2
-rw-r--r--lib/Migration/FixNamespaceInDatabaseTables.php2
-rw-r--r--lib/Migration/Version2000Date20170707093535.php2
-rw-r--r--lib/Migration/Version2000Date20171026140256.php3
-rw-r--r--lib/Migration/Version2000Date20171026140257.php3
-rw-r--r--lib/Migration/Version2001Date20170707115443.php2
-rw-r--r--lib/Migration/Version2001Date20170913104501.php2
-rw-r--r--lib/Migration/Version2001Date20170921145301.php2
-rw-r--r--lib/Migration/Version2001Date20170929092606.php1
-rw-r--r--lib/Migration/Version2001Date20171009132424.php2
-rw-r--r--lib/Migration/Version2001Date20171026134605.php9
-rw-r--r--lib/Migration/Version2001Date20171026141336.php1
-rw-r--r--lib/Migration/Version2001Date20171031102049.php2
-rw-r--r--lib/Migration/Version2001Date20180103144447.php3
-rw-r--r--lib/Migration/Version2001Date20180103150836.php1
-rw-r--r--lib/Migration/Version3002Date20180319104030.php1
-rw-r--r--lib/Migration/Version3003Date20180707222130.php1
-rw-r--r--lib/Migration/Version3003Date20180718112436.php3
-rw-r--r--lib/Migration/Version3003Date20180718133519.php1
-rw-r--r--lib/Migration/Version3003Date20180720162342.php1
-rw-r--r--lib/Migration/Version3003Date20180722152733.php2
-rw-r--r--lib/Migration/Version3003Date20180722152849.php1
-rw-r--r--lib/Migration/Version3003Date20180730080327.php1
-rw-r--r--lib/Migration/Version4099Date20181001123058.php1
-rw-r--r--lib/Migration/Version5099Date20190121102337.php1
-rw-r--r--lib/Migration/Version5099Date20190319134820.php2
-rw-r--r--lib/Migration/Version7000Date20190717141457.php1
-rw-r--r--lib/Migration/Version7000Date20190724121136.php1
-rw-r--r--lib/Migration/Version8000Date20200331144101.php2
-rw-r--r--lib/Migration/Version8000Date20200402124456.php2
-rw-r--r--lib/Migration/Version8000Date20200407073807.php2
-rw-r--r--lib/Migration/Version8000Date20200407115318.php57
-rw-r--r--lib/Model/Command.php2
-rw-r--r--lib/Model/CommandMapper.php1
-rw-r--r--lib/Model/Message.php3
-rw-r--r--lib/Notification/Listener.php15
-rw-r--r--lib/Notification/Notifier.php39
-rw-r--r--lib/Participant.php1
-rw-r--r--lib/PublicShare/TemplateLoader.php8
-rw-r--r--lib/PublicShareAuth/Listener.php9
-rw-r--r--lib/PublicShareAuth/TemplateLoader.php8
-rw-r--r--lib/Room.php41
-rw-r--r--lib/Service/CommandService.php2
-rw-r--r--lib/Settings/Admin/AdminSettings.php5
-rw-r--r--lib/Settings/Admin/Section.php2
-rw-r--r--lib/Settings/Personal.php2
-rw-r--r--lib/Share/Helper/DeletedShareAPIController.php4
-rw-r--r--lib/Share/Helper/ShareAPIController.php3
-rw-r--r--lib/Share/Listener.php2
-rw-r--r--lib/Share/RoomShareProvider.php25
-rw-r--r--lib/Signaling/BackendNotifier.php41
-rw-r--r--lib/Signaling/Listener.php34
-rw-r--r--lib/Signaling/Manager.php112
-rw-r--r--lib/Signaling/Messages.php2
-rw-r--r--lib/TInitialState.php17
-rw-r--r--lib/TalkSession.php3
-rw-r--r--lib/Webinary.php4
166 files changed, 747 insertions, 418 deletions
diff --git a/lib/Activity/Listener.php b/lib/Activity/Listener.php
index 53c4c13c9..6a17d78f6 100644
--- a/lib/Activity/Listener.php
+++ b/lib/Activity/Listener.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2017 Joas Schilling <coding@schilljs.com>
@@ -64,14 +65,14 @@ class Listener {
}
public static function register(IEventDispatcher $dispatcher): void {
- $listener = static function(ModifyParticipantEvent $event) {
+ $listener = static function (ModifyParticipantEvent $event) {
/** @var self $listener */
$listener = \OC::$server->query(self::class);
$listener->setActive($event->getRoom());
};
$dispatcher->addListener(Room::EVENT_AFTER_SESSION_JOIN_CALL, $listener);
- $listener = static function(RoomEvent $event) {
+ $listener = static function (RoomEvent $event) {
/** @var self $listener */
$listener = \OC::$server->query(self::class);
$listener->generateCallActivity($event->getRoom());
@@ -81,7 +82,7 @@ class Listener {
$dispatcher->addListener(Room::EVENT_AFTER_SESSION_LEAVE_CALL, $listener, -100);
$dispatcher->addListener(Room::EVENT_AFTER_ROOM_DISCONNECT, $listener, -100);
- $listener = static function(AddParticipantsEvent $event) {
+ $listener = static function (AddParticipantsEvent $event) {
/** @var self $listener */
$listener = \OC::$server->query(self::class);
$listener->generateInvitationActivity($event->getRoom(), $event->getParticipants());
diff --git a/lib/Activity/Provider/Base.php b/lib/Activity/Provider/Base.php
index 857cc9a54..1aa7c7b03 100644
--- a/lib/Activity/Provider/Base.php
+++ b/lib/Activity/Provider/Base.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2017 Joas Schilling <coding@schilljs.com>
diff --git a/lib/Activity/Provider/Call.php b/lib/Activity/Provider/Call.php
index b67f694d4..3a134ccd0 100644
--- a/lib/Activity/Provider/Call.php
+++ b/lib/Activity/Provider/Call.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2017 Joas Schilling <coding@schilljs.com>
@@ -146,5 +147,4 @@ class Call extends Base {
'params' => $params,
];
}
-
}
diff --git a/lib/Activity/Provider/Invitation.php b/lib/Activity/Provider/Invitation.php
index 251f21ef6..33ff9becf 100644
--- a/lib/Activity/Provider/Invitation.php
+++ b/lib/Activity/Provider/Invitation.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2017 Joas Schilling <coding@schilljs.com>
@@ -59,5 +60,4 @@ class Invitation extends Base {
return $event;
}
-
}
diff --git a/lib/Activity/Setting.php b/lib/Activity/Setting.php
index df20ba047..e913f4e15 100644
--- a/lib/Activity/Setting.php
+++ b/lib/Activity/Setting.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2017 Joas Schilling <coding@schilljs.com>
@@ -22,7 +23,6 @@ declare(strict_types=1);
namespace OCA\Talk\Activity;
-
use OCP\Activity\ISetting;
use OCP\IL10N;
@@ -93,4 +93,3 @@ class Setting implements ISetting {
return false;
}
}
-
diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php
index fcdff6582..3b2e7e856 100644
--- a/lib/AppInfo/Application.php
+++ b/lib/AppInfo/Application.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @author Joachim Bauch <mail@joachim-bauch.de>
@@ -62,10 +63,8 @@ use OCP\Security\CSP\AddContentSecurityPolicyEvent;
use OCP\Security\FeaturePolicy\AddFeaturePolicyEvent;
use OCP\Settings\IManager;
-
class Application extends App {
-
- const APP_ID = 'spreed';
+ public const APP_ID = 'spreed';
public function __construct(array $urlParams = []) {
parent::__construct(self::APP_ID, $urlParams);
@@ -139,7 +138,7 @@ class Application extends App {
}
protected function registerNavigationLink(IServerContainer $server): void {
- $server->getNavigationManager()->add(function() use ($server) {
+ $server->getNavigationManager()->add(function () use ($server) {
/** @var Config $config */
$config = $server->query(Config::class);
$user = $server->getUserSession()->getUser();
@@ -155,7 +154,7 @@ class Application extends App {
}
protected function registerRoomActivityHooks(IEventDispatcher $dispatcher): void {
- $listener = function(ChatEvent $event) {
+ $listener = function (ChatEvent $event) {
$room = $event->getRoom();
/** @var ITimeFactory $timeFactory */
$timeFactory = $this->getContainer()->query(ITimeFactory::class);
@@ -167,7 +166,7 @@ class Application extends App {
}
protected function registerChatHooks(IEventDispatcher $dispatcher): void {
- $listener = function(RoomEvent $event) {
+ $listener = function (RoomEvent $event) {
/** @var ChatManager $chatManager */
$chatManager = $this->getContainer()->query(ChatManager::class);
$chatManager->deleteMessages($event->getRoom());
diff --git a/lib/BackgroundJob/ExpireSignalingMessage.php b/lib/BackgroundJob/ExpireSignalingMessage.php
index f5661d690..656875d08 100644
--- a/lib/BackgroundJob/ExpireSignalingMessage.php
+++ b/lib/BackgroundJob/ExpireSignalingMessage.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2017 Joas Schilling <coding@schilljs.com>
diff --git a/lib/BackgroundJob/RemoveEmptyRooms.php b/lib/BackgroundJob/RemoveEmptyRooms.php
index 592a59a8e..3802a12af 100644
--- a/lib/BackgroundJob/RemoveEmptyRooms.php
+++ b/lib/BackgroundJob/RemoveEmptyRooms.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2018 Joas Schilling <coding@schilljs.com>
diff --git a/lib/BackgroundJob/ResetAssignedSignalingServer.php b/lib/BackgroundJob/ResetAssignedSignalingServer.php
new file mode 100644
index 000000000..2f657a748
--- /dev/null
+++ b/lib/BackgroundJob/ResetAssignedSignalingServer.php
@@ -0,0 +1,50 @@
+<?php
+
+declare(strict_types=1);
+/**
+ * @copyright Copyright (c) 2020, Joas Schilling <coding@schilljs.com>
+ *
+ * @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\BackgroundJob;
+
+use OC\BackgroundJob\TimedJob;
+use OCA\Talk\Manager;
+use OCP\ICache;
+use OCP\ICacheFactory;
+
+class ResetAssignedSignalingServer extends TimedJob {
+
+ /** @var Manager */
+ protected $manager;
+ /** @var ICache */
+ protected $cache;
+
+ public function __construct(Manager $manager,
+ ICacheFactory $cacheFactory) {
+ // Every 5 minutes
+ $this->setInterval(60 * 5);
+
+ $this->manager = $manager;
+ $this->cache = $cacheFactory->createDistributed('hpb_servers');
+ }
+
+ protected function run($argument): void {
+ $this->manager->resetAssignedSignalingServers($this->cache);
+ }
+}
diff --git a/lib/Capabilities.php b/lib/Capabilities.php
index caa5f86c3..5e2f15f6d 100644
--- a/lib/Capabilities.php
+++ b/lib/Capabilities.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2018, Joas Schilling <coding@schilljs.com>
diff --git a/lib/Chat/AutoComplete/SearchPlugin.php b/lib/Chat/AutoComplete/SearchPlugin.php
index 64d74172a..c429fee4f 100644
--- a/lib/Chat/AutoComplete/SearchPlugin.php
+++ b/lib/Chat/AutoComplete/SearchPlugin.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2018 Joas Schilling <coding@schilljs.com>
@@ -22,7 +23,6 @@ declare(strict_types=1);
namespace OCA\Talk\Chat\AutoComplete;
-
use OCA\Talk\Files\Util;
use OCA\Talk\GuestManager;
use OCA\Talk\Room;
diff --git a/lib/Chat/AutoComplete/Sorter.php b/lib/Chat/AutoComplete/Sorter.php
index 2d35d5f49..e9994e19c 100644
--- a/lib/Chat/AutoComplete/Sorter.php
+++ b/lib/Chat/AutoComplete/Sorter.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2018 Joas Schilling <coding@schilljs.com>
@@ -22,7 +23,6 @@ declare(strict_types=1);
namespace OCA\Talk\Chat\AutoComplete;
-
use OCA\Talk\Chat\CommentsManager;
use OCP\Collaboration\AutoComplete\ISorter;
@@ -62,9 +62,9 @@ class Sorter implements ISorter {
$context['itemId'],
'comment',
$type,
- array_map(function($suggestion) {
+ array_map(function ($suggestion) {
return $suggestion['value']['shareWith'];
- }, $byType));
+ }, $byType));
$search = $context['search'];
@@ -75,7 +75,7 @@ class Sorter implements ISorter {
if (stripos($b['label'], $search) !== 0) {
return -1;
}
- } else if (stripos($b['label'], $search) === 0) {
+ } elseif (stripos($b['label'], $search) === 0) {
return 1;
}
}
diff --git a/lib/Chat/Changelog/Listener.php b/lib/Chat/Changelog/Listener.php
index 8ce066b27..c89e9fda0 100644
--- a/lib/Chat/Changelog/Listener.php
+++ b/lib/Chat/Changelog/Listener.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
@@ -27,9 +28,8 @@ use OCA\Talk\Events\UserEvent;
use OCP\EventDispatcher\IEventDispatcher;
class Listener {
-
public static function register(IEventDispatcher $dispatcher): void {
- $dispatcher->addListener(RoomController::EVENT_BEFORE_ROOMS_GET, static function(UserEvent $event) {
+ $dispatcher->addListener(RoomController::EVENT_BEFORE_ROOMS_GET, static function (UserEvent $event) {
$userId = $event->getUserId();
/** @var Listener $listener */
diff --git a/lib/Chat/Changelog/Manager.php b/lib/Chat/Changelog/Manager.php
index 6b3371289..04b45fbcf 100644
--- a/lib/Chat/Changelog/Manager.php
+++ b/lib/Chat/Changelog/Manager.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
@@ -22,7 +23,6 @@ declare(strict_types=1);
namespace OCA\Talk\Chat\Changelog;
-
use OCA\Talk\Chat\ChatManager;
use OCA\Talk\Manager as RoomManager;
use OCP\AppFramework\Utility\ITimeFactory;
diff --git a/lib/Chat/ChatManager.php b/lib/Chat/ChatManager.php
index aa704f5ef..56568af6f 100644
--- a/lib/Chat/ChatManager.php
+++ b/lib/Chat/ChatManager.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
*
@@ -45,7 +46,6 @@ use OCP\IUser;
* pending notifications are removed if the messages are deleted.
*/
class ChatManager {
-
public const EVENT_BEFORE_SYSTEM_MESSAGE_SEND = self::class . '::preSendSystemMessage';
public const EVENT_AFTER_SYSTEM_MESSAGE_SEND = self::class . '::postSendSystemMessage';
public const EVENT_BEFORE_MESSAGE_SEND = self::class . '::preSendMessage';
diff --git a/lib/Chat/Command/Executor.php b/lib/Chat/Command/Executor.php
index 661ecbd0c..b61acde23 100644
--- a/lib/Chat/Command/Executor.php
+++ b/lib/Chat/Command/Executor.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
@@ -22,7 +23,6 @@ declare(strict_types=1);
namespace OCA\Talk\Chat\Command;
-
use OCA\Talk\Chat\ChatManager;
use OCA\Talk\Events\CommandEvent;
use OCA\Talk\Model\Command;
@@ -35,7 +35,6 @@ use OCP\IL10N;
use OCP\ILogger;
class Executor {
-
public const EVENT_APP_EXECUTE = self::class . '::execApp';
public const PLACEHOLDER_ROOM = '{ROOM}';
@@ -87,9 +86,9 @@ class Executor {
if ($command->getApp() === '' && $command->getCommand() === 'help') {
$output = $this->execHelp($room, $message, $arguments);
- } else if ($command->getApp() !== '') {
+ } elseif ($command->getApp() !== '') {
$output = $this->execApp($room, $message, $command, $arguments);
- } else {
+ } else {
$output = $this->execShell($room, $message, $command, $arguments);
}
@@ -115,7 +114,7 @@ class Executor {
if ($command->getApp() !== '') {
$response = $this->execHelpSingleCommand($room, $message, $command->getApp() . ' ' . $command->getCommand());
} else {
- if ($command->getCommand() === 'help') {
+ if ($command->getCommand() === 'help' || strpos($command->getScript(),'alias:') !== false) {
continue;
}
$response = $this->execHelpSingleCommand($room, $message, $command->getCommand());
diff --git a/lib/Chat/Command/Listener.php b/lib/Chat/Command/Listener.php
index cb370dbf6..165141e16 100644
--- a/lib/Chat/Command/Listener.php
+++ b/lib/Chat/Command/Listener.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
@@ -22,7 +23,6 @@ declare(strict_types=1);
namespace OCA\Talk\Chat\Command;
-
use OCA\Talk\Chat\ChatManager;
use OCA\Talk\Events\ChatParticipantEvent;
use OCA\Talk\Model\Command;
@@ -44,7 +44,7 @@ class Listener {
}
public static function register(IEventDispatcher $dispatcher): void {
- $dispatcher->addListener(ChatManager::EVENT_BEFORE_MESSAGE_SEND, static function(ChatParticipantEvent $event) {
+ $dispatcher->addListener(ChatManager::EVENT_BEFORE_MESSAGE_SEND, static function (ChatParticipantEvent $event) {
$message = $event->getComment();
$participant = $event->getParticipant();
diff --git a/lib/Chat/Command/ShellExecutor.php b/lib/Chat/Command/ShellExecutor.php
index 40515c708..605732384 100644
--- a/lib/Chat/Command/ShellExecutor.php
+++ b/lib/Chat/Command/ShellExecutor.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
@@ -22,9 +23,7 @@ declare(strict_types=1);
namespace OCA\Talk\Chat\Command;
-
class ShellExecutor {
-
public const PLACEHOLDER_ROOM = '{ROOM}';
public const PLACEHOLDER_USER = '{USER}';
public const PLACEHOLDER_ARGUMENTS = '{ARGUMENTS}';
diff --git a/lib/Chat/CommentsManager.php b/lib/Chat/CommentsManager.php
index ee6df07f2..287299d29 100644
--- a/lib/Chat/CommentsManager.php
+++ b/lib/Chat/CommentsManager.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2018 Joas Schilling <coding@schilljs.com>
@@ -22,7 +23,6 @@ declare(strict_types=1);
namespace OCA\Talk\Chat;
-
use OC\Comments\Comment;
use OC\Comments\Manager;
use OCP\AppFramework\Utility\ITimeFactory;
diff --git a/lib/Chat/MessageParser.php b/lib/Chat/MessageParser.php
index ba46c718b..176be751e 100644
--- a/lib/Chat/MessageParser.php
+++ b/lib/Chat/MessageParser.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
*
@@ -23,7 +24,6 @@ declare(strict_types=1);
namespace OCA\Talk\Chat;
-use OCA\Talk\Events\ChatEvent;
use OCA\Talk\Events\ChatMessageEvent;
use OCA\Talk\Exceptions\ParticipantNotFoundException;
use OCA\Talk\GuestManager;
@@ -40,7 +40,6 @@ use OCP\IUserManager;
* Helper class to get a rich message from a plain text message.
*/
class MessageParser {
-
public const EVENT_MESSAGE_PARSE = self::class . '::parseMessage';
/** @var IEventDispatcher */
@@ -83,7 +82,7 @@ class MessageParser {
if ($comment->getActorType() === 'users') {
$user = $this->userManager->get($comment->getActorId());
$displayName = $user instanceof IUser ? $user->getDisplayName() : $comment->getActorId();
- } else if ($comment->getActorType() === 'guests') {
+ } elseif ($comment->getActorType() === 'guests') {
if (isset($guestNames[$comment->getActorId()])) {
$displayName = $this->guestNames[$comment->getActorId()];
} else {
@@ -93,7 +92,7 @@ class MessageParser {
}
$this->guestNames[$comment->getActorId()] = $displayName;
}
- } else if ($comment->getActorType() === 'bots') {
+ } elseif ($comment->getActorType() === 'bots') {
$displayName = $comment->getActorId() . '-bot';
}
diff --git a/lib/Chat/Notifier.php b/lib/Chat/Notifier.php
index 467e5e2f7..f381a55bb 100644
--- a/lib/Chat/Notifier.php
+++ b/lib/Chat/Notifier.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
*
@@ -207,7 +208,6 @@ class Notifier {
* @param string $userId
*/
public function markMentionNotificationsRead(Room $chat, ?string $userId): void {
-
if ($userId === null || $userId === '') {
return;
}
diff --git a/lib/Chat/Parser/Changelog.php b/lib/Chat/Parser/Changelog.php
index 12e515adc..2f6621848 100644
--- a/lib/Chat/Parser/Changelog.php
+++ b/lib/Chat/Parser/Changelog.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2018 Joas Schilling <coding@schilljs.com>
@@ -31,7 +32,6 @@ class Changelog {
* @throws \OutOfBoundsException
*/
public function parseMessage(Message $chatMessage): void {
-
if ($chatMessage->getActorType() !== 'guests' ||
$chatMessage->getActorId() !== 'changelog') {
throw new \OutOfBoundsException('Not a changelog');
diff --git a/lib/Chat/Parser/Command.php b/lib/Chat/Parser/Command.php
index f680469aa..4e093c269 100644
--- a/lib/Chat/Parser/Command.php
+++ b/lib/Chat/Parser/Command.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2018 Joas Schilling <coding@schilljs.com>
diff --git a/lib/Chat/Parser/Listener.php b/lib/Chat/Parser/Listener.php
index fbda032e6..2cb2fac3a 100644
--- a/lib/Chat/Parser/Listener.php
+++ b/lib/Chat/Parser/Listener.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2018 Joas Schilling <coding@schilljs.com>
@@ -28,9 +29,8 @@ use OCA\Talk\Events\ChatMessageEvent;
use OCP\EventDispatcher\IEventDispatcher;
class Listener {
-
public static function register(IEventDispatcher $dispatcher): void {
- $dispatcher->addListener(MessageParser::EVENT_MESSAGE_PARSE, static function(ChatMessageEvent $event) {
+ $dispatcher->addListener(MessageParser::EVENT_MESSAGE_PARSE, static function (ChatMessageEvent $event) {
$message = $event->getMessage();
if ($message->getMessageType() !== 'comment') {
@@ -42,7 +42,7 @@ class Listener {
$parser->parseMessage($message);
}, -100);
- $dispatcher->addListener(MessageParser::EVENT_MESSAGE_PARSE, static function(ChatMessageEvent $event) {
+ $dispatcher->addListener(MessageParser::EVENT_MESSAGE_PARSE, static function (ChatMessageEvent $event) {
$message = $event->getMessage();
if ($message->getMessageType() !== 'comment') {
@@ -59,7 +59,7 @@ class Listener {
}
}, -75);
- $dispatcher->addListener(MessageParser::EVENT_MESSAGE_PARSE, static function(ChatMessageEvent $event) {
+ $dispatcher->addListener(MessageParser::EVENT_MESSAGE_PARSE, static function (ChatMessageEvent $event) {
$message = $event->getMessage();
if ($message->getMessageType() !== 'system') {
@@ -77,7 +77,7 @@ class Listener {
}
});
- $dispatcher->addListener(MessageParser::EVENT_MESSAGE_PARSE, static function(ChatMessageEvent $event) {
+ $dispatcher->addListener(MessageParser::EVENT_MESSAGE_PARSE, static function (ChatMessageEvent $event) {
$chatMessage = $event->getMessage();
if ($chatMessage->getMessageType() !== 'command') {
diff --git a/lib/Chat/Parser/SystemMessage.php b/lib/Chat/Parser/SystemMessage.php
index be3972ff5..222ac8d9c 100644
--- a/lib/Chat/Parser/SystemMessage.php
+++ b/lib/Chat/Parser/SystemMessage.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2018 Joas Schilling <coding@schilljs.com>
@@ -22,13 +23,10 @@ declare(strict_types=1);
namespace OCA\Talk\Chat\Parser;
-
-use OCA\Talk\Chat\ChatManager;
use OCA\Talk\Exceptions\ParticipantNotFoundException;
use OCA\Talk\GuestManager;
use OCA\Talk\Model\Message;
use OCA\Talk\Participant;
-use OCA\Talk\Room;
use OCA\Talk\Share\RoomShareProvider;
use OCP\Comments\IComment;
use OCP\Files\IRootFolder;
@@ -106,71 +104,71 @@ class SystemMessage {
if ($currentUserIsActor) {
$parsedMessage = $this->l->t('You created the conversation');
}
- } else if ($message === 'conversation_renamed') {
+ } elseif ($message === 'conversation_renamed') {
$parsedMessage = $this->l->t('{actor} renamed the conversation from "%1$s" to "%2$s"', [$parameters['oldName'], $parameters['newName']]);
if ($currentUserIsActor) {
$parsedMessage = $this->l->t('You renamed the conversation from "%1$s" to "%2$s"', [$parameters['oldName'], $parameters['newName']]);
}
- } else if ($message === 'call_started') {
+ } elseif ($message === 'call_started') {
$parsedMessage = $this->l->t('{actor} started a call');
if ($currentUserIsActor) {
$parsedMessage = $this->l->t('You started a call');
}
- } else if ($message === 'call_joined') {
+ } elseif ($message === 'call_joined') {
$parsedMessage = $this->l->t('{actor} joined the call');
if ($currentUserIsActor) {
$parsedMessage = $this->l->t('You joined the call');
}
- } else if ($message === 'call_left') {
+ } elseif ($message === 'call_left') {
$parsedMessage = $this->l->t('{actor} left the call');
if ($currentUserIsActor) {
$parsedMessage = $this->l->t('You left the call');
}
- } else if ($message === 'call_ended') {
+ } elseif ($message === 'call_ended') {
[$parsedMessage, $parsedParameters] = $this->parseCall($parameters);
- } else if ($message === 'read_only_off') {
+ } elseif ($message === 'read_only_off') {
$parsedMessage = $this->l->t('{actor} unlocked the conversation');
if ($currentUserIsActor) {
$parsedMessage = $this->l->t('You unlocked the conversation');
}
- } else if ($message === 'read_only') {
+ } elseif ($message === 'read_only') {
$parsedMessage = $this->l->t('{actor} locked the conversation');
if ($currentUserIsActor) {
$parsedMessage = $this->l->t('You locked the conversation');
}
- } else if ($message === 'lobby_timer_reached') {
+ } elseif ($message === 'lobby_timer_reached') {
$parsedMessage = $this->l->t('The conversation is now open to everyone');
- } else if ($message === 'lobby_none') {
+ } elseif ($message === 'lobby_none') {
$parsedMessage = $this->l->t('{actor} opened the conversation to everyone');
if ($currentUserIsActor) {
$parsedMessage = $this->l->t('You opened the conversation to everyone');
}
- } else if ($message === 'lobby_non_moderators') {
+ } elseif ($message === 'lobby_non_moderators') {
$parsedMessage = $this->l->t('{actor} restricted the conversation to moderators');
if ($currentUserIsActor) {
$parsedMessage = $this->l->t('You restricted the conversation to moderators');
}
- } else if ($message === 'guests_allowed') {
+ } elseif ($message === 'guests_allowed') {
$parsedMessage = $this->l->t('{actor} allowed guests');
if ($currentUserIsActor) {
$parsedMessage = $this->l->t('You allowed guests');
}
- } else if ($message === 'guests_disallowed') {
+ } elseif ($message === 'guests_disallowed') {
$parsedMessage = $this->l->t('{actor} disallowed guests');
if ($currentUserIsActor) {
$parsedMessage = $this->l->t('You disallowed guests');
}
- } else if ($message === 'password_set') {
+ } elseif ($message === 'password_set') {
$parsedMessage = $this->l->t('{actor} set a password');
if ($currentUserIsActor) {
$parsedMessage = $this->l->t('You set a password');
}
- } else if ($message === 'password_removed') {
+ } elseif ($message === 'password_removed') {
$parsedMessage = $this->l->t('{actor} removed the password');
if ($currentUserIsActor) {
$parsedMessage = $this->l->t('You removed the password');
}
- } else if ($message === 'user_added') {
+ } elseif ($message === 'user_added') {
$parsedParameters['user'] = $this->getUser($parameters['user']);
$parsedMessage = $this->l->t('{actor} added {user}');
if ($parsedParameters['user']['id'] === $parsedParameters['actor']['id']) {
@@ -179,12 +177,12 @@ class SystemMessage {
} else {
$parsedMessage = $this->l->t('{actor} joined the conversation');
}
- } else if ($currentUserIsActor) {
+ } elseif ($currentUserIsActor) {
$parsedMessage = $this->l->t('You added {user}');
- } else if (!$participant->isGuest() && $participant->getUser() === $parsedParameters['user']['id']) {
+ } elseif (!$participant->isGuest() && $participant->getUser() === $parsedParameters['user']['id']) {
$parsedMessage = $this->l->t('{actor} added you');
}
- } else if ($message === 'user_removed') {
+ } elseif ($message === 'user_removed') {
$parsedParameters['user'] = $this->getUser($parameters['user']);
if ($parsedParameters['user']['id'] === $parsedParameters['actor']['id']) {
if ($currentUserIsActor) {
@@ -196,43 +194,43 @@ class SystemMessage {
$parsedMessage = $this->l->t('{actor} removed {user}');
if ($currentUserIsActor) {
$parsedMessage = $this->l->t('You removed {user}');
- } else if (!$participant->isGuest() && $participant->getUser() === $parsedParameters['user']['id']) {
+ } elseif (!$participant->isGuest() && $participant->getUser() === $parsedParameters['user']['id']) {
$parsedMessage = $this->l->t('{actor} removed you');
}
}
- } else if ($message === 'moderator_promoted') {
+ } elseif ($message === 'moderator_promoted') {
$parsedParameters['user'] = $this->getUser($parameters['user']);
$parsedMessage = $this->l->t('{actor} promoted {user} to moderator');
if ($currentUserIsActor) {
$parsedMessage = $this->l->t('You promoted {user} to moderator');
- } else if (!$participant->isGuest() && $participant->getUser() === $parsedParameters['user']['id']) {
+ } elseif (!$participant->isGuest() && $participant->getUser() === $parsedParameters['user']['id']) {
$parsedMessage = $this->l->t('{actor} promoted you to moderator');
}
- } else if ($message === 'moderator_demoted') {
+ } elseif ($message === 'moderator_demoted') {
$parsedParameters['user'] = $this->getUser($parameters['user']);
$parsedMessage = $this->l->t('{actor} demoted {user} from moderator');
if ($currentUserIsActor) {
$parsedMessage = $this->l->t('You demoted {user} from moderator');
- } else if (!$participant->isGuest() && $participant->getUser() === $parsedParameters['user']['id']) {
+ } elseif (!$participant->isGuest() && $participant->getUser() === $parsedParameters['user']['id']) {
$parsedMessage = $this->l->t('{actor} demoted you from moderator');
}
- } else if ($message === 'guest_moderator_promoted') {
+ } elseif ($message === 'guest_moderator_promoted') {
$parsedParameters['user'] = $this->getGuest($parameters['session']);
$parsedMessage = $this->l->t('{actor} promoted {user} to moderator');
if ($currentUserIsActor) {
$parsedMessage = $this->l->t('You promoted {user} to moderator');
- } else if ($participant->isGuest() && $participant->getSessionId() === $parsedParameters['user']['id']) {
+ } elseif ($participant->isGuest() && $participant->getSessionId() === $parsedParameters['user']['id']) {
$parsedMessage = $this->l->t('{actor} promoted you to moderator');
}
- } else if ($message === 'guest_moderator_demoted') {
+ } elseif ($message === 'guest_moderator_demoted') {
$parsedParameters['user'] = $this->getGuest($parameters['session']);
$parsedMessage = $this->l->t('{actor} demoted {user} from moderator');
if ($currentUserIsActor) {
$parsedMessage = $this->l->t('You demoted {user} from moderator');
- } else if ($participant->isGuest() && $participant->getSessionId() === $parsedParameters['user']['id']) {
+ } elseif ($participant->isGuest() && $participant->getSessionId() === $parsedParameters['user']['id']) {
$parsedMessage = $this->l->t('{actor} demoted you from moderator');
}
- } else if ($message === 'file_shared') {
+ } elseif ($message === 'file_shared') {
try {
$parsedParameters['file'] = $this->getFileFromShare($participant, $parameters['share']);
$parsedMessage = '{file}';
diff --git a/lib/Chat/Parser/UserMention.php b/lib/Chat/Parser/UserMention.php
index a4a1d5901..38a20a2de 100644
--- a/lib/Chat/Parser/UserMention.php
+++ b/lib/Chat/Parser/UserMention.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
*
@@ -114,7 +115,7 @@ class UserMention {
'name' => $chatMessage->getRoom()->getDisplayName($chatMessage->getParticipant()->getUser()),
'call-type' => $this->getRoomType($chatMessage->getRoom()),
];
- } else if ($mention['type'] === 'guest') {
+ } elseif ($mention['type'] === 'guest') {
try {
$displayName = $this->guestManager->getNameBySessionHash(substr($mention['id'], strlen('guest/')));
} catch (ParticipantNotFoundException $e) {
diff --git a/lib/Chat/SystemMessage/Listener.php b/lib/Chat/SystemMessage/Listener.php
index 2fa0ce69f..de0ecc480 100644
--- a/lib/Chat/SystemMessage/Listener.php
+++ b/lib/Chat/SystemMessage/Listener.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2018 Joas Schilling <coding@schilljs.com>
@@ -22,7 +23,6 @@ declare(strict_types=1);
namespace OCA\Talk\Chat\SystemMessage;
-
use OCA\Talk\Chat\ChatManager;
use OCA\Talk\Events\AddParticipantsEvent;
use OCA\Talk\Events\ModifyLobbyEvent;
@@ -65,7 +65,7 @@ class Listener {
}
public static function register(IEventDispatcher $dispatcher): void {
- $dispatcher->addListener(Room::EVENT_BEFORE_SESSION_JOIN_CALL, static function(ModifyParticipantEvent $event) {
+ $dispatcher->addListener(Room::EVENT_BEFORE_SESSION_JOIN_CALL, static function (ModifyParticipantEvent $event) {
$room = $event->getRoom();
/** @var self $listener */
$listener = \OC::$server->query(self::class);
@@ -76,7 +76,7 @@ class Listener {
$listener->sendSystemMessage($room, 'call_started');
}
});
- $dispatcher->addListener(Room::EVENT_AFTER_SESSION_LEAVE_CALL, static function(ModifyParticipantEvent $event) {
+ $dispatcher->addListener(Room::EVENT_AFTER_SESSION_LEAVE_CALL, static function (ModifyParticipantEvent $event) {
$room = $event->getRoom();
if ($event->getParticipant()->getInCallFlags() === Participant::FLAG_DISCONNECTED) {
@@ -90,14 +90,14 @@ class Listener {
$listener->sendSystemMessage($room, 'call_left', [], $event->getParticipant());
});
- $dispatcher->addListener(Room::EVENT_AFTER_ROOM_CREATE, static function(RoomEvent $event) {
+ $dispatcher->addListener(Room::EVENT_AFTER_ROOM_CREATE, static function (RoomEvent $event) {
$room = $event->getRoom();
/** @var self $listener */
$listener = \OC::$server->query(self::class);
$listener->sendSystemMessage($room, 'conversation_created');
});
- $dispatcher->addListener(Room::EVENT_AFTER_NAME_SET, static function(ModifyRoomEvent $event) {
+ $dispatcher->addListener(Room::EVENT_AFTER_NAME_SET, static function (ModifyRoomEvent $event) {
if ($event->getOldValue() === '' ||
$event->getNewValue() === '') {
return;
@@ -112,7 +112,7 @@ class Listener {
'oldName' => $event->getOldValue(),
]);
});
- $dispatcher->addListener(Room::EVENT_AFTER_PASSWORD_SET, static function(ModifyRoomEvent $event) {
+ $dispatcher->addListener(Room::EVENT_AFTER_PASSWORD_SET, static function (ModifyRoomEvent $event) {
$room = $event->getRoom();
/** @var self $listener */
$listener = \OC::$server->query(self::class);
@@ -123,20 +123,20 @@ class Listener {
$listener->sendSystemMessage($room, 'password_removed');
}
});
- $dispatcher->addListener(Room::EVENT_AFTER_TYPE_SET, static function(ModifyRoomEvent $event) {
+ $dispatcher->addListener(Room::EVENT_AFTER_TYPE_SET, static function (ModifyRoomEvent $event) {
$room = $event->getRoom();
if ($event->getNewValue() === Room::PUBLIC_CALL) {
/** @var self $listener */
$listener = \OC::$server->query(self::class);
$listener->sendSystemMessage($room, 'guests_allowed');
- } else if ($event->getNewValue() === Room::GROUP_CALL) {
+ } elseif ($event->getNewValue() === Room::GROUP_CALL) {
/** @var self $listener */
$listener = \OC::$server->query(self::class);
$listener->sendSystemMessage($room, 'guests_disallowed');
}
});
- $dispatcher->addListener(Room::EVENT_AFTER_READONLY_SET, static function(ModifyRoomEvent $event) {
+ $dispatcher->addListener(Room::EVENT_AFTER_READONLY_SET, static function (ModifyRoomEvent $event) {
$room = $event->getRoom();
if ($room->getType() === Room::CHANGELOG_CONVERSATION) {
@@ -148,11 +148,11 @@ class Listener {
if ($event->getNewValue() === Room::READ_ONLY) {
$listener->sendSystemMessage($room, 'read_only');
- } else if ($event->getNewValue() === Room::READ_WRITE) {
+ } elseif ($event->getNewValue() === Room::READ_WRITE) {
$listener->sendSystemMessage($room, 'read_only_off');
}
});
- $dispatcher->addListener(Room::EVENT_AFTER_LOBBY_STATE_SET, static function(ModifyLobbyEvent $event) {
+ $dispatcher->addListener(Room::EVENT_AFTER_LOBBY_STATE_SET, static function (ModifyLobbyEvent $event) {
if ($event->getNewValue() === $event->getOldValue()) {
return;
}
@@ -164,14 +164,14 @@ class Listener {
if ($event->isTimerReached()) {
$listener->sendSystemMessage($room, 'lobby_timer_reached');
- } else if ($event->getNewValue() === Webinary::LOBBY_NONE) {
+ } elseif ($event->getNewValue() === Webinary::LOBBY_NONE) {
$listener->sendSystemMessage($room, 'lobby_none');
- } else if ($event->getNewValue() === Webinary::LOBBY_NON_MODERATORS) {
+ } elseif ($event->getNewValue() === Webinary::LOBBY_NON_MODERATORS) {
$listener->sendSystemMessage($room, 'lobby_non_moderators');
}
});
- $dispatcher->addListener(Room::EVENT_AFTER_USERS_ADD, static function(AddParticipantsEvent $event) {
+ $dispatcher->addListener(Room::EVENT_AFTER_USERS_ADD, static function (AddParticipantsEvent $event) {
$participants = $event->getParticipants();
$user = \OC::$server->getUserSession()->getUser();
$userId = $user instanceof IUser ? $user->getUID() : null;
@@ -192,7 +192,7 @@ class Listener {
}
}
});
- $dispatcher->addListener(Room::EVENT_AFTER_USER_REMOVE, static function(RemoveUserEvent $event) {
+ $dispatcher->addListener(Room::EVENT_AFTER_USER_REMOVE, static function (RemoveUserEvent $event) {
$room = $event->getRoom();
if ($room->getType() === Room::ONE_TO_ONE_CALL) {
@@ -203,28 +203,28 @@ class Listener {
$listener = \OC::$server->query(self::class);
$listener->sendSystemMessage($room, 'user_removed', ['user' => $event->getUser()->getUID()]);
});
- $dispatcher->addListener(Room::EVENT_AFTER_PARTICIPANT_TYPE_SET, static function(ModifyParticipantEvent $event) {
+ $dispatcher->addListener(Room::EVENT_AFTER_PARTICIPANT_TYPE_SET, static function (ModifyParticipantEvent $event) {
$room = $event->getRoom();
if ($event->getNewValue() === Participant::MODERATOR) {
/** @var self $listener */
$listener = \OC::$server->query(self::class);
$listener->sendSystemMessage($room, 'moderator_promoted', ['user' => $event->getParticipant()->getUser()]);
- } else if ($event->getNewValue() === Participant::USER) {
+ } elseif ($event->getNewValue() === Participant::USER) {
/** @var self $listener */
$listener = \OC::$server->query(self::class);
$listener->sendSystemMessage($room, 'moderator_demoted', ['user' => $event->getParticipant()->getUser()]);
- } else if ($event->getNewValue() === Participant::GUEST_MODERATOR) {
+ } elseif ($event->getNewValue() === Participant::GUEST_MODERATOR) {
/** @var self $listener */
$listener = \OC::$server->query(self::class);
$listener->sendSystemMessage($room, 'guest_moderator_promoted', ['session' => sha1($event->getParticipant()->getSessionId())]);
- } else if ($event->getNewValue() === Participant::GUEST) {
+ } elseif ($event->getNewValue() === Participant::GUEST) {
/** @var self $listener */
$listener = \OC::$server->query(self::class);
$listener->sendSystemMessage($room, 'guest_moderator_demoted', ['session' => sha1($event->getParticipant()->getSessionId())]);
}
});
- $listener = function(GenericEvent $event) {
+ $listener = function (GenericEvent $event) {
/** @var IShare $share */
$share = $event->getSubject();
diff --git a/lib/Collaboration/Collaborators/Listener.php b/lib/Collaboration/Collaborators/Listener.php
index 57bd52952..b5b2136ef 100644
--- a/lib/Collaboration/Collaborators/Listener.php
+++ b/lib/Collaboration/Collaborators/Listener.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @author Joachim Bauch <mail@joachim-bauch.de>
@@ -57,8 +58,7 @@ class Listener {
}
public static function register(IEventDispatcher $dispatcher): void {
-
- $dispatcher->addListener(IManager::class . '::filterResults', static function(AutoCompleteEvent $event) {
+ $dispatcher->addListener(IManager::class . '::filterResults', static function (AutoCompleteEvent $event) {
/** @var self $listener */
$listener = \OC::$server->query(self::class);
diff --git a/lib/Collaboration/Collaborators/RoomPlugin.php b/lib/Collaboration/Collaborators/RoomPlugin.php
index 3a55f7dfd..6d33922f0 100644
--- a/lib/Collaboration/Collaborators/RoomPlugin.php
+++ b/lib/Collaboration/Collaborators/RoomPlugin.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
*
@@ -91,5 +92,4 @@ class RoomPlugin implements ISearchPlugin {
]
];
}
-
}
diff --git a/lib/Collaboration/Resources/ConversationProvider.php b/lib/Collaboration/Resources/ConversationProvider.php
index d1dde2909..98d48dd26 100644
--- a/lib/Collaboration/Resources/ConversationProvider.php
+++ b/lib/Collaboration/Resources/ConversationProvider.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2018 Joas Schilling <coding@schilljs.com>
@@ -59,9 +60,9 @@ class ConversationProvider implements IProvider {
$iconURL = $this->urlGenerator->getAbsoluteURL($this->urlGenerator->imagePath('spreed', 'app-dark.svg'));
/**
* Disabled for now, because it would show a square avatar
- if ($room->getType() === Room::ONE_TO_ONE_CALL) {
- $iconURL = $this->urlGenerator->linkToRouteAbsolute('core.avatar.getAvatar', ['userId' => 'admin', 'size' => 32]);
- }
+ * if ($room->getType() === Room::ONE_TO_ONE_CALL) {
+ * $iconURL = $this->urlGenerator->linkToRouteAbsolute('core.avatar.getAvatar', ['userId' => 'admin', 'size' => 32]);
+ * }
*/
return [
diff --git a/lib/Collaboration/Resources/Listener.php b/lib/Collaboration/Resources/Listener.php
index 55f600c12..6005aa413 100644
--- a/lib/Collaboration/Resources/Listener.php
+++ b/lib/Collaboration/Resources/Listener.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
@@ -22,7 +23,6 @@ declare(strict_types=1);
namespace OCA\Talk\Collaboration\Resources;
-use OCA\Talk\Events\AddEmailEvent;
use OCA\Talk\Events\AddParticipantsEvent;
use OCA\Talk\Events\RemoveParticipantEvent;
use OCA\Talk\Events\RemoveUserEvent;
@@ -36,7 +36,7 @@ use OCP\IUserManager;
class Listener {
public static function register(IEventDispatcher $dispatcher): void {
- $listener = static function(RoomEvent $event) {
+ $listener = static function (RoomEvent $event) {
$room = $event->getRoom();
/** @var IManager $manager */
$resourceManager = \OC::$server->query(IManager::class);
@@ -50,7 +50,7 @@ class Listener {
};
$dispatcher->addListener(Room::EVENT_AFTER_ROOM_DELETE, $listener);
- $listener = static function(AddParticipantsEvent $event) {
+ $listener = static function (AddParticipantsEvent $event) {
$room = $event->getRoom();
/** @var IManager $manager */
$resourceManager = \OC::$server->query(IManager::class);
@@ -74,7 +74,7 @@ class Listener {
};
$dispatcher->addListener(Room::EVENT_AFTER_USERS_ADD, $listener);
- $listener = static function(RemoveUserEvent $event) {
+ $listener = static function (RemoveUserEvent $event) {
$room = $event->getRoom();
/** @var IManager $manager */
$resourceManager = \OC::$server->query(IManager::class);
@@ -88,7 +88,7 @@ class Listener {
};
$dispatcher->addListener(Room::EVENT_AFTER_USER_REMOVE, $listener);
- $listener = static function(RemoveParticipantEvent $event) {
+ $listener = static function (RemoveParticipantEvent $event) {
$room = $event->getRoom();
/** @var IManager $manager */
$resourceManager = \OC::$server->query(IManager::class);
@@ -106,7 +106,7 @@ class Listener {
};
$dispatcher->addListener(Room::EVENT_AFTER_PARTICIPANT_REMOVE, $listener);
- $listener = static function(RoomEvent $event) {
+ $listener = static function (RoomEvent $event) {
$room = $event->getRoom();
/** @var IManager $manager */
$resourceManager = \OC::$server->query(IManager::class);
diff --git a/lib/Command/Command/Add.php b/lib/Command/Command/Add.php
index cd2d24642..e7060106e 100644
--- a/lib/Command/Command/Add.php
+++ b/lib/Command/Command/Add.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
@@ -29,7 +30,6 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class Add extends Base {
-
use TRenderCommand;
/** @var CommandService */
@@ -115,6 +115,5 @@ class Add extends Base {
$output->writeln('');
$output->writeln("<comment>If you think your command makes sense for other users as well, feel free to share it in the following github issue:\n https://github.com/nextcloud/spreed/issues/1566</comment>");
-
}
}
diff --git a/lib/Command/Command/AddSamples.php b/lib/Command/Command/AddSamples.php
index 6e601ac37..bbbd06b7e 100644
--- a/lib/Command/Command/AddSamples.php
+++ b/lib/Command/Command/AddSamples.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
@@ -32,7 +33,6 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class AddSamples extends Base {
-
use TRenderCommand;
/** @var CommandService */
@@ -73,7 +73,7 @@ class AddSamples extends Base {
$chmod = fileperms($appPath . '/sample-commands/calc.sh');
if (!($chmod & 0x0040 || $chmod & 0x0008 || $chmod & 0x0001)) {
$output->writeln('<error>sample-commands/calc.sh is not executable</error>');
- } else if (!shell_exec('which bc')) {
+ } elseif (!shell_exec('which bc')) {
$output->writeln('<error>Can not add calculator command, because Basic calculator package (bc - https://www.gnu.org/software/bc/) is missing</error>');
} else {
$this->installCommand(
diff --git a/lib/Command/Command/Delete.php b/lib/Command/Command/Delete.php
index ecf549d65..d1ec44730 100644
--- a/lib/Command/Command/Delete.php
+++ b/lib/Command/Command/Delete.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
diff --git a/lib/Command/Command/ListCommand.php b/lib/Command/Command/ListCommand.php
index af45de3ac..4fe019538 100644
--- a/lib/Command/Command/ListCommand.php
+++ b/lib/Command/Command/ListCommand.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
@@ -29,7 +30,6 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class ListCommand extends Base {
-
use TRenderCommand;
/** @var CommandService */
diff --git a/lib/Command/Command/TRenderCommand.php b/lib/Command/Command/TRenderCommand.php
index b70c34ec3..99fa57be5 100644
--- a/lib/Command/Command/TRenderCommand.php
+++ b/lib/Command/Command/TRenderCommand.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
@@ -25,13 +26,11 @@ namespace OCA\Talk\Command\Command;
use OCA\Talk\Model\Command;
use OC\Core\Command\Base;
use Symfony\Component\Console\Helper\Table;
-use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
trait TRenderCommand {
-
protected function renderCommands(string $outputFormat, OutputInterface $output, array $commands, bool $showHelp = false): void {
- $result = array_map(function(Command $command) {
+ $result = array_map(function (Command $command) {
return $command->asArray();
}, $commands);
diff --git a/lib/Command/Command/Update.php b/lib/Command/Command/Update.php
index f0f807319..6dc12aaf4 100644
--- a/lib/Command/Command/Update.php
+++ b/lib/Command/Command/Update.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
@@ -30,7 +31,6 @@ use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class Update extends Base {
-
use TRenderCommand;
/** @var CommandService */
diff --git a/lib/Command/Room/Add.php b/lib/Command/Room/Add.php
index 3001127ea..f9d532d05 100644
--- a/lib/Command/Room/Add.php
+++ b/lib/Command/Room/Add.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2020 Daniel Rudolf <nextcloud.com@daniel-rudolf.de>
diff --git a/lib/Command/Room/Create.php b/lib/Command/Room/Create.php
index 26b197dff..ead258479 100644
--- a/lib/Command/Room/Create.php
+++ b/lib/Command/Room/Create.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2020 Daniel Rudolf <nextcloud.com@daniel-rudolf.de>
diff --git a/lib/Command/Room/Delete.php b/lib/Command/Room/Delete.php
index d065cc469..986ca67a4 100644
--- a/lib/Command/Room/Delete.php
+++ b/lib/Command/Room/Delete.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2020 Daniel Rudolf <nextcloud.com@daniel-rudolf.de>
diff --git a/lib/Command/Room/Demote.php b/lib/Command/Room/Demote.php
index a3a7bc625..a3b2ce69d 100644
--- a/lib/Command/Room/Demote.php
+++ b/lib/Command/Room/Demote.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2020 Daniel Rudolf <nextcloud.com@daniel-rudolf.de>
diff --git a/lib/Command/Room/Promote.php b/lib/Command/Room/Promote.php
index 08356cd62..4f4070dde 100644
--- a/lib/Command/Room/Promote.php
+++ b/lib/Command/Room/Promote.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2020 Daniel Rudolf <nextcloud.com@daniel-rudolf.de>
diff --git a/lib/Command/Room/Remove.php b/lib/Command/Room/Remove.php
index 1966e35d6..3bc0edadf 100644
--- a/lib/Command/Room/Remove.php
+++ b/lib/Command/Room/Remove.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2020 Daniel Rudolf <nextcloud.com@daniel-rudolf.de>
diff --git a/lib/Command/Room/TRoomCommand.php b/lib/Command/Room/TRoomCommand.php
index 0fb341ef5..ae12bbdeb 100644
--- a/lib/Command/Room/TRoomCommand.php
+++ b/lib/Command/Room/TRoomCommand.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2020 Daniel Rudolf <nextcloud.com@daniel-rudolf.de>
@@ -32,8 +33,7 @@ use OCA\Talk\Participant;
use OCA\Talk\Room;
use OCP\IUser;
-trait TRoomCommand
-{
+trait TRoomCommand {
/**
* @param Room $room
* @param string $name
diff --git a/lib/Command/Room/Update.php b/lib/Command/Room/Update.php
index 84d52bd92..b50e1c8d3 100644
--- a/lib/Command/Room/Update.php
+++ b/lib/Command/Room/Update.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2020 Daniel Rudolf <nextcloud.com@daniel-rudolf.de>
diff --git a/lib/Command/Signaling/Add.php b/lib/Command/Signaling/Add.php
index 2b421d030..735d45f13 100644
--- a/lib/Command/Signaling/Add.php
+++ b/lib/Command/Signaling/Add.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2018 Denis Mosolov <denismosolov@gmail.com>
diff --git a/lib/Command/Signaling/Delete.php b/lib/Command/Signaling/Delete.php
index 4404c5df9..4dc6aaa87 100644
--- a/lib/Command/Signaling/Delete.php
+++ b/lib/Command/Signaling/Delete.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2018 Denis Mosolov <denismosolov@gmail.com>
@@ -64,7 +65,7 @@ class Delete extends Base {
}
$count = count($signaling['servers']);
// remove all occurrences of $server
- $servers = array_filter($signaling['servers'], function($s) use ($server) {
+ $servers = array_filter($signaling['servers'], function ($s) use ($server) {
return $s['server'] !== $server;
});
$signaling['servers'] = array_values($servers); // reindex
diff --git a/lib/Command/Signaling/ListCommand.php b/lib/Command/Signaling/ListCommand.php
index 4ea7bd599..d0f3382f8 100644
--- a/lib/Command/Signaling/ListCommand.php
+++ b/lib/Command/Signaling/ListCommand.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2018 Denis Mosolov <denismosolov@gmail.com>
@@ -27,7 +28,6 @@ namespace OCA\Talk\Command\Signaling;
use OCP\IConfig;
use OC\Core\Command\Base;
use Symfony\Component\Console\Input\InputInterface;
-use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class ListCommand extends Base {
diff --git a/lib/Command/Stun/Add.php b/lib/Command/Stun/Add.php
index c12439fff..be6d9993a 100644
--- a/lib/Command/Stun/Add.php
+++ b/lib/Command/Stun/Add.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2018 Denis Mosolov <denismosolov@gmail.com>
diff --git a/lib/Command/Stun/Delete.php b/lib/Command/Stun/Delete.php
index 46f7aaf0a..2128dffba 100644
--- a/lib/Command/Stun/Delete.php
+++ b/lib/Command/Stun/Delete.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2018 Denis Mosolov <denismosolov@gmail.com>
@@ -61,7 +62,7 @@ class Delete extends Base {
}
$count = count($servers);
// remove all occurrences of $server
- $servers = array_filter($servers, function($s) use ($server) {
+ $servers = array_filter($servers, function ($s) use ($server) {
return $s !== $server;
});
$servers = array_values($servers); // reindex
diff --git a/lib/Command/Stun/ListCommand.php b/lib/Command/Stun/ListCommand.php
index ecd4e5b81..f5a8a2438 100644
--- a/lib/Command/Stun/ListCommand.php
+++ b/lib/Command/Stun/ListCommand.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2018 Denis Mosolov <denismosolov@gmail.com>
@@ -27,7 +28,6 @@ namespace OCA\Talk\Command\Stun;
use OCP\IConfig;
use OC\Core\Command\Base;
use Symfony\Component\Console\Input\InputInterface;
-use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class ListCommand extends Base {
diff --git a/lib/Command/Turn/Add.php b/lib/Command/Turn/Add.php
index fb993f900..83326fc0b 100644
--- a/lib/Command/Turn/Add.php
+++ b/lib/Command/Turn/Add.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2018 Denis Mosolov <denismosolov@gmail.com>
diff --git a/lib/Command/Turn/Delete.php b/lib/Command/Turn/Delete.php
index cb6d5bec4..2f09a2940 100644
--- a/lib/Command/Turn/Delete.php
+++ b/lib/Command/Turn/Delete.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2018 Denis Mosolov <denismosolov@gmail.com>
@@ -68,7 +69,7 @@ class Delete extends Base {
$count = count($servers);
// remove all occurrences which math $server and $protocols
- $servers = array_filter($servers, function($s) use ($server, $protocols) {
+ $servers = array_filter($servers, function ($s) use ($server, $protocols) {
return $s['server'] !== $server || $s['protocols'] !== $protocols;
});
$servers = array_values($servers); // reindex
diff --git a/lib/Command/Turn/ListCommand.php b/lib/Command/Turn/ListCommand.php
index fd26595d5..a9bf3633c 100644
--- a/lib/Command/Turn/ListCommand.php
+++ b/lib/Command/Turn/ListCommand.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2018 Denis Mosolov <denismosolov@gmail.com>
@@ -27,7 +28,6 @@ namespace OCA\Talk\Command\Turn;
use OCP\IConfig;
use OC\Core\Command\Base;
use Symfony\Component\Console\Input\InputInterface;
-use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
class ListCommand extends Base {
diff --git a/lib/Config.php b/lib/Config.php
index 0388e1028..3bef58717 100644
--- a/lib/Config.php
+++ b/lib/Config.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @author Joachim Bauch <mail@joachim-bauch.de>
@@ -29,9 +30,9 @@ use OCP\IUser;
use OCP\Security\ISecureRandom;
class Config {
-
public const SIGNALING_INTERNAL = 'internal';
public const SIGNALING_EXTERNAL = 'external';
+ public const SIGNALING_CLUSTER_CONVERSATION = 'conversation_cluster';
/** @var IConfig */
protected $config;
@@ -94,49 +95,6 @@ class Config {
return $this->config->getUserValue($userId, 'spreed', 'attachment_folder', '/Talk');
}
- public function getSettings(?string $userId): array {
- $stun = [];
- $stunServer = $this->getStunServer();
- if ($stunServer) {
- $stun[] = [
- 'url' => 'stun:' . $stunServer,
- ];
- }
- $turn = [];
- $turnSettings = $this->getTurnSettings();
- if (!empty($turnSettings['server'])) {
- $protocols = explode(',', $turnSettings['protocols']);
- foreach ($protocols as $proto) {
- $turn[] = [
- 'url' => ['turn:' . $turnSettings['server'] . '?transport=' . $proto],
- 'urls' => ['turn:' . $turnSettings['server'] . '?transport=' . $proto],
- 'username' => $turnSettings['username'],
- 'credential' => $turnSettings['password'],
- ];
- }
- }
-
- $signaling = [];
- $servers = $this->getSignalingServers();
- if (!empty($servers)) {
- try {
- $signaling = $servers[random_int(0, count($servers) - 1)];
- } catch (\Exception $e) {
- $signaling = $servers[0];
- }
- $signaling = $signaling['server'];
- }
-
- return [
- 'userId' => $userId,
- 'hideWarning' => !empty($signaling) || $this->getHideSignalingWarning(),
- 'server' => $signaling,
- 'ticket' => $this->getSignalingTicket($userId),
- 'stunservers' => $stun,
- 'turnservers' => $turn,
- ];
- }
-
/**
* @return string[]
*/
@@ -196,7 +154,7 @@ class Config {
}
if (!$this->config->getSystemValueBool('has_internet_connection', true)) {
- $servers = array_filter($servers, static function($server) {
+ $servers = array_filter($servers, static function ($server) {
return $server !== 'stun.nextcloud.com:443';
});
}
@@ -269,19 +227,36 @@ class Config {
$username = $timestamp . ':' . $rnd;
$password = base64_encode(hash_hmac('sha1', $username, $server['secret'], true));
- return array(
+ return [
'server' => $server['server'],
'username' => $username,
'password' => $password,
'protocols' => $server['protocols'],
- );
+ ];
}
public function getSignalingMode(): string {
- if (empty($this->getSignalingServers())) {
+ $validModes = [
+ self::SIGNALING_INTERNAL,
+ self::SIGNALING_EXTERNAL,
+ self::SIGNALING_CLUSTER_CONVERSATION,
+ ];
+
+ $mode = $this->config->getAppValue('spreed', 'signaling_mode', null);
+ if ($mode === self::SIGNALING_INTERNAL) {
return self::SIGNALING_INTERNAL;
}
- return self::SIGNALING_EXTERNAL;
+
+ $numSignalingServers = count($this->getSignalingServers());
+ if ($numSignalingServers === 0) {
+ return self::SIGNALING_INTERNAL;
+ }
+ if ($numSignalingServers === 1
+ && $this->config->getAppValue('spreed', 'signaling_dev', 'no') === 'no') {
+ return self::SIGNALING_EXTERNAL;
+ }
+
+ return \in_array($mode, $validModes, true) ? $mode : self::SIGNALING_EXTERNAL;
}
/**
@@ -374,5 +349,4 @@ class Config {
$hash = hash_hmac('sha256', $data, $secret);
return hash_equals($hash, substr($ticket, $lastColon + 1));
}
-
}
diff --git a/lib/ContactsMenu/Providers/CallProvider.php b/lib/ContactsMenu/Providers/CallProvider.php
index 569fa2bec..307923db2 100644
--- a/lib/ContactsMenu/Providers/CallProvider.php
+++ b/lib/ContactsMenu/Providers/CallProvider.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright 2017 Ivan Sein <ivan@nextcloud.com>
@@ -72,7 +73,7 @@ class CallProvider implements IProvider {
}
$user = $this->userManager->get($uid);
- if(!$user instanceof IUser) {
+ if (!$user instanceof IUser) {
// No valid user object
return;
}
@@ -88,5 +89,4 @@ class CallProvider implements IProvider {
$action = $this->actionFactory->newLinkAction($iconUrl, $talkAction, $callUrl);
$entry->addAction($action);
}
-
}
diff --git a/lib/Controller/AEnvironmentAwareController.php b/lib/Controller/AEnvironmentAwareController.php
index 7b03d32e7..ecb71b0ea 100644
--- a/lib/Controller/AEnvironmentAwareController.php
+++ b/lib/Controller/AEnvironmentAwareController.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch>
@@ -62,5 +63,4 @@ abstract class AEnvironmentAwareController extends OCSController {
public function getParticipant(): ?Participant {
return $this->participant;
}
-
}
diff --git a/lib/Controller/CallController.php b/lib/Controller/CallController.php
index 9a08f3cd1..2603922e5 100644
--- a/lib/Controller/CallController.php
+++ b/lib/Controller/CallController.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch>
@@ -116,5 +117,4 @@ class CallController extends AEnvironmentAwareController {
return new DataResponse();
}
-
}
diff --git a/lib/Controller/ChatController.php b/lib/Controller/ChatController.php
index d0bf74ee5..1f4afbe2b 100644
--- a/lib/Controller/ChatController.php
+++ b/lib/Controller/ChatController.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
*
@@ -128,7 +129,6 @@ class ChatController extends AEnvironmentAwareController {
* found".
*/
public function sendMessage(string $message, string $actorDisplayName = '', string $referenceId = '', int $replyTo = 0): DataResponse {
-
if ($this->userId === null) {
$actorType = 'guests';
$sessionId = $this->session->getSessionForRoom($this->room->getToken());
@@ -360,10 +360,10 @@ class ChatController extends AEnvironmentAwareController {
* So when you are still there, it will just have a wrong read
* marker for the time until your next request starts, while it will
* not update the value, when you actually left the chat already.
- if ($setReadMarker === 1 && $lookIntoFuture) {
- $this->participant->setLastReadMessage((int) $newLastKnown->getId());
- }
- */
+ * if ($setReadMarker === 1 && $lookIntoFuture) {
+ * $this->participant->setLastReadMessage((int) $newLastKnown->getId());
+ * }
+ */
}
return $response;
diff --git a/lib/Controller/CommandController.php b/lib/Controller/CommandController.php
index a64e2bc52..ab6696c59 100644
--- a/lib/Controller/CommandController.php
+++ b/lib/Controller/CommandController.php
@@ -52,7 +52,7 @@ class CommandController extends OCSController {
public function index(): DataResponse {
$commands = $this->commandService->findAll();
- $result = array_map(function(Command $command) {
+ $result = array_map(function (Command $command) {
return $command->asArray();
}, $commands);
diff --git a/lib/Controller/FilesIntegrationController.php b/lib/Controller/FilesIntegrationController.php
index acfbda5e5..1bd20f6de 100644
--- a/lib/Controller/FilesIntegrationController.php
+++ b/lib/Controller/FilesIntegrationController.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
*
@@ -263,5 +264,4 @@ class FilesIntegrationController extends OCSController {
$file = array_shift($fileById);
return $file->getName();
}
-
}
diff --git a/lib/Controller/GuestController.php b/lib/Controller/GuestController.php
index d98e4a7ef..468fb28b1 100644
--- a/lib/Controller/GuestController.php
+++ b/lib/Controller/GuestController.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
*
@@ -68,5 +69,4 @@ class GuestController extends AEnvironmentAwareController {
return new DataResponse();
}
-
}
diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php
index e13f3ff70..b75843c55 100644
--- a/lib/Controller/PageController.php
+++ b/lib/Controller/PageController.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch>
@@ -44,7 +45,7 @@ use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Http\Template\PublicTemplateResponse;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\IRootFolder;
-use OCP\Files\NotPermittedException;
+use OCP\ICacheFactory;
use OCP\IConfig;
use OCP\IInitialStateService;
use OCP\ILogger;
@@ -53,10 +54,8 @@ use OCP\IURLGenerator;
use OCP\IUser;
use OCP\IUserSession;
use OCP\Notification\IManager as INotificationManager;
-use OCP\Util;
class PageController extends Controller {
-
use TInitialState;
/** @var string|null */
@@ -95,6 +94,7 @@ class PageController extends Controller {
INotificationManager $notificationManager,
IAppManager $appManager,
IInitialStateService $initialStateService,
+ ICacheFactory $memcacheFactory,
IRootFolder $rootFolder,
Config $talkConfig,
IConfig $serverConfig) {
@@ -110,6 +110,7 @@ class PageController extends Controller {
$this->notificationManager = $notificationManager;
$this->appManager = $appManager;
$this->initialStateService = $initialStateService;
+ $this->memcacheFactory = $memcacheFactory;
$this->rootFolder = $rootFolder;
$this->talkConfig = $talkConfig;
$this->serverConfig = $serverConfig;
diff --git a/lib/Controller/PublicShareAuthController.php b/lib/Controller/PublicShareAuthController.php
index 9221c860a..ac89f226d 100644
--- a/lib/Controller/PublicShareAuthController.php
+++ b/lib/Controller/PublicShareAuthController.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
*
diff --git a/lib/Controller/RoomController.php b/lib/Controller/RoomController.php
index 6eee773a2..ccf2bcc5a 100644
--- a/lib/Controller/RoomController.php
+++ b/lib/Controller/RoomController.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch>
@@ -57,7 +58,6 @@ use OCP\IGroupManager;
use OCP\IConfig;
class RoomController extends AEnvironmentAwareController {
-
public const EVENT_BEFORE_ROOMS_GET = self::class . '::preGetRooms';
/** @var string|null */
@@ -277,7 +277,7 @@ class RoomController extends AEnvironmentAwareController {
if ($roomData['notificationLevel'] === Participant::NOTIFY_DEFAULT) {
if ($currentParticipant->isGuest()) {
$roomData['notificationLevel'] = Participant::NOTIFY_NEVER;
- } else if ($room->getType() === Room::ONE_TO_ONE_CALL) {
+ } elseif ($room->getType() === Room::ONE_TO_ONE_CALL) {
$roomData['notificationLevel'] = Participant::NOTIFY_ALWAYS;
} else {
$adminSetting = (int) $this->config->getAppValue('spreed', 'default_group_notification', Participant::NOTIFY_DEFAULT);
@@ -320,7 +320,7 @@ class RoomController extends AEnvironmentAwareController {
$cleanGuests = false;
$participantList = [];
$participants = $room->getParticipants();
- uasort($participants, function(Participant $participant1, Participant $participant2) {
+ uasort($participants, function (Participant $participant1, Participant $participant2) {
return $participant2->getLastPing() - $participant1->getLastPing();
});
@@ -448,7 +448,7 @@ class RoomController extends AEnvironmentAwareController {
if ($roomData['notificationLevel'] === Participant::NOTIFY_DEFAULT) {
if ($currentParticipant->isGuest()) {
$roomData['notificationLevel'] = Participant::NOTIFY_NEVER;
- } else if ($room->getType() === Room::ONE_TO_ONE_CALL) {
+ } elseif ($room->getType() === Room::ONE_TO_ONE_CALL) {
$roomData['notificationLevel'] = Participant::NOTIFY_ALWAYS;
} else {
$adminSetting = (int) $this->config->getAppValue('spreed', 'default_group_notification', Participant::NOTIFY_DEFAULT);
@@ -542,7 +542,6 @@ class RoomController extends AEnvironmentAwareController {
* @return DataResponse
*/
public function createRoom(int $roomType, string $invite = '', string $roomName = '', string $source = ''): DataResponse {
-
if ($roomType !== Room::ONE_TO_ONE_CALL) {
/** @var IUser $user */
$user = $this->userManager->get($this->userId);
@@ -780,7 +779,6 @@ class RoomController extends AEnvironmentAwareController {
* @return DataResponse
*/
public function setNotificationLevel(int $level): DataResponse {
-
if (!$this->participant->setNotificationLevel($level)) {
return new DataResponse([], Http::STATUS_BAD_REQUEST);
}
@@ -899,7 +897,7 @@ class RoomController extends AEnvironmentAwareController {
$this->room->addUsers([
'userId' => $newUser->getUID(),
]);
- } else if ($source === 'groups') {
+ } elseif ($source === 'groups') {
$group = $this->groupManager->get($newParticipant);
if (!$group instanceof IGroup) {
return new DataResponse([], Http::STATUS_NOT_FOUND);
@@ -921,7 +919,7 @@ class RoomController extends AEnvironmentAwareController {
}
\call_user_func_array([$this->room, 'addUsers'], $participantsToAdd);
- } else if ($source === 'circles') {
+ } elseif ($source === 'circles') {
if (!$this->appManager->isEnabledForUser('circles')) {
return new DataResponse([], Http::STATUS_BAD_REQUEST);
}
@@ -959,7 +957,7 @@ class RoomController extends AEnvironmentAwareController {
}
\call_user_func_array([$this->room, 'addUsers'], $participantsToAdd);
- } else if ($source === 'emails') {
+ } elseif ($source === 'emails') {
$data = [];
if ($this->room->setType(Room::PUBLIC_CALL)) {
$data = ['type' => $this->room->getType()];
@@ -1032,7 +1030,7 @@ class RoomController extends AEnvironmentAwareController {
&& $room->getNumberOfModerators() === 1) {
return new DataResponse([], Http::STATUS_BAD_REQUEST);
}
- } else if ($room->getType() !== Room::CHANGELOG_CONVERSATION &&
+ } elseif ($room->getType() !== Room::CHANGELOG_CONVERSATION &&
$room->getNumberOfParticipants() === 1) {
$room->deleteRoom();
return new DataResponse();
diff --git a/lib/Controller/SettingsController.php b/lib/Controller/SettingsController.php
index 8b96818dc..0b8a5d349 100644
--- a/lib/Controller/SettingsController.php
+++ b/lib/Controller/SettingsController.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2020 Joas Schilling <coding@schilljs.com>
diff --git a/lib/Controller/SignalingController.php b/lib/Controller/SignalingController.php
index b10eaed64..4070f7297 100644
--- a/lib/Controller/SignalingController.php
+++ b/lib/Controller/SignalingController.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch>
@@ -52,7 +53,9 @@ class SignalingController extends OCSController {
public const EVENT_BACKEND_SIGNALING_ROOMS = self::class . '::signalingBackendRoom';
/** @var Config */
- private $config;
+ private $talkConfig;
+ /** @var \OCA\Talk\Signaling\Manager */
+ private $signalingManager;
/** @var TalkSession */
private $session;
/** @var Manager */
@@ -74,7 +77,8 @@ class SignalingController extends OCSController {
public function __construct(string $appName,
IRequest $request,
- Config $config,
+ Config $talkConfig,
+ \OCA\Talk\Signaling\Manager $signalingManager,
TalkSession $session,
Manager $manager,
IDBConnection $connection,
@@ -85,7 +89,8 @@ class SignalingController extends OCSController {
IClientService $clientService,
?string $UserId) {
parent::__construct($appName, $request);
- $this->config = $config;
+ $this->talkConfig = $talkConfig;
+ $this->signalingManager = $signalingManager;
$this->session = $session;
$this->dbConnection = $connection;
$this->manager = $manager;
@@ -100,13 +105,55 @@ class SignalingController extends OCSController {
/**
* @PublicPage
*
- * Only available for logged in users because guests can not use the apps
- * right now.
- *
+ * @param string $token
* @return DataResponse
*/
- public function getSettings(): DataResponse {
- return new DataResponse($this->config->getSettings($this->userId));
+ public function getSettings(string $token = ''): DataResponse {
+ try {
+ if ($token !== '') {
+ $room = $this->manager->getRoomForParticipantByToken($token, $this->userId);
+ } else {
+ // FIXME Soft-fail for legacy support in mobile apps
+ $room = null;
+ }
+ } catch (RoomNotFoundException $e) {
+ return new DataResponse([], Http::STATUS_NOT_FOUND);
+ }
+
+ $stun = [];
+ $stunServer = $this->talkConfig->getStunServer();
+ if ($stunServer) {
+ $stun[] = [
+ 'url' => 'stun:' . $stunServer,
+ ];
+ }
+
+ $turn = [];
+ $turnSettings = $this->talkConfig->getTurnSettings();
+ if (!empty($turnSettings['server'])) {
+ $protocols = explode(',', $turnSettings['protocols']);
+ foreach ($protocols as $proto) {
+ $turn[] = [
+ 'url' => ['turn:' . $turnSettings['server'] . '?transport=' . $proto],
+ 'urls' => ['turn:' . $turnSettings['server'] . '?transport=' . $proto],
+ 'username' => $turnSettings['username'],
+ 'credential' => $turnSettings['password'],
+ ];
+ }
+ }
+
+ $signalingMode = $this->talkConfig->getSignalingMode();
+ $signaling = $this->signalingManager->getSignalingServerLinkForConversation($room);
+
+ return new DataResponse([
+ 'signalingMode' => $signalingMode,
+ 'userId' => $this->userId,
+ 'hideWarning' => $signaling !== '' || $this->talkConfig->getHideSignalingWarning(),
+ 'server' => $signaling,
+ 'ticket' => $this->talkConfig->getSignalingTicket($this->userId),
+ 'stunservers' => $stun,
+ 'turnservers' => $turn,
+ ]);
}
/**
@@ -117,7 +164,7 @@ class SignalingController extends OCSController {
* @return DataResponse
*/
public function getWelcomeMessage(int $serverId): DataResponse {
- $signalingServers = $this->config->getSignalingServers();
+ $signalingServers = $this->talkConfig->getSignalingServers();
if (empty($signalingServers) || !isset($signalingServers[$serverId])) {
return new DataResponse([], Http::STATUS_NOT_FOUND);
}
@@ -161,14 +208,13 @@ class SignalingController extends OCSController {
* @return DataResponse
*/
public function signaling(string $token, string $messages): DataResponse {
- $signaling = $this->config->getSignalingServers();
- if (!empty($signaling)) {
+ if ($this->talkConfig->getSignalingMode() !== Config::SIGNALING_INTERNAL) {
return new DataResponse('Internal signaling disabled.', Http::STATUS_BAD_REQUEST);
}
$response = [];
$messages = json_decode($messages, true);
- foreach($messages as $message) {
+ foreach ($messages as $message) {
$ev = $message['ev'];
switch ($ev) {
case 'message':
@@ -207,8 +253,7 @@ class SignalingController extends OCSController {
* @return DataResponse
*/
public function pullMessages(string $token): DataResponse {
- $signaling = $this->config->getSignalingServers();
- if (!empty($signaling)) {
+ if ($this->talkConfig->getSignalingMode() !== Config::SIGNALING_INTERNAL) {
return new DataResponse('Internal signaling disabled.', Http::STATUS_BAD_REQUEST);
}
@@ -234,7 +279,7 @@ class SignalingController extends OCSController {
// Query all messages and send them to the user
$data = $this->messages->getAndDeleteMessages($sessionId);
$messageCount = count($data);
- $data = array_filter($data, function($message) {
+ $data = array_filter($data, function ($message) {
return $message['data'] !== 'refresh-participant-list';
});
@@ -332,7 +377,7 @@ class SignalingController extends OCSController {
if (empty($checksum)) {
return false;
}
- $hash = hash_hmac('sha256', $random . $data, $this->config->getSignalingSecret());
+ $hash = hash_hmac('sha256', $random . $data, $this->talkConfig->getSignalingSecret());
return hash_equals($hash, strtolower($checksum));
}
@@ -394,7 +439,7 @@ class SignalingController extends OCSController {
private function backendAuth(array $auth): DataResponse {
$params = $auth['params'];
$userId = $params['userid'];
- if (!$this->config->validateSignalingTicket($userId, $params['ticket'])) {
+ if (!$this->talkConfig->validateSignalingTicket($userId, $params['ticket'])) {
return new DataResponse([
'type' => 'error',
'error' => [
@@ -478,10 +523,10 @@ class SignalingController extends OCSController {
if ($action === 'join') {
$room->ping($userId, $sessionId, $this->timeFactory->getTime());
- } else if ($action === 'leave') {
+ } elseif ($action === 'leave') {
if (!empty($userId)) {
$room->leaveRoom($userId, $sessionId);
- } else if ($participant instanceof Participant) {
+ } elseif ($participant instanceof Participant) {
$room->removeParticipantBySession($participant, Room::PARTICIPANT_LEFT);
}
}
@@ -542,5 +587,4 @@ class SignalingController extends OCSController {
];
return new DataResponse($response);
}
-
}
diff --git a/lib/Controller/WebinarController.php b/lib/Controller/WebinarController.php
index 75456da6c..c3ac6e5d5 100644
--- a/lib/Controller/WebinarController.php
+++ b/lib/Controller/WebinarController.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
diff --git a/lib/Events/AddEmailEvent.php b/lib/Events/AddEmailEvent.php
index 2e9f5d94b..88bcd0df4 100644
--- a/lib/Events/AddEmailEvent.php
+++ b/lib/Events/AddEmailEvent.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
@@ -22,7 +23,6 @@ declare(strict_types=1);
namespace OCA\Talk\Events;
-
use OCA\Talk\Room;
class AddEmailEvent extends RoomEvent {
diff --git a/lib/Events/AddParticipantsEvent.php b/lib/Events/AddParticipantsEvent.php
index 7c5b3cdcd..5d214bfb2 100644
--- a/lib/Events/AddParticipantsEvent.php
+++ b/lib/Events/AddParticipantsEvent.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
@@ -22,7 +23,6 @@ declare(strict_types=1);
namespace OCA\Talk\Events;
-
use OCA\Talk\Room;
class AddParticipantsEvent extends RoomEvent {
diff --git a/lib/Events/ChatEvent.php b/lib/Events/ChatEvent.php
index 44fc6615e..2a9e548e2 100644
--- a/lib/Events/ChatEvent.php
+++ b/lib/Events/ChatEvent.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
@@ -22,7 +23,6 @@ declare(strict_types=1);
namespace OCA\Talk\Events;
-
use OCA\Talk\Room;
use OCP\Comments\IComment;
diff --git a/lib/Events/ChatMessageEvent.php b/lib/Events/ChatMessageEvent.php
index 24fa9c518..aad88b4f0 100644
--- a/lib/Events/ChatMessageEvent.php
+++ b/lib/Events/ChatMessageEvent.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
@@ -22,7 +23,6 @@ declare(strict_types=1);
namespace OCA\Talk\Events;
-
use OCA\Talk\Model\Message;
class ChatMessageEvent extends ChatEvent {
diff --git a/lib/Events/ChatParticipantEvent.php b/lib/Events/ChatParticipantEvent.php
index dded42027..b18c38410 100644
--- a/lib/Events/ChatParticipantEvent.php
+++ b/lib/Events/ChatParticipantEvent.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
@@ -22,7 +23,6 @@ declare(strict_types=1);
namespace OCA\Talk\Events;
-
use OCA\Talk\Participant;
use OCA\Talk\Room;
use OCP\Comments\IComment;
diff --git a/lib/Events/CommandEvent.php b/lib/Events/CommandEvent.php
index 738362d47..7683dbd75 100644
--- a/lib/Events/CommandEvent.php
+++ b/lib/Events/CommandEvent.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
@@ -22,7 +23,6 @@ declare(strict_types=1);
namespace OCA\Talk\Events;
-
use OCA\Talk\Model\Command;
use OCA\Talk\Room;
use OCP\Comments\IComment;
diff --git a/lib/Events/CreateRoomTokenEvent.php b/lib/Events/CreateRoomTokenEvent.php
index 16ec78fba..b218789ae 100644
--- a/lib/Events/CreateRoomTokenEvent.php
+++ b/lib/Events/CreateRoomTokenEvent.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
@@ -22,8 +23,6 @@ declare(strict_types=1);
namespace OCA\Talk\Events;
-
-use OCA\Talk\Room;
use OCP\EventDispatcher\Event;
class CreateRoomTokenEvent extends Event {
diff --git a/lib/Events/JoinRoomGuestEvent.php b/lib/Events/JoinRoomGuestEvent.php
index 12fe728ff..f0fa8e0b0 100644
--- a/lib/Events/JoinRoomGuestEvent.php
+++ b/lib/Events/JoinRoomGuestEvent.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
@@ -22,7 +23,6 @@ declare(strict_types=1);
namespace OCA\Talk\Events;
-
use OCA\Talk\Room;
class JoinRoomGuestEvent extends RoomEvent {
@@ -63,5 +63,4 @@ class JoinRoomGuestEvent extends RoomEvent {
public function getPassedPasswordProtection(): bool {
return $this->passedPasswordProtection;
}
-
}
diff --git a/lib/Events/JoinRoomUserEvent.php b/lib/Events/JoinRoomUserEvent.php
index ea50d3f91..32995d19c 100644
--- a/lib/Events/JoinRoomUserEvent.php
+++ b/lib/Events/JoinRoomUserEvent.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
@@ -22,7 +23,6 @@ declare(strict_types=1);
namespace OCA\Talk\Events;
-
use OCA\Talk\Room;
use OCP\IUser;
@@ -72,5 +72,4 @@ class JoinRoomUserEvent extends RoomEvent {
public function getPassedPasswordProtection(): bool {
return $this->passedPasswordProtection;
}
-
}
diff --git a/lib/Events/ModifyLobbyEvent.php b/lib/Events/ModifyLobbyEvent.php
index 810109c3e..e4c3ef19d 100644
--- a/lib/Events/ModifyLobbyEvent.php
+++ b/lib/Events/ModifyLobbyEvent.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
@@ -22,9 +23,7 @@ declare(strict_types=1);
namespace OCA\Talk\Events;
-
use OCA\Talk\Room;
-use OCP\EventDispatcher\Event;
class ModifyLobbyEvent extends ModifyRoomEvent {
diff --git a/lib/Events/ModifyParticipantEvent.php b/lib/Events/ModifyParticipantEvent.php
index 73717866b..777e78ffe 100644
--- a/lib/Events/ModifyParticipantEvent.php
+++ b/lib/Events/ModifyParticipantEvent.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
@@ -22,7 +23,6 @@ declare(strict_types=1);
namespace OCA\Talk\Events;
-
use OCA\Talk\Participant;
use OCA\Talk\Room;
diff --git a/lib/Events/ModifyRoomEvent.php b/lib/Events/ModifyRoomEvent.php
index b3de5c41b..7925fdb56 100644
--- a/lib/Events/ModifyRoomEvent.php
+++ b/lib/Events/ModifyRoomEvent.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
@@ -22,7 +23,6 @@ declare(strict_types=1);
namespace OCA\Talk\Events;
-
use OCA\Talk\Room;
class ModifyRoomEvent extends RoomEvent {
diff --git a/lib/Events/ParticipantEvent.php b/lib/Events/ParticipantEvent.php
index 897199a88..e72c8fdb5 100644
--- a/lib/Events/ParticipantEvent.php
+++ b/lib/Events/ParticipantEvent.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
@@ -22,7 +23,6 @@ declare(strict_types=1);
namespace OCA\Talk\Events;
-
use OCA\Talk\Participant;
use OCA\Talk\Room;
diff --git a/lib/Events/RemoveParticipantEvent.php b/lib/Events/RemoveParticipantEvent.php
index ae0b1583e..09878a699 100644
--- a/lib/Events/RemoveParticipantEvent.php
+++ b/lib/Events/RemoveParticipantEvent.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
@@ -22,7 +23,6 @@ declare(strict_types=1);
namespace OCA\Talk\Events;
-
use OCA\Talk\Participant;
use OCA\Talk\Room;
diff --git a/lib/Events/RemoveUserEvent.php b/lib/Events/RemoveUserEvent.php
index e1af64133..fae652d76 100644
--- a/lib/Events/RemoveUserEvent.php
+++ b/lib/Events/RemoveUserEvent.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
@@ -22,7 +23,6 @@ declare(strict_types=1);
namespace OCA\Talk\Events;
-
use OCA\Talk\Participant;
use OCA\Talk\Room;
use OCP\IUser;
diff --git a/lib/Events/RoomEvent.php b/lib/Events/RoomEvent.php
index 961325bbf..4c2bec9e9 100644
--- a/lib/Events/RoomEvent.php
+++ b/lib/Events/RoomEvent.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
@@ -22,7 +23,6 @@ declare(strict_types=1);
namespace OCA\Talk\Events;
-
use OCA\Talk\Room;
use OCP\EventDispatcher\Event;
diff --git a/lib/Events/SignalingEvent.php b/lib/Events/SignalingEvent.php
index 615169ae1..aa25a91c7 100644
--- a/lib/Events/SignalingEvent.php
+++ b/lib/Events/SignalingEvent.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
@@ -22,7 +23,6 @@ declare(strict_types=1);
namespace OCA\Talk\Events;
-
use OCA\Talk\Participant;
use OCA\Talk\Room;
diff --git a/lib/Events/SignalingRoomPropertiesEvent.php b/lib/Events/SignalingRoomPropertiesEvent.php
index e689be3f5..1be058990 100644
--- a/lib/Events/SignalingRoomPropertiesEvent.php
+++ b/lib/Events/SignalingRoomPropertiesEvent.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
@@ -22,7 +23,6 @@ declare(strict_types=1);
namespace OCA\Talk\Events;
-
use OCA\Talk\Room;
class SignalingRoomPropertiesEvent extends RoomEvent {
diff --git a/lib/Events/UserEvent.php b/lib/Events/UserEvent.php
index 3ebcedd05..6fd00144b 100644
--- a/lib/Events/UserEvent.php
+++ b/lib/Events/UserEvent.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
@@ -22,7 +23,6 @@ declare(strict_types=1);
namespace OCA\Talk\Events;
-
use OCP\EventDispatcher\Event;
class UserEvent extends Event {
diff --git a/lib/Events/VerifyRoomPasswordEvent.php b/lib/Events/VerifyRoomPasswordEvent.php
index d7d2b6d13..f19946048 100644
--- a/lib/Events/VerifyRoomPasswordEvent.php
+++ b/lib/Events/VerifyRoomPasswordEvent.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
@@ -22,7 +23,6 @@ declare(strict_types=1);
namespace OCA\Talk\Events;
-
use OCA\Talk\Room;
class VerifyRoomPasswordEvent extends RoomEvent {
diff --git a/lib/Exceptions/ForbiddenException.php b/lib/Exceptions/ForbiddenException.php
index 2713f2354..09fd2bb99 100644
--- a/lib/Exceptions/ForbiddenException.php
+++ b/lib/Exceptions/ForbiddenException.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2017 Joas Schilling <coding@schilljs.com>
@@ -24,5 +25,4 @@ declare(strict_types=1);
namespace OCA\Talk\Exceptions;
class ForbiddenException extends \Exception {
-
}
diff --git a/lib/Exceptions/InvalidPasswordException.php b/lib/Exceptions/InvalidPasswordException.php
index 8ef68d89f..008134f12 100644
--- a/lib/Exceptions/InvalidPasswordException.php
+++ b/lib/Exceptions/InvalidPasswordException.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2017 Joas Schilling <coding@schilljs.com>
@@ -24,5 +25,4 @@ declare(strict_types=1);
namespace OCA\Talk\Exceptions;
class InvalidPasswordException extends \Exception {
-
}
diff --git a/lib/Exceptions/ParticipantNotFoundException.php b/lib/Exceptions/ParticipantNotFoundException.php
index 52a5eb3c1..d3a7b1988 100644
--- a/lib/Exceptions/ParticipantNotFoundException.php
+++ b/lib/Exceptions/ParticipantNotFoundException.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2017 Joas Schilling <coding@schilljs.com>
@@ -24,5 +25,4 @@ declare(strict_types=1);
namespace OCA\Talk\Exceptions;
class ParticipantNotFoundException extends \OutOfBoundsException {
-
}
diff --git a/lib/Exceptions/RoomNotFoundException.php b/lib/Exceptions/RoomNotFoundException.php
index fd584a186..df4230764 100644
--- a/lib/Exceptions/RoomNotFoundException.php
+++ b/lib/Exceptions/RoomNotFoundException.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch>
@@ -24,5 +25,4 @@ declare(strict_types=1);
namespace OCA\Talk\Exceptions;
class RoomNotFoundException extends \OutOfBoundsException {
-
}
diff --git a/lib/Exceptions/UnauthorizedException.php b/lib/Exceptions/UnauthorizedException.php
index e1123592d..f8ca2f70b 100644
--- a/lib/Exceptions/UnauthorizedException.php
+++ b/lib/Exceptions/UnauthorizedException.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2017 Joas Schilling <coding@schilljs.com>
@@ -24,5 +25,4 @@ declare(strict_types=1);
namespace OCA\Talk\Exceptions;
class UnauthorizedException extends \Exception {
-
}
diff --git a/lib/Files/Listener.php b/lib/Files/Listener.php
index d7cb4e8db..bcec71a98 100644
--- a/lib/Files/Listener.php
+++ b/lib/Files/Listener.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
*
@@ -61,7 +62,7 @@ class Listener {
}
public static function register(IEventDispatcher $dispatcher): void {
- $listener = static function(JoinRoomUserEvent $event) {
+ $listener = static function (JoinRoomUserEvent $event) {
/** @var self $listener */
$listener = \OC::$server->query(self::class);
@@ -74,14 +75,14 @@ class Listener {
};
$dispatcher->addListener(Room::EVENT_BEFORE_ROOM_CONNECT, $listener);
- $listener = static function(JoinRoomGuestEvent $event) {
+ $listener = static function (JoinRoomGuestEvent $event) {
/** @var self $listener */
$listener = \OC::$server->query(self::class);
try {
$listener->preventGuestsFromJoiningIfNotPubliclyAccessible($event->getRoom());
} catch (UnauthorizedException $e) {
- $event->setCancelJoin( true);
+ $event->setCancelJoin(true);
}
};
$dispatcher->addListener(Room::EVENT_BEFORE_GUEST_CONNECT, $listener);
@@ -171,5 +172,4 @@ class Listener {
throw new UnauthorizedException('Guests are not allowed in this room');
}
-
}
diff --git a/lib/Files/TemplateLoader.php b/lib/Files/TemplateLoader.php
index 7bc38b472..99d63f8c4 100644
--- a/lib/Files/TemplateLoader.php
+++ b/lib/Files/TemplateLoader.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
*
@@ -32,6 +33,7 @@ use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\EventDispatcher\IEventListener;
use OCP\Files\IRootFolder;
+use OCP\ICacheFactory;
use OCP\IConfig;
use OCP\IInitialStateService;
use OCP\IUser;
@@ -42,7 +44,6 @@ use OCP\Util;
* Helper class to add the Talk UI to the sidebar of the Files app.
*/
class TemplateLoader implements IEventListener {
-
use TInitialState;
/** @var IAppManager */
@@ -53,12 +54,14 @@ class TemplateLoader implements IEventListener {
private $userSession;
public function __construct(IInitialStateService $initialStateService,
+ ICacheFactory $memcacheFactory,
Config $talkConfig,
IConfig $serverConfig,
IAppManager $appManager,
IRootFolder $rootFolder,
IUserSession $userSession) {
$this->initialStateService = $initialStateService;
+ $this->memcacheFactory = $memcacheFactory;
$this->talkConfig = $talkConfig;
$this->serverConfig = $serverConfig;
$this->appManager = $appManager;
@@ -99,5 +102,4 @@ class TemplateLoader implements IEventListener {
$this->publishInitialStateForGuest();
}
}
-
}
diff --git a/lib/Files/Util.php b/lib/Files/Util.php
index 3789ca37e..1c3fe9a74 100644
--- a/lib/Files/Util.php
+++ b/lib/Files/Util.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
*
@@ -116,7 +117,7 @@ class Util {
return null;
}
- $nodes = array_filter($nodes, function($node) {
+ $nodes = array_filter($nodes, function ($node) {
return $node->getType() === FileInfo::TYPE_FILE;
});
@@ -244,7 +245,7 @@ class Util {
return null;
}
- $nodes = array_filter($nodes, function(Node $node) {
+ $nodes = array_filter($nodes, function (Node $node) {
return $node->getType() === FileInfo::TYPE_FILE;
});
if (empty($nodes)) {
@@ -263,5 +264,4 @@ class Util {
return null;
}
-
}
diff --git a/lib/Flow/Operation.php b/lib/Flow/Operation.php
index ae7ec8cd8..0c97e1669 100644
--- a/lib/Flow/Operation.php
+++ b/lib/Flow/Operation.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019 Arthur Schiwon <blizzz@arthur-schiwon.de>
@@ -127,7 +128,7 @@ class Operation implements IOperation {
$entity = $ruleMatcher->getEntity();
$message = $this->prepareText($entity, $eventName);
- if($message === '') {
+ if ($message === '') {
continue;
}
@@ -154,10 +155,10 @@ class Operation implements IOperation {
protected function prepareText(IEntity $entity, string $eventName) {
$message = $eventName;
- if($entity instanceof IDisplayText) {
+ if ($entity instanceof IDisplayText) {
$message = trim($entity->getDisplayText(3));
}
- if($entity instanceof IUrl && $message !== '') {
+ if ($entity instanceof IUrl && $message !== '') {
$message .= ' ' . $entity->getUrl();
}
return $message;
@@ -190,7 +191,7 @@ class Operation implements IOperation {
*/
$opConfig = \json_decode($raw, true);
- if(!is_array($opConfig) || empty($opConfig)) {
+ if (!is_array($opConfig) || empty($opConfig)) {
throw new UnexpectedValueException('Cannot decode operation details');
}
@@ -201,11 +202,11 @@ class Operation implements IOperation {
}
protected function validateOperationConfig(int $mode, string $token, string $uid): void {
- if(!in_array($mode, self::MESSAGE_MODES)) {
+ if (!in_array($mode, self::MESSAGE_MODES)) {
throw new UnexpectedValueException('Invalid mode');
}
- if(empty($token)) {
+ if (empty($token)) {
throw new UnexpectedValueException('Invalid token');
}
@@ -215,7 +216,7 @@ class Operation implements IOperation {
throw new UnexpectedValueException('Room not found', $e->getCode(), $e);
}
- if($mode === self::MESSAGE_MODES['ROOM_MENTION']) {
+ if ($mode === self::MESSAGE_MODES['ROOM_MENTION']) {
try {
$participant = $this->getParticipant($uid, $room);
if (!$participant->hasModeratorPermissions(false)) {
@@ -232,7 +233,7 @@ class Operation implements IOperation {
*/
protected function getUser(): IUser {
$user = $this->session->getUser();
- if($user === null) {
+ if ($user === null) {
throw new UnexpectedValueException('User not logged in');
}
return $user;
diff --git a/lib/GuestManager.php b/lib/GuestManager.php
index e26ddaee8..2408ae27d 100644
--- a/lib/GuestManager.php
+++ b/lib/GuestManager.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2018 Joas Schilling <coding@schilljs.com>
@@ -22,7 +23,6 @@ declare(strict_types=1);
namespace OCA\Talk;
-
use OCA\Talk\Events\AddEmailEvent;
use OCA\Talk\Events\ModifyParticipantEvent;
use OCA\Talk\Exceptions\ParticipantNotFoundException;
@@ -38,7 +38,6 @@ use OCP\Mail\IMailer;
use OCP\Util;
class GuestManager {
-
public const EVENT_BEFORE_EMAIL_INVITE = self::class . '::preInviteByEmail';
public const EVENT_AFTER_EMAIL_INVITE = self::class . '::postInviteByEmail';
public const EVENT_AFTER_NAME_UPDATE = self::class . '::updateName';
diff --git a/lib/Listener.php b/lib/Listener.php
index 047e55c99..c4235d945 100644
--- a/lib/Listener.php
+++ b/lib/Listener.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @author Joachim Bauch <mail@joachim-bauch.de>
@@ -22,8 +23,6 @@ declare(strict_types=1);
namespace OCA\Talk;
-use OCP\Collaboration\AutoComplete\AutoCompleteEvent;
-use OCP\Collaboration\AutoComplete\IManager;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\IUser;
use OCP\IUserManager;
diff --git a/lib/Listener/CSPListener.php b/lib/Listener/CSPListener.php
index a3ce99946..491a0d6fe 100644
--- a/lib/Listener/CSPListener.php
+++ b/lib/Listener/CSPListener.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019, Roeland Jago Douma <roeland@famdouma.nl>
@@ -51,5 +52,4 @@ class CSPListener implements IEventListener {
$event->addPolicy($csp);
}
-
}
diff --git a/lib/Listener/FeaturePolicyListener.php b/lib/Listener/FeaturePolicyListener.php
index f80d6f1be..efae3de96 100644
--- a/lib/Listener/FeaturePolicyListener.php
+++ b/lib/Listener/FeaturePolicyListener.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019, Roeland Jago Douma <roeland@famdouma.nl>
@@ -30,7 +31,6 @@ use OCP\EventDispatcher\IEventListener;
use OCP\Security\FeaturePolicy\AddFeaturePolicyEvent;
class FeaturePolicyListener implements IEventListener {
-
public function handle(Event $event): void {
if (!($event instanceof AddFeaturePolicyEvent)) {
return;
@@ -41,5 +41,4 @@ class FeaturePolicyListener implements IEventListener {
$policy->addAllowedMicrophoneDomain('\'self\'');
$event->addPolicy($policy);
}
-
}
diff --git a/lib/Listener/RestrictStartingCalls.php b/lib/Listener/RestrictStartingCalls.php
index f77ff3f4c..623e96538 100644
--- a/lib/Listener/RestrictStartingCalls.php
+++ b/lib/Listener/RestrictStartingCalls.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
@@ -22,7 +23,6 @@ declare(strict_types=1);
namespace OCA\Talk\Listener;
-
use OCA\Talk\Events\ModifyParticipantEvent;
use OCA\Talk\Exceptions\ForbiddenException;
use OCA\Talk\Room;
@@ -39,7 +39,7 @@ class RestrictStartingCalls {
}
public static function register(IEventDispatcher $dispatcher): void {
- $dispatcher->addListener(Room::EVENT_BEFORE_SESSION_JOIN_CALL, static function(ModifyParticipantEvent $event) {
+ $dispatcher->addListener(Room::EVENT_BEFORE_SESSION_JOIN_CALL, static function (ModifyParticipantEvent $event) {
/** @var self $listener */
$listener = \OC::$server->query(self::class);
$listener->checkStartCallPermissions($event);
diff --git a/lib/Manager.php b/lib/Manager.php
index 159f4db9f..aa539299b 100644
--- a/lib/Manager.php
+++ b/lib/Manager.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2016 Joas Schilling <coding@schilljs.com>
@@ -22,7 +23,6 @@ declare(strict_types=1);
namespace OCA\Talk;
-
use OCA\Talk\Chat\Changelog;
use OCA\Talk\Chat\CommentsManager;
use OCA\Talk\Events\CreateRoomTokenEvent;
@@ -34,6 +34,7 @@ use OCP\Comments\IComment;
use OCP\Comments\NotFoundException;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\EventDispatcher\IEventDispatcher;
+use OCP\ICache;
use OCP\IConfig;
use OCP\IDBConnection;
use OCP\IL10N;
@@ -43,7 +44,6 @@ use OCP\Security\IHasher;
use OCP\Security\ISecureRandom;
class Manager {
-
public const EVENT_TOKEN_GENERATE = self::class . '::generateNewToken';
/** @var IDBConnection */
@@ -140,6 +140,11 @@ class Manager {
]));
}
+ $assignedSignalingServer = $row['assigned_hpb'];
+ if ($assignedSignalingServer !== null) {
+ $assignedSignalingServer = (int) $assignedSignalingServer;
+ }
+
return new Room(
$this,
$this->db,
@@ -151,6 +156,7 @@ class Manager {
(int) $row['type'],
(int) $row['read_only'],
(int) $row['lobby_state'],
+ $assignedSignalingServer,
(string) $row['token'],
(string) $row['name'],
(string) $row['password'],
@@ -201,6 +207,23 @@ class Manager {
}
}
+ public function resetAssignedSignalingServers(ICache $cache): void {
+ $query = $this->db->getQueryBuilder();
+ $query->select('*')
+ ->from('talk_rooms')
+ ->where($query->expr()->isNotNull('assigned_hpb'));
+
+ $result = $query->execute();
+ while ($row = $result->fetch()) {
+ $room = $this->createRoomObject($row);
+ if (!$room->hasActiveSessions()) {
+ $room->setAssignedSignalingServer(null);
+ $cache->remove($room->getToken());
+ }
+ }
+ $result->closeCursor();
+ }
+
/**
* @param string $participant
* @param bool $includeLastMessage
@@ -251,7 +274,7 @@ class Manager {
$query = $this->db->getQueryBuilder();
$query->select('*')
->from('talk_rooms', 'r')
- ->where($query->expr()->eq('id', $query->createNamedParameter($roomId, IQueryBuilder::PARAM_INT)));
+ ->where($query->expr()->eq('r.id', $query->createNamedParameter($roomId, IQueryBuilder::PARAM_INT)));
if ($participant !== null) {
// Non guest user
@@ -802,7 +825,6 @@ class Manager {
* @throws \OutOfBoundsException
*/
protected function generateNewToken(IQueryBuilder $query, int $entropy, string $chars): string {
-
$event = new CreateRoomTokenEvent($entropy, $chars);
$this->dispatcher->dispatch(self::EVENT_TOKEN_GENERATE, $event);
try {
diff --git a/lib/Middleware/CanUseTalkMiddleware.php b/lib/Middleware/CanUseTalkMiddleware.php
index 791c17cbb..4f420f88b 100644
--- a/lib/Middleware/CanUseTalkMiddleware.php
+++ b/lib/Middleware/CanUseTalkMiddleware.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
diff --git a/lib/Middleware/Exceptions/CanNotUseTalkException.php b/lib/Middleware/Exceptions/CanNotUseTalkException.php
index 9d9266c98..bc84baac3 100644
--- a/lib/Middleware/Exceptions/CanNotUseTalkException.php
+++ b/lib/Middleware/Exceptions/CanNotUseTalkException.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
diff --git a/lib/Middleware/Exceptions/LobbyException.php b/lib/Middleware/Exceptions/LobbyException.php
index 990efbe93..5aa81b8f8 100644
--- a/lib/Middleware/Exceptions/LobbyException.php
+++ b/lib/Middleware/Exceptions/LobbyException.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
diff --git a/lib/Middleware/Exceptions/NotAModeratorException.php b/lib/Middleware/Exceptions/NotAModeratorException.php
index 8abda311d..88c0f9bbc 100644
--- a/lib/Middleware/Exceptions/NotAModeratorException.php
+++ b/lib/Middleware/Exceptions/NotAModeratorException.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
diff --git a/lib/Middleware/Exceptions/ReadOnlyException.php b/lib/Middleware/Exceptions/ReadOnlyException.php
index ac4f082bb..1c3627ebb 100644
--- a/lib/Middleware/Exceptions/ReadOnlyException.php
+++ b/lib/Middleware/Exceptions/ReadOnlyException.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
diff --git a/lib/Middleware/InjectionMiddleware.php b/lib/Middleware/InjectionMiddleware.php
index 15c6f67ec..9b7e89427 100644
--- a/lib/Middleware/InjectionMiddleware.php
+++ b/lib/Middleware/InjectionMiddleware.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
diff --git a/lib/Migration/ClearResourceAccessCache.php b/lib/Migration/ClearResourceAccessCache.php
index 792c5a53c..03ce1db2a 100644
--- a/lib/Migration/ClearResourceAccessCache.php
+++ b/lib/Migration/ClearResourceAccessCache.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019, Joas Schilling <coding@schilljs.com>
@@ -31,7 +32,6 @@ use OCP\Migration\IOutput;
use OCP\Migration\IRepairStep;
class ClearResourceAccessCache implements IRepairStep {
-
protected const INVALIDATIONS = 1;
/** @var IConfig */
diff --git a/lib/Migration/FixNamespaceInDatabaseTables.php b/lib/Migration/FixNamespaceInDatabaseTables.php
index 4d217a2af..4d098015c 100644
--- a/lib/Migration/FixNamespaceInDatabaseTables.php
+++ b/lib/Migration/FixNamespaceInDatabaseTables.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
@@ -22,7 +23,6 @@ declare(strict_types=1);
namespace OCA\Talk\Migration;
-
use OCP\IDBConnection;
use OCP\Migration\IOutput;
use OCP\Migration\IRepairStep;
diff --git a/lib/Migration/Version2000Date20170707093535.php b/lib/Migration/Version2000Date20170707093535.php
index b235c5e23..cbbd0031c 100644
--- a/lib/Migration/Version2000Date20170707093535.php
+++ b/lib/Migration/Version2000Date20170707093535.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2017 Joas Schilling <coding@schilljs.com>
@@ -123,5 +124,4 @@ class Version2000Date20170707093535 extends SimpleMigrationStep {
return $schema;
}
-
}
diff --git a/lib/Migration/Version2000Date20171026140256.php b/lib/Migration/Version2000Date20171026140256.php
index 3bb642da3..5f8b61efa 100644
--- a/lib/Migration/Version2000Date20171026140256.php
+++ b/lib/Migration/Version2000Date20171026140256.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2017 Joas Schilling <coding@schilljs.com>
@@ -56,7 +57,6 @@ class Version2000Date20171026140256 extends SimpleMigrationStep {
* @since 13.0.0
*/
public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options): void {
-
if (version_compare($this->config->getAppValue('spreed', 'installed_version', '0.0.0'), '2.0.0', '<')) {
// Migrations only work after 2.0.0
return;
@@ -84,6 +84,5 @@ class Version2000Date20171026140256 extends SimpleMigrationStep {
->execute();
}
$output->finishProgress();
-
}
}
diff --git a/lib/Migration/Version2000Date20171026140257.php b/lib/Migration/Version2000Date20171026140257.php
index fb22b242f..ff74b1d5a 100644
--- a/lib/Migration/Version2000Date20171026140257.php
+++ b/lib/Migration/Version2000Date20171026140257.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2017 Joas Schilling <coding@schilljs.com>
@@ -60,7 +61,6 @@ class Version2000Date20171026140257 extends SimpleMigrationStep {
* @since 13.0.0
*/
public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options): void {
-
if (version_compare($this->config->getAppValue('spreed', 'installed_version', '0.0.0'), '2.0.0', '<')) {
// Migrations only work after 2.0.0
return;
@@ -92,7 +92,6 @@ class Version2000Date20171026140257 extends SimpleMigrationStep {
->execute();
}
$output->finishProgress();
-
}
/**
diff --git a/lib/Migration/Version2001Date20170707115443.php b/lib/Migration/Version2001Date20170707115443.php
index c0875a32a..f932133be 100644
--- a/lib/Migration/Version2001Date20170707115443.php
+++ b/lib/Migration/Version2001Date20170707115443.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2017 Joas Schilling <coding@schilljs.com>
@@ -78,7 +79,6 @@ class Version2001Date20170707115443 extends SimpleMigrationStep {
* @since 13.0.0
*/
public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options): void {
-
if (version_compare($this->config->getAppValue('spreed', 'installed_version', '0.0.0'), '2.0.0', '<')) {
// Migrations only work after 2.0.0
return;
diff --git a/lib/Migration/Version2001Date20170913104501.php b/lib/Migration/Version2001Date20170913104501.php
index 226bcd163..dd85e30e0 100644
--- a/lib/Migration/Version2001Date20170913104501.php
+++ b/lib/Migration/Version2001Date20170913104501.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2017 Joas Schilling <coding@schilljs.com>
@@ -69,5 +70,4 @@ class Version2001Date20170913104501 extends SimpleMigrationStep {
return $schema;
}
-
}
diff --git a/lib/Migration/Version2001Date20170921145301.php b/lib/Migration/Version2001Date20170921145301.php
index 718be15cb..f366a6040 100644
--- a/lib/Migration/Version2001Date20170921145301.php
+++ b/lib/Migration/Version2001Date20170921145301.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2017 Joas Schilling <coding@schilljs.com>
@@ -50,5 +51,4 @@ class Version2001Date20170921145301 extends SimpleMigrationStep {
return $schema;
}
-
}
diff --git a/lib/Migration/Version2001Date20170929092606.php b/lib/Migration/Version2001Date20170929092606.php
index 048743909..0e8618299 100644
--- a/lib/Migration/Version2001Date20170929092606.php
+++ b/lib/Migration/Version2001Date20170929092606.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2017 Joas Schilling <coding@schilljs.com>
diff --git a/lib/Migration/Version2001Date20171009132424.php b/lib/Migration/Version2001Date20171009132424.php
index a4b5b4ade..d1f6e7257 100644
--- a/lib/Migration/Version2001Date20171009132424.php
+++ b/lib/Migration/Version2001Date20171009132424.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2017 Joas Schilling <coding@schilljs.com>
@@ -54,5 +55,4 @@ class Version2001Date20171009132424 extends SimpleMigrationStep {
return $schema;
}
-
}
diff --git a/lib/Migration/Version2001Date20171026134605.php b/lib/Migration/Version2001Date20171026134605.php
index e4a7cfda0..bd40b396d 100644
--- a/lib/Migration/Version2001Date20171026134605.php
+++ b/lib/Migration/Version2001Date20171026134605.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2017 Joas Schilling <coding@schilljs.com>
@@ -158,7 +159,6 @@ class Version2001Date20171026134605 extends SimpleMigrationStep {
* @since 13.0.0
*/
public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options): void {
-
if (version_compare($this->config->getAppValue('spreed', 'installed_version', '0.0.0'), '2.0.0', '<')) {
// Migrations only work after 2.0.0
return;
@@ -210,7 +210,6 @@ class Version2001Date20171026134605 extends SimpleMigrationStep {
* @param int[] $roomIdMap
*/
protected function copyParticipants(array $roomIdMap): void {
-
$insert = $this->connection->getQueryBuilder();
if (!$this->connection->getDatabasePlatform() instanceof PostgreSqlPlatform) {
$insert->insert('talk_participants')
@@ -256,14 +255,12 @@ class Version2001Date20171026134605 extends SimpleMigrationStep {
$insert->execute();
}
$result->closeCursor();
-
}
/**
* @param int[] $roomIdMap
*/
protected function fixNotifications(array $roomIdMap): void {
-
$update = $this->connection->getQueryBuilder();
$update->update('notifications')
->set('object_id', $update->createParameter('newId'))
@@ -301,14 +298,12 @@ class Version2001Date20171026134605 extends SimpleMigrationStep {
$update->execute();
}
$result->closeCursor();
-
}
/**
* @param int[] $roomIdMap
*/
protected function fixActivities(array $roomIdMap): void {
-
$update = $this->connection->getQueryBuilder();
$update->update('activity')
->set('object_id', $update->createParameter('newId'))
@@ -363,14 +358,12 @@ class Version2001Date20171026134605 extends SimpleMigrationStep {
$update->execute();
}
$result->closeCursor();
-
}
/**
* @param int[] $roomIdMap
*/
protected function fixActivityMails(array $roomIdMap): void {
-
$update = $this->connection->getQueryBuilder();
$update->update('activity_mq')
->set('amq_subjectparams', $update->createParameter('subjectParams'))
diff --git a/lib/Migration/Version2001Date20171026141336.php b/lib/Migration/Version2001Date20171026141336.php
index edb9f2b3c..0ffebe0f9 100644
--- a/lib/Migration/Version2001Date20171026141336.php
+++ b/lib/Migration/Version2001Date20171026141336.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2017 Joas Schilling <coding@schilljs.com>
diff --git a/lib/Migration/Version2001Date20171031102049.php b/lib/Migration/Version2001Date20171031102049.php
index 1d06d1c2b..067ff2826 100644
--- a/lib/Migration/Version2001Date20171031102049.php
+++ b/lib/Migration/Version2001Date20171031102049.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2017 Joas Schilling <coding@schilljs.com>
@@ -49,5 +50,4 @@ class Version2001Date20171031102049 extends SimpleMigrationStep {
return $schema;
}
-
}
diff --git a/lib/Migration/Version2001Date20180103144447.php b/lib/Migration/Version2001Date20180103144447.php
index 77ad48d39..0af9e898b 100644
--- a/lib/Migration/Version2001Date20180103144447.php
+++ b/lib/Migration/Version2001Date20180103144447.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2018 Joas Schilling <coding@schilljs.com>
@@ -116,7 +117,6 @@ class Version2001Date20180103144447 extends SimpleMigrationStep {
* @since 13.0.0
*/
public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $options): void {
-
if (version_compare($this->config->getAppValue('spreed', 'installed_version', '0.0.0'), '2.0.0', '<')) {
// Migrations only work after 2.0.0
return;
@@ -155,6 +155,5 @@ class Version2001Date20180103144447 extends SimpleMigrationStep {
->set('in_call', 'incall');
$update->execute();
}
-
}
}
diff --git a/lib/Migration/Version2001Date20180103150836.php b/lib/Migration/Version2001Date20180103150836.php
index b579af9b1..852977b99 100644
--- a/lib/Migration/Version2001Date20180103150836.php
+++ b/lib/Migration/Version2001Date20180103150836.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2018 Joas Schilling <coding@schilljs.com>
diff --git a/lib/Migration/Version3002Date20180319104030.php b/lib/Migration/Version3002Date20180319104030.php
index ab446d193..35d1228c4 100644
--- a/lib/Migration/Version3002Date20180319104030.php
+++ b/lib/Migration/Version3002Date20180319104030.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2018 Joas Schilling <coding@schilljs.com>
diff --git a/lib/Migration/Version3003Date20180707222130.php b/lib/Migration/Version3003Date20180707222130.php
index c850720a9..187ffe291 100644
--- a/lib/Migration/Version3003Date20180707222130.php
+++ b/lib/Migration/Version3003Date20180707222130.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2018 Mario Danic <mario@lovelyhq.com>
diff --git a/lib/Migration/Version3003Date20180718112436.php b/lib/Migration/Version3003Date20180718112436.php
index c4694fab7..dacb4481e 100644
--- a/lib/Migration/Version3003Date20180718112436.php
+++ b/lib/Migration/Version3003Date20180718112436.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2018 Joas Schilling <coding@schilljs.com>
@@ -75,7 +76,7 @@ class Version3003Date20180718112436 extends SimpleMigrationStep {
->where($update->expr()->eq('id', $update->createParameter('room')));
$query = $this->connection->getQueryBuilder();
- $query->select( 'object_id')
+ $query->select('object_id')
->selectAlias($query->createFunction('MAX(' . $query->getColumnName('creation_timestamp') . ')'), 'last_activity')
->from('comments')
->where($query->expr()->eq('object_type', $query->createNamedParameter('chat')))
diff --git a/lib/Migration/Version3003Date20180718133519.php b/lib/Migration/Version3003Date20180718133519.php
index 6ce1c2e38..3a195cc4c 100644
--- a/lib/Migration/Version3003Date20180718133519.php
+++ b/lib/Migration/Version3003Date20180718133519.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2018, Joas Schilling <coding@schilljs.com>
diff --git a/lib/Migration/Version3003Date20180720162342.php b/lib/Migration/Version3003Date20180720162342.php
index a1b893c73..d6706a85e 100644
--- a/lib/Migration/Version3003Date20180720162342.php
+++ b/lib/Migration/Version3003Date20180720162342.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
*
diff --git a/lib/Migration/Version3003Date20180722152733.php b/lib/Migration/Version3003Date20180722152733.php
index dafd3c592..8edb2de34 100644
--- a/lib/Migration/Version3003Date20180722152733.php
+++ b/lib/Migration/Version3003Date20180722152733.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2018 Joachim Bauch <bauch@struktur.de>
@@ -23,7 +24,6 @@ declare(strict_types=1);
*/
namespace OCA\Talk\Migration;
-use Doctrine\DBAL\Types\Type;
use OCP\DB\ISchemaWrapper;
use OCP\Migration\SimpleMigrationStep;
use OCP\Migration\IOutput;
diff --git a/lib/Migration/Version3003Date20180722152849.php b/lib/Migration/Version3003Date20180722152849.php
index faf8acfbc..3bd92746a 100644
--- a/lib/Migration/Version3003Date20180722152849.php
+++ b/lib/Migration/Version3003Date20180722152849.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2018 Joachim Bauch <bauch@struktur.de>
diff --git a/lib/Migration/Version3003Date20180730080327.php b/lib/Migration/Version3003Date20180730080327.php
index ab1c73afa..3860d631f 100644
--- a/lib/Migration/Version3003Date20180730080327.php
+++ b/lib/Migration/Version3003Date20180730080327.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2018 Joas Schilling <coding@schilljs.com>
diff --git a/lib/Migration/Version4099Date20181001123058.php b/lib/Migration/Version4099Date20181001123058.php
index 90108afd7..4aaac033d 100644
--- a/lib/Migration/Version4099Date20181001123058.php
+++ b/lib/Migration/Version4099Date20181001123058.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2018, Joas Schilling <coding@schilljs.com>
diff --git a/lib/Migration/Version5099Date20190121102337.php b/lib/Migration/Version5099Date20190121102337.php
index dcf88c82e..50b4055ec 100644
--- a/lib/Migration/Version5099Date20190121102337.php
+++ b/lib/Migration/Version5099Date20190121102337.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019, Joas Schilling <coding@schilljs.com>
diff --git a/lib/Migration/Version5099Date20190319134820.php b/lib/Migration/Version5099Date20190319134820.php
index cd7819ec9..3501d7977 100644
--- a/lib/Migration/Version5099Date20190319134820.php
+++ b/lib/Migration/Version5099Date20190319134820.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019, Joas Schilling <coding@schilljs.com>
@@ -54,5 +55,4 @@ class Version5099Date20190319134820 extends SimpleMigrationStep {
return $schema;
}
-
}
diff --git a/lib/Migration/Version7000Date20190717141457.php b/lib/Migration/Version7000Date20190717141457.php
index 9645bdbdf..2f415264f 100644
--- a/lib/Migration/Version7000Date20190717141457.php
+++ b/lib/Migration/Version7000Date20190717141457.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019, Joas Schilling <coding@schilljs.com>
diff --git a/lib/Migration/Version7000Date20190724121136.php b/lib/Migration/Version7000Date20190724121136.php
index 74a268fa6..beb972b79 100644
--- a/lib/Migration/Version7000Date20190724121136.php
+++ b/lib/Migration/Version7000Date20190724121136.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2018 Joas Schilling <coding@schilljs.com>
diff --git a/lib/Migration/Version8000Date20200331144101.php b/lib/Migration/Version8000Date20200331144101.php
index b98da8824..0b3cca860 100644
--- a/lib/Migration/Version8000Date20200331144101.php
+++ b/lib/Migration/Version8000Date20200331144101.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2020, Joas Schilling <coding@schilljs.com>
@@ -30,7 +31,6 @@ use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
class Version8000Date20200331144101 extends SimpleMigrationStep {
-
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ISchemaWrapper {
/** @var ISchemaWrapper $schema */
$schema = $schemaClosure();
diff --git a/lib/Migration/Version8000Date20200402124456.php b/lib/Migration/Version8000Date20200402124456.php
index adff00243..b274b716b 100644
--- a/lib/Migration/Version8000Date20200402124456.php
+++ b/lib/Migration/Version8000Date20200402124456.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2020, Joas Schilling <coding@schilljs.com>
@@ -30,7 +31,6 @@ use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
class Version8000Date20200402124456 extends SimpleMigrationStep {
-
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ISchemaWrapper {
/** @var ISchemaWrapper $schema */
$schema = $schemaClosure();
diff --git a/lib/Migration/Version8000Date20200407073807.php b/lib/Migration/Version8000Date20200407073807.php
index 284e81ea6..30eb81d82 100644
--- a/lib/Migration/Version8000Date20200407073807.php
+++ b/lib/Migration/Version8000Date20200407073807.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
@@ -31,7 +32,6 @@ use OCP\Migration\IOutput;
use OCP\Migration\SimpleMigrationStep;
class Version8000Date20200407073807 extends SimpleMigrationStep {
-
public function changeSchema(IOutput $output, Closure $schemaClosure, array $options): ISchemaWrapper {
/** @var ISchemaWrapper $schema */
$schema = $schemaClosure();
diff --git a/lib/Migration/Version8000Date20200407115318.php b/lib/Migration/Version8000Date20200407115318.php
new file mode 100644
index 000000000..59fa05e44
--- /dev/null
+++ b/lib/Migration/Version8000Date20200407115318.php
@@ -0,0 +1,57 @@
+<?php
+
+declare(strict_types=1);
+/**
+ * @copyright Copyright (c) 2020, Joas Schilling <coding@schilljs.com>
+ *
+ * @author Joas Schilling <coding@schilljs.com>
+ *
+ * @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\Migration;
+
+use Closure;
+use Doctrine\DBAL\Types\Type;
+use OCP\DB\ISchemaWrapper;
+use OCP\Migration\IOutput;
+use OCP\Migration\SimpleMigrationStep;
+
+class Version8000Date20200407115318 extends SimpleMigrationStep {
+ /**
+ * @param IOutput $output
+ * @param Closure $schemaClosure The `\Closure` returns a `ISchemaWrapper`
+ * @param array $options
+ * @return null|ISchemaWrapper
+ */
+ public function changeSchema(IOutput $output, Closure $schemaClosure, array $options) {
+ /** @var ISchemaWrapper $schema */
+ $schema = $schemaClosure();
+
+ $table = $schema->getTable('talk_rooms');
+ if (!$table->hasColumn('assigned_hpb')) {
+ $table->addColumn('assigned_hpb', Type::INTEGER, [
+ 'notnull' => false,
+ 'length' => 4,
+ 'unsigned' => false,
+ 'default' => null,
+ ]);
+ }
+
+ return $schema;
+ }
+}
diff --git a/lib/Model/Command.php b/lib/Model/Command.php
index 8734ea812..b00a51070 100644
--- a/lib/Model/Command.php
+++ b/lib/Model/Command.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
@@ -39,7 +40,6 @@ use OCP\AppFramework\Db\Entity;
* @method int getEnabled()
*/
class Command extends Entity {
-
public const RESPONSE_NONE = 0;
public const RESPONSE_USER = 1;
public const RESPONSE_ALL = 2;
diff --git a/lib/Model/CommandMapper.php b/lib/Model/CommandMapper.php
index b10755259..877ce8203 100644
--- a/lib/Model/CommandMapper.php
+++ b/lib/Model/CommandMapper.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
diff --git a/lib/Model/Message.php b/lib/Model/Message.php
index eadb38206..6d54f04c5 100644
--- a/lib/Model/Message.php
+++ b/lib/Model/Message.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
@@ -22,12 +23,10 @@ declare(strict_types=1);
namespace OCA\Talk\Model;
-
use OCA\Talk\Participant;
use OCA\Talk\Room;
use OCP\Comments\IComment;
use OCP\IL10N;
-use OCP\IUser;
class Message {
diff --git a/lib/Notification/Listener.php b/lib/Notification/Listener.php
index 9f1a38e29..765a35f3c 100644
--- a/lib/Notification/Listener.php
+++ b/lib/Notification/Listener.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2017 Joas Schilling <coding@schilljs.com>
@@ -58,7 +59,7 @@ class Listener {
}
public static function register(IEventDispatcher $dispatcher): void {
- $listener = static function(AddParticipantsEvent $event) {
+ $listener = static function (AddParticipantsEvent $event) {
$room = $event->getRoom();
if ($room->getObjectType() === 'file') {
@@ -71,28 +72,28 @@ class Listener {
};
$dispatcher->addListener(Room::EVENT_AFTER_USERS_ADD, $listener);
- $listener = static function(JoinRoomUserEvent $event) {
+ $listener = static function (JoinRoomUserEvent $event) {
/** @var self $listener */
$listener = \OC::$server->query(self::class);
$listener->markInvitationRead($event->getRoom());
};
$dispatcher->addListener(Room::EVENT_AFTER_ROOM_CONNECT, $listener);
- $listener = static function(RoomEvent $event) {
+ $listener = static function (RoomEvent $event) {
/** @var self $listener */
$listener = \OC::$server->query(self::class);
$listener->checkCallNotifications($event->getRoom());
};
$dispatcher->addListener(Room::EVENT_BEFORE_SESSION_JOIN_CALL, $listener);
- $listener = static function(RoomEvent $event) {
+ $listener = static function (RoomEvent $event) {
/** @var self $listener */
$listener = \OC::$server->query(self::class);
$listener->sendCallNotifications($event->getRoom());
};
$dispatcher->addListener(Room::EVENT_AFTER_SESSION_JOIN_CALL, $listener);
- $listener = static function(RoomEvent $event) {
+ $listener = static function (RoomEvent $event) {
/** @var self $listener */
$listener = \OC::$server->query(self::class);
$listener->markCallNotificationsRead($event->getRoom());
@@ -211,8 +212,8 @@ class Listener {
$this->notificationManager->markProcessed($notification);
$notification->setSubject('call', [
- 'callee' => $actorId,
- ])
+ 'callee' => $actorId,
+ ])
->setDateTime($dateTime);
} catch (\InvalidArgumentException $e) {
$this->logger->logException($e, ['app' => 'spreed']);
diff --git a/lib/Notification/Notifier.php b/lib/Notification/Notifier.php
index 53627fd0a..c336103e6 100644
--- a/lib/Notification/Notifier.php
+++ b/lib/Notification/Notifier.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2016 Joas Schilling <coding@schilljs.com>
@@ -22,7 +23,6 @@ declare(strict_types=1);
namespace OCA\Talk\Notification;
-
use OCA\Talk\Chat\CommentsManager;
use OCA\Talk\Chat\MessageParser;
use OCA\Talk\Config;
@@ -256,9 +256,9 @@ class Notifier implements INotifier {
if ($notification->getSubject() === 'chat') {
if ($room->getType() === Room::ONE_TO_ONE_CALL) {
$subject = $l->t('{user} sent you a private message');
- } else if ($richSubjectUser) {
+ } elseif ($richSubjectUser) {
$subject = $l->t('{user} sent a message in conversation {call}');
- } else if (!$isGuest) {
+ } elseif (!$isGuest) {
$subject = $l->t('A deleted user sent a message in conversation {call}');
} else {
try {
@@ -268,12 +268,12 @@ class Notifier implements INotifier {
$subject = $l->t('A guest sent a message in conversation {call}');
}
}
- } else if ($notification->getSubject() === 'reply') {
+ } elseif ($notification->getSubject() === 'reply') {
if ($room->getType() === Room::ONE_TO_ONE_CALL) {
$subject = $l->t('{user} replied to your private message');
- } else if ($richSubjectUser) {
+ } elseif ($richSubjectUser) {
$subject = $l->t('{user} replied to your message in conversation {call}');
- } else if (!$isGuest) {
+ } elseif (!$isGuest) {
$subject = $l->t('A deleted user replied to your message in conversation {call}');
} else {
try {
@@ -283,11 +283,11 @@ class Notifier implements INotifier {
$subject = $l->t('A guest replied to your message in conversation {call}');
}
}
- } else if ($room->getType() === Room::ONE_TO_ONE_CALL) {
+ } elseif ($room->getType() === Room::ONE_TO_ONE_CALL) {
$subject = $l->t('{user} mentioned you in a private conversation');
- } else if ($richSubjectUser) {
+ } elseif ($richSubjectUser) {
$subject = $l->t('{user} mentioned you in conversation {call}');
- } else if (!$isGuest) {
+ } elseif (!$isGuest) {
$subject = $l->t('A deleted user mentioned you in conversation {call}');
} else {
try {
@@ -398,8 +398,7 @@ class Notifier implements INotifier {
],
]
);
-
- } else if (\in_array($room->getType(), [Room::GROUP_CALL, Room::PUBLIC_CALL], true)) {
+ } elseif (\in_array($room->getType(), [Room::GROUP_CALL, Room::PUBLIC_CALL], true)) {
$subject = $l->t('{user} invited you to a group conversation: {call}');
if ($room->hasSessionsInCall()) {
$notification = $this->addActionButton($notification, $l->t('Join call'));
@@ -478,8 +477,7 @@ class Notifier implements INotifier {
} else {
throw new AlreadyProcessedException();
}
-
- } else if (\in_array($room->getType(), [Room::GROUP_CALL, Room::PUBLIC_CALL], true)) {
+ } elseif (\in_array($room->getType(), [Room::GROUP_CALL, Room::PUBLIC_CALL], true)) {
if ($this->notificationManager->isPreparingPushNotification() || $room->hasSessionsInCall()) {
$notification = $this->addActionButton($notification, $l->t('Join call'));
$subject = $l->t('A group call has started in {call}');
@@ -500,7 +498,6 @@ class Notifier implements INotifier {
],
]
);
-
} else {
throw new AlreadyProcessedException();
}
@@ -555,13 +552,13 @@ class Notifier implements INotifier {
$notification
->setParsedSubject(str_replace(['{email}', '{file}'], [$sharedWith, $file['name']], $subject))
->setRichSubject($subject, [
- 'email' => [
- 'type' => 'email',
- 'id' => $sharedWith,
- 'name' => $sharedWith,
- ],
- 'file' => $file,
- ]
+ 'email' => [
+ 'type' => 'email',
+ 'id' => $sharedWith,
+ 'name' => $sharedWith,
+ ],
+ 'file' => $file,
+ ]
);
} else {
if ($callIsActive) {
diff --git a/lib/Participant.php b/lib/Participant.php
index fd43553c7..a8ea6c7d9 100644
--- a/lib/Participant.php
+++ b/lib/Participant.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2017 Joas Schilling <coding@schilljs.com>
diff --git a/lib/PublicShare/TemplateLoader.php b/lib/PublicShare/TemplateLoader.php
index e03bb3327..38a18f330 100644
--- a/lib/PublicShare/TemplateLoader.php
+++ b/lib/PublicShare/TemplateLoader.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
@@ -28,6 +29,7 @@ use OCA\Talk\Config;
use OCA\Talk\TInitialState;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\Files\FileInfo;
+use OCP\ICacheFactory;
use OCP\IConfig;
use OCP\IInitialStateService;
use OCP\Share\IShare;
@@ -42,19 +44,20 @@ use Symfony\Component\EventDispatcher\GenericEvent;
* needed.
*/
class TemplateLoader {
-
use TInitialState;
public function __construct(IInitialStateService $initialStateService,
+ ICacheFactory $memcacheFactory,
Config $talkConfig,
IConfig $serverConfig) {
$this->initialStateService = $initialStateService;
$this->talkConfig = $talkConfig;
+ $this->memcacheFactory = $memcacheFactory;
$this->serverConfig = $serverConfig;
}
public static function register(IEventDispatcher $dispatcher): void {
- $dispatcher->addListener('OCA\Files_Sharing::loadAdditionalScripts', static function(GenericEvent $event) {
+ $dispatcher->addListener('OCA\Files_Sharing::loadAdditionalScripts', static function (GenericEvent $event) {
/** @var IShare $share */
$share = $event->getArgument('share');
/** @var self $templateLoader */
@@ -86,5 +89,4 @@ class TemplateLoader {
$this->publishInitialStateForGuest();
}
-
}
diff --git a/lib/PublicShareAuth/Listener.php b/lib/PublicShareAuth/Listener.php
index 35a6cb7f4..a0518504f 100644
--- a/lib/PublicShareAuth/Listener.php
+++ b/lib/PublicShareAuth/Listener.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
*
@@ -45,19 +46,18 @@ use OCP\EventDispatcher\IEventDispatcher;
* different room events.
*/
class Listener {
-
public static function register(IEventDispatcher $dispatcher): void {
- $listener = static function(JoinRoomUserEvent $event) {
+ $listener = static function (JoinRoomUserEvent $event) {
self::preventExtraUsersFromJoining($event->getRoom(), $event->getUser()->getUID());
};
$dispatcher->addListener(Room::EVENT_BEFORE_ROOM_CONNECT, $listener);
- $listener = static function(JoinRoomGuestEvent $event) {
+ $listener = static function (JoinRoomGuestEvent $event) {
self::preventExtraGuestsFromJoining($event->getRoom());
};
$dispatcher->addListener(Room::EVENT_BEFORE_GUEST_CONNECT, $listener);
- $listener = static function(RoomEvent $event) {
+ $listener = static function (RoomEvent $event) {
self::destroyRoomOnParticipantLeave($event->getRoom());
};
$dispatcher->addListener(Room::EVENT_AFTER_USER_REMOVE, $listener);
@@ -130,5 +130,4 @@ class Listener {
$room->deleteRoom();
}
-
}
diff --git a/lib/PublicShareAuth/TemplateLoader.php b/lib/PublicShareAuth/TemplateLoader.php
index 9aeccf565..1b96fe419 100644
--- a/lib/PublicShareAuth/TemplateLoader.php
+++ b/lib/PublicShareAuth/TemplateLoader.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
*
@@ -26,6 +27,7 @@ namespace OCA\Talk\PublicShareAuth;
use OCA\Talk\Config;
use OCA\Talk\TInitialState;
use OCP\EventDispatcher\IEventDispatcher;
+use OCP\ICacheFactory;
use OCP\IConfig;
use OCP\IInitialStateService;
use OCP\Share\IShare;
@@ -40,19 +42,20 @@ use Symfony\Component\EventDispatcher\GenericEvent;
* Talk UI as needed.
*/
class TemplateLoader {
-
use TInitialState;
public function __construct(IInitialStateService $initialStateService,
+ ICacheFactory $memcacheFactory,
Config $talkConfig,
IConfig $serverConfig) {
$this->initialStateService = $initialStateService;
+ $this->memcacheFactory = $memcacheFactory;
$this->talkConfig = $talkConfig;
$this->serverConfig = $serverConfig;
}
public static function register(IEventDispatcher $dispatcher): void {
- $listener = static function(GenericEvent $event) {
+ $listener = static function (GenericEvent $event) {
/** @var IShare $share */
$share = $event->getArgument('share');
/** @var self $templateLoader */
@@ -85,5 +88,4 @@ class TemplateLoader {
$this->publishInitialStateForGuest();
}
-
}
diff --git a/lib/Room.php b/lib/Room.php
index 3e7d2fdd3..d087a2112 100644
--- a/lib/Room.php
+++ b/lib/Room.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2016 Lukas Reschke <lukas@statuscode.ch>
@@ -124,6 +125,8 @@ class Room {
private $readOnly;
/** @var int */
private $lobbyState;
+ /** @var int|null */
+ private $assignedSignalingServer;
/** @var \DateTime|null */
private $lobbyTimer;
/** @var string */
@@ -162,6 +165,7 @@ class Room {
int $type,
int $readOnly,
int $lobbyState,
+ ?int $assignedSignalingServer,
string $token,
string $name,
string $password,
@@ -183,6 +187,7 @@ class Room {
$this->type = $type;
$this->readOnly = $readOnly;
$this->lobbyState = $lobbyState;
+ $this->assignedSignalingServer = $assignedSignalingServer;
$this->token = $token;
$this->name = $name;
$this->password = $password;
@@ -224,6 +229,10 @@ class Room {
}
}
+ public function getAssignedSignalingServer(): ?int {
+ return $this->assignedSignalingServer;
+ }
+
public function getToken(): string {
return $this->token;
}
@@ -453,7 +462,6 @@ class Room {
* @return bool
*/
public function setActiveSince(\DateTime $since, bool $isGuest): bool {
-
if ($isGuest && $this->getType() === self::PUBLIC_CALL) {
$query = $this->db->getQueryBuilder();
$query->update('talk_rooms')
@@ -501,6 +509,19 @@ class Room {
return (bool) $query->execute();
}
+ public function setAssignedSignalingServer(?int $signalingServer): bool {
+ $query = $this->db->getQueryBuilder();
+ $query->update('talk_rooms')
+ ->set('assigned_hpb', $query->createNamedParameter($signalingServer))
+ ->where($query->expr()->eq('id', $query->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT)));
+
+ if ($signalingServer !== null) {
+ $query->andWhere($query->expr()->isNull('assigned_hpb'));
+ }
+
+ return (bool) $query->execute();
+ }
+
/**
* @param int $newType Currently it is only allowed to change between `self::GROUP_CALL` and `self::PUBLIC_CALL`
* @return bool True when the change was valid, false otherwise
@@ -737,7 +758,6 @@ class Room {
$query->execute();
$this->dispatcher->dispatch(self::EVENT_AFTER_USER_REMOVE, $event);
-
}
/**
@@ -1107,6 +1127,23 @@ class Room {
}
/**
+ * @return bool
+ */
+ public function hasActiveSessions(): bool {
+ $query = $this->db->getQueryBuilder();
+ $query->select('room_id')
+ ->from('talk_participants')
+ ->where($query->expr()->eq('room_id', $query->createNamedParameter($this->getId(), IQueryBuilder::PARAM_INT)))
+ ->andWhere($query->expr()->neq('session_id', $query->createNamedParameter('0')))
+ ->setMaxResults(1);
+ $result = $query->execute();
+ $row = $result->fetch();
+ $result->closeCursor();
+
+ return (bool) $row;
+ }
+
+ /**
* @return string[]
*/
public function getActiveSessions(): array {
diff --git a/lib/Service/CommandService.php b/lib/Service/CommandService.php
index b7d147cd8..a6b732a6c 100644
--- a/lib/Service/CommandService.php
+++ b/lib/Service/CommandService.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
@@ -22,7 +23,6 @@ declare(strict_types=1);
namespace OCA\Talk\Service;
-
use OCA\Talk\Chat\Command\ShellExecutor;
use OCA\Talk\Model\Command;
use OCA\Talk\Model\CommandMapper;
diff --git a/lib/Settings/Admin/AdminSettings.php b/lib/Settings/Admin/AdminSettings.php
index f162ef652..751c187aa 100644
--- a/lib/Settings/Admin/AdminSettings.php
+++ b/lib/Settings/Admin/AdminSettings.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
@@ -22,7 +23,6 @@ declare(strict_types=1);
namespace OCA\Talk\Settings\Admin;
-
use OCA\Talk\Config;
use OCA\Talk\Model\Command;
use OCA\Talk\Participant;
@@ -83,7 +83,7 @@ class AdminSettings implements ISettings {
protected function initCommands(): void {
$commands = $this->commandService->findAll();
- $result = array_map(function(Command $command) {
+ $result = array_map(function (Command $command) {
return $command->asArray();
}, $commands);
@@ -124,5 +124,4 @@ class AdminSettings implements ISettings {
public function getPriority(): int {
return 0;
}
-
}
diff --git a/lib/Settings/Admin/Section.php b/lib/Settings/Admin/Section.php
index 2d2de7ecb..167544471 100644
--- a/lib/Settings/Admin/Section.php
+++ b/lib/Settings/Admin/Section.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2017 Joas Schilling <coding@schilljs.com>
@@ -22,7 +23,6 @@ declare(strict_types=1);
namespace OCA\Talk\Settings\Admin;
-
use OCP\IL10N;
use OCP\IURLGenerator;
use OCP\Settings\IIconSection;
diff --git a/lib/Settings/Personal.php b/lib/Settings/Personal.php
index d37fad4e4..59da32032 100644
--- a/lib/Settings/Personal.php
+++ b/lib/Settings/Personal.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2018 Julius Härtl <jus@bitgrid.net>
@@ -24,7 +25,6 @@ declare(strict_types=1);
namespace OCA\Talk\Settings;
-
use OCP\AppFramework\Http\TemplateResponse;
use OCP\IConfig;
use OCP\Settings\ISettings;
diff --git a/lib/Share/Helper/DeletedShareAPIController.php b/lib/Share/Helper/DeletedShareAPIController.php
index f09e276de..6f5254d58 100644
--- a/lib/Share/Helper/DeletedShareAPIController.php
+++ b/lib/Share/Helper/DeletedShareAPIController.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
*
@@ -26,8 +27,6 @@ namespace OCA\Talk\Share\Helper;
use OCA\Talk\Exceptions\RoomNotFoundException;
use OCA\Talk\Manager;
use OCA\Talk\Room;
-use OCP\IUser;
-use OCP\IUserManager;
use OCP\Share\IShare;
/**
@@ -74,5 +73,4 @@ class DeletedShareAPIController {
return $result;
}
-
}
diff --git a/lib/Share/Helper/ShareAPIController.php b/lib/Share/Helper/ShareAPIController.php
index d45a98b4f..004b58768 100644
--- a/lib/Share/Helper/ShareAPIController.php
+++ b/lib/Share/Helper/ShareAPIController.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
*
@@ -30,7 +31,6 @@ use OCA\Talk\Room;
use OCP\AppFramework\OCS\OCSNotFoundException;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\IL10N;
-use OCP\IUser;
use OCP\IUserManager;
use OCP\Share\IShare;
@@ -174,5 +174,4 @@ class ShareAPIController {
return true;
}
-
}
diff --git a/lib/Share/Listener.php b/lib/Share/Listener.php
index 13575fc46..30f324145 100644
--- a/lib/Share/Listener.php
+++ b/lib/Share/Listener.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2020 Joas Schilling <coding@schilljs.com>
@@ -30,7 +31,6 @@ use OCP\Share\IShare;
use Symfony\Component\EventDispatcher\GenericEvent;
class Listener {
-
public static function register(IEventDispatcher $dispatcher): void {
$dispatcher->addListener('OCP\Share::preShare', [self::class, 'listenPreShare'], 1000);
$dispatcher->addListener(VerifyMountPointEvent::class, [self::class, 'listenVerifyMountPointEvent'], 1000);
diff --git a/lib/Share/RoomShareProvider.php b/lib/Share/RoomShareProvider.php
index 7878e771f..2f93ead11 100644
--- a/lib/Share/RoomShareProvider.php
+++ b/lib/Share/RoomShareProvider.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
*
@@ -103,7 +104,7 @@ class RoomShareProvider implements IShareProvider {
}
public static function register(IEventDispatcher $dispatcher): void {
- $listener = static function(ParticipantEvent $event) {
+ $listener = static function (ParticipantEvent $event) {
$room = $event->getRoom();
if ($event->getParticipant()->getParticipantType() === Participant::USER_SELF_JOINED) {
@@ -114,7 +115,7 @@ class RoomShareProvider implements IShareProvider {
};
$dispatcher->addListener(Room::EVENT_AFTER_ROOM_DISCONNECT, $listener);
- $listener = static function(RemoveUserEvent $event) {
+ $listener = static function (RemoveUserEvent $event) {
$room = $event->getRoom();
/** @var self $roomShareProvider */
@@ -123,7 +124,7 @@ class RoomShareProvider implements IShareProvider {
};
$dispatcher->addListener(Room::EVENT_AFTER_USER_REMOVE, $listener);
- $listener = static function(RoomEvent $event) {
+ $listener = static function (RoomEvent $event) {
$room = $event->getRoom();
/** @var self $roomShareProvider */
@@ -414,7 +415,7 @@ class RoomShareProvider implements IShareProvider {
'permissions' => $qb->createNamedParameter(0),
'stime' => $qb->createNamedParameter($share->getShareTime()->getTimestamp()),
])->execute();
- } else if ($data['permissions'] !== 0) {
+ } elseif ($data['permissions'] !== 0) {
// Already a userroom share. Update it.
$qb = $this->dbConnection->getQueryBuilder();
$qb->update('share')
@@ -795,7 +796,9 @@ class RoomShareProvider implements IShareProvider {
$qb->andWhere($qb->expr()->eq('s.file_source', $qb->createNamedParameter($node->getId())));
}
- $rooms = array_map(function(Room $room) { return $room->getToken(); }, $rooms);
+ $rooms = array_map(function (Room $room) {
+ return $room->getToken();
+ }, $rooms);
$qb->andWhere($qb->expr()->eq('s.share_type', $qb->createNamedParameter(IShare::TYPE_ROOM)))
->andWhere($qb->expr()->in('s.share_with', $qb->createNamedParameter(
@@ -838,7 +841,7 @@ class RoomShareProvider implements IShareProvider {
$pathSections = explode('/', $data['path'], 2);
// FIXME: would not detect rare md5'd home storage case properly
if ($pathSections[0] !== 'files'
- && in_array(explode(':', $data['storage_string_id'], 2)[0], array('home', 'object'))) {
+ && in_array(explode(':', $data['storage_string_id'], 2)[0], ['home', 'object'])) {
return false;
}
return true;
@@ -948,7 +951,7 @@ class RoomShareProvider implements IShareProvider {
$cursor = $qb->execute();
$users = [];
- while($row = $cursor->fetch()) {
+ while ($row = $cursor->fetch()) {
$type = (int)$row['share_type'];
if ($type === IShare::TYPE_ROOM) {
$roomToken = $row['share_with'];
@@ -963,7 +966,7 @@ class RoomShareProvider implements IShareProvider {
$users[$uid] = $users[$uid] ?? [];
$users[$uid][$row['id']] = $row;
}
- } else if ($type === self::SHARE_TYPE_USERROOM && $currentAccess === true) {
+ } elseif ($type === self::SHARE_TYPE_USERROOM && $currentAccess === true) {
$uid = $row['share_with'];
$users[$uid] = $users[$uid] ?? [];
$users[$uid][$row['id']] = $row;
@@ -1070,7 +1073,7 @@ class RoomShareProvider implements IShareProvider {
$cursor = $qb->execute();
$ids = [];
- while($row = $cursor->fetch()) {
+ while ($row = $cursor->fetch()) {
$ids[] = (int)$row['id'];
}
$cursor->closeCursor();
@@ -1107,7 +1110,7 @@ class RoomShareProvider implements IShareProvider {
$cursor = $qb->execute();
$ids = [];
- while($row = $cursor->fetch()) {
+ while ($row = $cursor->fetch()) {
$ids[] = (int)$row['id'];
}
$cursor->closeCursor();
@@ -1144,7 +1147,7 @@ class RoomShareProvider implements IShareProvider {
);
$cursor = $qb->execute();
- while($data = $cursor->fetch()) {
+ while ($data = $cursor->fetch()) {
$share = $this->createShareObject($data);
yield $share;
diff --git a/lib/Signaling/BackendNotifier.php b/lib/Signaling/BackendNotifier.php
index 8e79ac4ed..718521821 100644
--- a/lib/Signaling/BackendNotifier.php
+++ b/lib/Signaling/BackendNotifier.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2017 Joachim Bauch <bauch@struktur.de>
@@ -40,15 +41,19 @@ class BackendNotifier {
private $clientService;
/** @var ISecureRandom */
private $secureRandom;
+ /** @var Manager */
+ private $signalingManager;
public function __construct(Config $config,
ILogger $logger,
IClientService $clientService,
- ISecureRandom $secureRandom) {
+ ISecureRandom $secureRandom,
+ Manager $signalingManager) {
$this->config = $config;
$this->logger = $logger;
$this->clientService = $clientService;
$this->secureRandom = $secureRandom;
+ $this->signalingManager = $signalingManager;
}
/**
@@ -79,23 +84,24 @@ class BackendNotifier {
/**
* Perform a request to the signaling backend.
*
- * @param string $url
+ * @param Room $room
* @param array $data
* @throws \Exception
*/
- private function backendRequest(string $url, array $data): void {
- $servers = $this->config->getSignalingServers();
- if (empty($servers)) {
+ private function backendRequest(Room $room, array $data): void {
+ if ($this->config->getSignalingMode() === Config::SIGNALING_INTERNAL) {
return;
}
- // We can use any server of the available backends.
- $signaling = $servers[random_int(0, count($servers) - 1)];
+ // FIXME some need to go to all HPBs, but that doesn't scale, so bad luck for now :(
+ $signaling = $this->signalingManager->getSignalingServerForConversation($room);
$signaling['server'] = rtrim($signaling['server'], '/');
- $url = rtrim($signaling['server'], '/') . $url;
+
+ $url = '/api/v1/room/' . $room->getToken();
+ $url = $signaling['server'] . $url;
if (strpos($url, 'wss://') === 0) {
$url = 'https://' . substr($url, 6);
- } else if (strpos($url, 'ws://') === 0) {
+ } elseif (strpos($url, 'ws://') === 0) {
$url = 'http://' . substr($url, 5);
}
$body = json_encode($data);
@@ -131,7 +137,7 @@ class BackendNotifier {
foreach ($users as $user) {
$userIds[] = $user['userId'];
}
- $this->backendRequest('/api/v1/room/' . $room->getToken(), [
+ $this->backendRequest($room, [
'type' => 'invite',
'invite' => [
'userids' => $userIds,
@@ -152,7 +158,7 @@ class BackendNotifier {
*/
public function roomsDisinvited(Room $room, array $userIds): void {
$this->logger->info('No longer invited to ' . $room->getToken() . ': ' . print_r($userIds, true), ['app' => 'spreed']);
- $this->backendRequest('/api/v1/room/' . $room->getToken(), [
+ $this->backendRequest($room, [
'type' => 'disinvite',
'disinvite' => [
'userids' => $userIds,
@@ -173,7 +179,7 @@ class BackendNotifier {
*/
public function roomSessionsRemoved(Room $room, array $sessionIds): void {
$this->logger->info('Removed from ' . $room->getToken() . ': ' . print_r($sessionIds, true), ['app' => 'spreed']);
- $this->backendRequest('/api/v1/room/' . $room->getToken(), [
+ $this->backendRequest($room, [
'type' => 'disinvite',
'disinvite' => [
'sessionids' => $sessionIds,
@@ -193,7 +199,7 @@ class BackendNotifier {
*/
public function roomModified(Room $room): void {
$this->logger->info('Room modified: ' . $room->getToken(), ['app' => 'spreed']);
- $this->backendRequest('/api/v1/room/' . $room->getToken(), [
+ $this->backendRequest($room, [
'type' => 'update',
'update' => [
'userids' => $room->getParticipantUserIds(),
@@ -212,7 +218,7 @@ class BackendNotifier {
public function roomDeleted(Room $room, array $participants): void {
$this->logger->info('Room deleted: ' . $room->getToken(), ['app' => 'spreed']);
$userIds = array_keys($participants['users']);
- $this->backendRequest('/api/v1/room/' . $room->getToken(), [
+ $this->backendRequest($room, [
'type' => 'delete',
'delete' => [
'userids' => $userIds,
@@ -254,7 +260,7 @@ class BackendNotifier {
$changed[] = $participant;
}
}
- $this->backendRequest('/api/v1/room/' . $room->getToken(), [
+ $this->backendRequest($room, [
'type' => 'participants',
'participants' => [
'changed' => $changed,
@@ -297,7 +303,7 @@ class BackendNotifier {
}
}
- $this->backendRequest('/api/v1/room/' . $room->getToken(), [
+ $this->backendRequest($room, [
'type' => 'incall',
'incall' => [
'incall' => $flags,
@@ -316,12 +322,11 @@ class BackendNotifier {
* @throws \Exception
*/
public function sendRoomMessage(Room $room, array $message): void {
- $this->backendRequest('/api/v1/room/' . $room->getToken(), [
+ $this->backendRequest($room, [
'type' => 'message',
'message' => [
'data' => $message,
],
]);
}
-
}
diff --git a/lib/Signaling/Listener.php b/lib/Signaling/Listener.php
index 1f7c07f30..3081a4c8d 100644
--- a/lib/Signaling/Listener.php
+++ b/lib/Signaling/Listener.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
@@ -27,9 +28,7 @@ use OCA\Talk\Config;
use OCA\Talk\Events\AddParticipantsEvent;
use OCA\Talk\Events\ChatEvent;
use OCA\Talk\Events\ChatParticipantEvent;
-use OCA\Talk\Events\ModifyLobbyEvent;
use OCA\Talk\Events\ModifyParticipantEvent;
-use OCA\Talk\Events\ModifyRoomEvent;
use OCA\Talk\Events\ParticipantEvent;
use OCA\Talk\Events\RemoveParticipantEvent;
use OCA\Talk\Events\RemoveUserEvent;
@@ -40,7 +39,6 @@ use OCA\Talk\Room;
use OCP\EventDispatcher\IEventDispatcher;
class Listener {
-
public static function register(IEventDispatcher $dispatcher): void {
self::registerInternalSignaling($dispatcher);
self::registerExternalSignaling($dispatcher);
@@ -49,11 +47,11 @@ class Listener {
protected static function isUsingInternalSignaling(): bool {
/** @var Config $config */
$config = \OC::$server->query(Config::class);
- return empty($config->getSignalingServers());
+ return $config->getSignalingMode() === Config::SIGNALING_INTERNAL;
}
protected static function registerInternalSignaling(IEventDispatcher $dispatcher): void {
- $listener = static function(RoomEvent $event) {
+ $listener = static function (RoomEvent $event) {
if (!self::isUsingInternalSignaling()) {
return;
}
@@ -68,7 +66,7 @@ class Listener {
$dispatcher->addListener(Room::EVENT_AFTER_SESSION_LEAVE_CALL, $listener);
$dispatcher->addListener(GuestManager::EVENT_AFTER_NAME_UPDATE, $listener);
- $listener = static function(ParticipantEvent $event) {
+ $listener = static function (ParticipantEvent $event) {
if (!self::isUsingInternalSignaling()) {
return;
}
@@ -92,7 +90,7 @@ class Listener {
$dispatcher->addListener(Room::EVENT_AFTER_PARTICIPANT_REMOVE, $listener);
$dispatcher->addListener(Room::EVENT_AFTER_ROOM_DISCONNECT, $listener);
- $listener = static function(RoomEvent $event) {
+ $listener = static function (RoomEvent $event) {
$room = $event->getRoom();
if (!self::isUsingInternalSignaling()) {
return;
@@ -112,7 +110,7 @@ class Listener {
}
protected static function registerExternalSignaling(IEventDispatcher $dispatcher): void {
- $dispatcher->addListener(Room::EVENT_AFTER_USERS_ADD, static function(AddParticipantsEvent $event) {
+ $dispatcher->addListener(Room::EVENT_AFTER_USERS_ADD, static function (AddParticipantsEvent $event) {
if (self::isUsingInternalSignaling()) {
return;
}
@@ -122,7 +120,7 @@ class Listener {
$notifier->roomInvited($event->getRoom(), $event->getParticipants());
});
- $listener = static function(RoomEvent $event) {
+ $listener = static function (RoomEvent $event) {
if (self::isUsingInternalSignaling()) {
return;
}
@@ -141,7 +139,7 @@ class Listener {
// "participantsModified" once the clients no longer expect a
// "roomModified" message for participant type changes.
$dispatcher->addListener(Room::EVENT_AFTER_PARTICIPANT_TYPE_SET, $listener);
- $dispatcher->addListener(Room::EVENT_AFTER_PARTICIPANT_TYPE_SET, static function(ModifyParticipantEvent $event) {
+ $dispatcher->addListener(Room::EVENT_AFTER_PARTICIPANT_TYPE_SET, static function (ModifyParticipantEvent $event) {
if (self::isUsingInternalSignaling()) {
return;
}
@@ -158,7 +156,7 @@ class Listener {
}
$notifier->participantsModified($event->getRoom(), $sessionIds);
});
- $dispatcher->addListener(Room::EVENT_BEFORE_ROOM_DELETE, static function(RoomEvent $event) {
+ $dispatcher->addListener(Room::EVENT_BEFORE_ROOM_DELETE, static function (RoomEvent $event) {
if (self::isUsingInternalSignaling()) {
return;
}
@@ -170,7 +168,7 @@ class Listener {
$participants = $room->getParticipantsLegacy();
$notifier->roomDeleted($room, $participants);
});
- $dispatcher->addListener(Room::EVENT_AFTER_USER_REMOVE, static function(RemoveUserEvent $event) {
+ $dispatcher->addListener(Room::EVENT_AFTER_USER_REMOVE, static function (RemoveUserEvent $event) {
if (self::isUsingInternalSignaling()) {
return;
}
@@ -180,7 +178,7 @@ class Listener {
$notifier->roomsDisinvited($event->getRoom(), [$event->getUser()->getUID()]);
});
- $dispatcher->addListener(Room::EVENT_AFTER_PARTICIPANT_REMOVE, static function(RemoveParticipantEvent $event) {
+ $dispatcher->addListener(Room::EVENT_AFTER_PARTICIPANT_REMOVE, static function (RemoveParticipantEvent $event) {
if (self::isUsingInternalSignaling()) {
return;
}
@@ -191,7 +189,7 @@ class Listener {
$notifier->roomSessionsRemoved($event->getRoom(), [$event->getParticipant()->getSessionId()]);
});
- $listener = static function(ModifyParticipantEvent $event) {
+ $listener = static function (ModifyParticipantEvent $event) {
if (self::isUsingInternalSignaling()) {
return;
}
@@ -208,7 +206,7 @@ class Listener {
$dispatcher->addListener(Room::EVENT_AFTER_SESSION_JOIN_CALL, $listener);
$dispatcher->addListener(Room::EVENT_AFTER_SESSION_LEAVE_CALL, $listener);
- $dispatcher->addListener(Room::EVENT_AFTER_GUESTS_CLEAN, static function(RoomEvent $event) {
+ $dispatcher->addListener(Room::EVENT_AFTER_GUESTS_CLEAN, static function (RoomEvent $event) {
if (self::isUsingInternalSignaling()) {
return;
}
@@ -221,7 +219,7 @@ class Listener {
$sessionIds = [];
$notifier->participantsModified($event->getRoom(), $sessionIds);
});
- $dispatcher->addListener(GuestManager::EVENT_AFTER_NAME_UPDATE, static function(ModifyParticipantEvent $event) {
+ $dispatcher->addListener(GuestManager::EVENT_AFTER_NAME_UPDATE, static function (ModifyParticipantEvent $event) {
if (self::isUsingInternalSignaling()) {
return;
}
@@ -231,7 +229,7 @@ class Listener {
$notifier->participantsModified($event->getRoom(), [$event->getParticipant()->getSessionId()]);
});
- $dispatcher->addListener(ChatManager::EVENT_AFTER_MESSAGE_SEND , static function(ChatParticipantEvent $event) {
+ $dispatcher->addListener(ChatManager::EVENT_AFTER_MESSAGE_SEND , static function (ChatParticipantEvent $event) {
if (self::isUsingInternalSignaling()) {
return;
}
@@ -248,7 +246,7 @@ class Listener {
];
$notifier->sendRoomMessage($room, $message);
});
- $dispatcher->addListener(ChatManager::EVENT_AFTER_SYSTEM_MESSAGE_SEND, static function(ChatEvent $event) {
+ $dispatcher->addListener(ChatManager::EVENT_AFTER_SYSTEM_MESSAGE_SEND, static function (ChatEvent $event) {
if (self::isUsingInternalSignaling()) {
return;
}
diff --git a/lib/Signaling/Manager.php b/lib/Signaling/Manager.php
new file mode 100644
index 000000000..36486c78d
--- /dev/null
+++ b/lib/Signaling/Manager.php
@@ -0,0 +1,112 @@
+<?php
+
+declare(strict_types=1);
+/**
+ * @copyright Copyright (c) 2020 Joas Schilling <coding@schilljs.com>
+ *
+ * @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\Signaling;
+
+use OCA\Talk\Config;
+use OCA\Talk\Room;
+use OCP\ICache;
+use OCP\ICacheFactory;
+use OCP\IConfig;
+
+class Manager {
+
+ /** @var IConfig */
+ protected $serverConfig;
+ /** @var Config */
+ protected $talkConfig;
+ /** @var ICache */
+ private $cache;
+
+ public function __construct(IConfig $serverConfig,
+ Config $talkConfig,
+ ICacheFactory $cacheFactory) {
+ $this->serverConfig = $serverConfig;
+ $this->talkConfig = $talkConfig;
+ $this->cache = $cacheFactory->createDistributed('hpb_servers');
+ }
+
+ public function getSignalingServerLinkForConversation(?Room $room): string {
+ if ($this->talkConfig->getSignalingMode() === Config::SIGNALING_INTERNAL) {
+ return '';
+ }
+
+ return $this->getSignalingServerForConversation($room)['server'];
+ }
+
+ public function getSignalingServerForConversation(?Room $room): array {
+ switch ($this->talkConfig->getSignalingMode()) {
+ case Config::SIGNALING_EXTERNAL:
+ return $this->getSignalingServerRandomly();
+ case Config::SIGNALING_CLUSTER_CONVERSATION:
+ if (!$room instanceof Room) {
+ throw new \RuntimeException('Can not get conversation cluster HPB without conversation');
+ }
+ return $this->getSignalingServerConversationCluster($room);
+ default:
+ throw new \RuntimeException('Unsupported signaling mode');
+ }
+ }
+
+ public function getSignalingServerRandomly(): array {
+ $servers = $this->talkConfig->getSignalingServers();
+ try {
+ $serverId = random_int(0, count($servers) - 1);
+ return $servers[$serverId];
+ } catch (\Exception $e) {
+ return $servers[0];
+ }
+ }
+
+ public function getSignalingServerConversationCluster(Room $room): array {
+ $serverId = $room->getAssignedSignalingServer();
+ $servers = $this->talkConfig->getSignalingServers();
+
+ if ($serverId !== null && isset($servers[$serverId])) {
+ return $servers[$serverId];
+ }
+
+ try {
+ $serverIdToAssign = random_int(0, count($servers) - 1);
+ } catch (\Exception $e) {
+ $serverIdToAssign = 0;
+ }
+
+ $hardcodedServers = $this->serverConfig->getSystemValue('talk_hardcoded_hpb', []);
+ if (isset($hardcodedServers[$room->getToken()])) {
+ $hardcodedServerId = $hardcodedServers[$room->getToken()];
+ if (isset($servers[$hardcodedServerId])) {
+ $serverIdToAssign = $hardcodedServerId;
+ }
+ }
+
+ $serverId = $this->cache->get($room->getToken());
+ if ($serverId === null) {
+ $this->cache->set($room->getToken(), $serverIdToAssign);
+ $serverId = $serverIdToAssign;
+ $room->setAssignedSignalingServer($serverId);
+ }
+
+ return $servers[$serverId];
+ }
+}
diff --git a/lib/Signaling/Messages.php b/lib/Signaling/Messages.php
index a1d8d144e..83407e144 100644
--- a/lib/Signaling/Messages.php
+++ b/lib/Signaling/Messages.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2017 Joas Schilling <coding@schilljs.com>
@@ -22,7 +23,6 @@ declare(strict_types=1);
namespace OCA\Talk\Signaling;
-
use OCA\Talk\Room;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\DB\QueryBuilder\IQueryBuilder;
diff --git a/lib/TInitialState.php b/lib/TInitialState.php
index 7452436de..5b689e53b 100644
--- a/lib/TInitialState.php
+++ b/lib/TInitialState.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2020 Joas Schilling <coding@schilljs.com>
@@ -22,11 +23,12 @@ declare(strict_types=1);
namespace OCA\Talk;
-
+use OC\HintException;
use OC\User\NoUserException;
use OCP\App\IAppManager;
use OCP\Files\IRootFolder;
use OCP\Files\NotPermittedException;
+use OCP\ICacheFactory;
use OCP\IConfig;
use OCP\IInitialStateService;
use OCP\IUser;
@@ -40,6 +42,8 @@ trait TInitialState {
protected $serverConfig;
/** @var IInitialStateService */
protected $initialStateService;
+ /** @var ICacheFactory */
+ protected $memcacheFactory;
protected function publishInitialStateShared(): void {
// Needed to enable the screensharing extension in Chromium < 72.
@@ -50,6 +54,15 @@ trait TInitialState {
$this->serverConfig->getAppValue('spreed', 'prefer_h264', 'no') === 'yes'
);
+ $signalingMode = $this->talkConfig->getSignalingMode();
+ if ($signalingMode !== Config::SIGNALING_INTERNAL
+ && !$this->memcacheFactory->isAvailable()
+ && $this->serverConfig->getAppValue('spreed', 'signaling_dev', 'no') === 'no') {
+ throw new HintException(
+ 'External signaling is only supported with a distributed cache'
+ );
+ }
+
$this->initialStateService->provideInitialState(
'talk', 'signaling_mode',
$this->talkConfig->getSignalingMode()
@@ -57,7 +70,6 @@ trait TInitialState {
}
protected function publishInitialStateForUser(IUser $user, IRootFolder $rootFolder, IAppManager $appManager): void {
-
$this->publishInitialStateShared();
$this->initialStateService->provideInitialState(
@@ -90,7 +102,6 @@ trait TInitialState {
}
protected function publishInitialStateForGuest(): void {
-
$this->publishInitialStateShared();
$this->initialStateService->provideInitialState(
diff --git a/lib/TalkSession.php b/lib/TalkSession.php
index 669f1b75c..667001a2e 100644
--- a/lib/TalkSession.php
+++ b/lib/TalkSession.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2018 Joas Schilling <coding@schilljs.com>
@@ -22,7 +23,6 @@ declare(strict_types=1);
namespace OCA\Talk;
-
use OCP\ISession;
class TalkSession {
@@ -132,5 +132,4 @@ class TalkSession {
$this->session->set($key, json_encode($values));
}
-
}
diff --git a/lib/Webinary.php b/lib/Webinary.php
index 7b15053f1..d29866b6a 100644
--- a/lib/Webinary.php
+++ b/lib/Webinary.php
@@ -1,4 +1,5 @@
<?php
+
declare(strict_types=1);
/**
* @copyright Copyright (c) 2019 Joas Schilling <coding@schilljs.com>
@@ -22,10 +23,7 @@ declare(strict_types=1);
namespace OCA\Talk;
-
class Webinary {
-
public const LOBBY_NONE = 0;
public const LOBBY_NON_MODERATORS = 1;
-
}