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:
authorJoas Schilling <213943+nickvergessen@users.noreply.github.com>2022-04-26 10:03:43 +0300
committerGitHub <noreply@github.com>2022-04-26 10:03:43 +0300
commita89182648a5a87e76059ca498878677db796ff5b (patch)
tree1f3e1f40e45b0166b045f07d4449cefbe0e4e01a /lib
parenta00908d2b2e48048c4b5ea0bbdd6ca32d45a3e36 (diff)
parent875b75c2dab7df79be2679c46980e85a733af7e3 (diff)
Merge pull request #7214 from nextcloud/feature/move-status-listeners-anonymous-functions-to-static
Move status listeners anonymous functions to static
Diffstat (limited to 'lib')
-rw-r--r--lib/Status/Listener.php36
1 files changed, 15 insertions, 21 deletions
diff --git a/lib/Status/Listener.php b/lib/Status/Listener.php
index 4bf4e7ffe..80b8722aa 100644
--- a/lib/Status/Listener.php
+++ b/lib/Status/Listener.php
@@ -43,32 +43,24 @@ class Listener {
}
public static function register(IEventDispatcher $dispatcher): void {
- $dispatcher->addListener(Room::EVENT_BEFORE_SESSION_JOIN_CALL, static function (ModifyParticipantEvent $event) {
- /** @var self $listener */
- $listener = \OC::$server->get(self::class);
- $listener->setUserStatus($event);
- });
+ $dispatcher->addListener(Room::EVENT_BEFORE_SESSION_JOIN_CALL, [self::class, 'setUserStatus']);
- $dispatcher->addListener(Room::EVENT_AFTER_SESSION_LEAVE_CALL, static function (ModifyParticipantEvent $event) {
- /** @var self $listener */
- $listener = \OC::$server->get(self::class);
- $listener->revertUserStatus($event);
- });
+ $dispatcher->addListener(Room::EVENT_AFTER_SESSION_LEAVE_CALL, [self::class, 'revertUserStatus']);
- $dispatcher->addListener(Room::EVENT_AFTER_END_CALL_FOR_EVERYONE, static function (EndCallForEveryoneEvent $event) {
- /** @var self $listener */
- $listener = \OC::$server->get(self::class);
- $listener->revertUserStatusOnEndCallForEveryone($event);
- });
+ $dispatcher->addListener(Room::EVENT_AFTER_END_CALL_FOR_EVERYONE, [self::class, 'revertUserStatusOnEndCallForEveryone']);
}
- public function setUserStatus(ModifyParticipantEvent $event): void {
+ public static function setUserStatus(ModifyParticipantEvent $event): void {
+ /** @var self $listener */
+ $listener = \OC::$server->get(self::class);
if ($event->getParticipant()->getAttendee()->getActorType() === Attendee::ACTOR_USERS) {
- $this->statusManager->setUserStatus($event->getParticipant()->getAttendee()->getActorId(), 'call', IUserStatus::AWAY, true);
+ $listener->statusManager->setUserStatus($event->getParticipant()->getAttendee()->getActorId(), 'call', IUserStatus::AWAY, true);
}
}
- public function revertUserStatus(ModifyParticipantEvent $event): void {
+ public static function revertUserStatus(ModifyParticipantEvent $event): void {
+ /** @var self $listener */
+ $listener = \OC::$server->get(self::class);
if ($event instanceof ModifyEveryoneEvent) {
// Do not revert the status with 3 queries per user.
// We will update it in one go at the end.
@@ -76,14 +68,16 @@ class Listener {
}
if ($event->getParticipant()->getAttendee()->getActorType() === Attendee::ACTOR_USERS) {
- $this->statusManager->revertUserStatus($event->getParticipant()->getAttendee()->getActorId(), 'call', IUserStatus::AWAY);
+ $listener->statusManager->revertUserStatus($event->getParticipant()->getAttendee()->getActorId(), 'call', IUserStatus::AWAY);
}
}
- public function revertUserStatusOnEndCallForEveryone(EndCallForEveryoneEvent $event): void {
+ public static function revertUserStatusOnEndCallForEveryone(EndCallForEveryoneEvent $event): void {
+ /** @var self $listener */
+ $listener = \OC::$server->get(self::class);
$userIds = $event->getUserIds();
if (!empty($userIds)) {
- $this->statusManager->revertMultipleUserStatus($userIds, 'call', IUserStatus::AWAY);
+ $listener->statusManager->revertMultipleUserStatus($userIds, 'call', IUserStatus::AWAY);
}
}
}