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 <coding@schilljs.com>2021-09-20 17:27:40 +0300
committerJoas Schilling <coding@schilljs.com>2021-11-03 15:10:34 +0300
commit9d924ad0146c9de8ae52a7963acf7fccdf70a690 (patch)
treeb6bd5677d8aa9a85f804061000b7da8d8fe9ef93 /lib
parent56d466029506be73782490ed779fe402c7b39c8f (diff)
Don't log single "call_left" system messages when call ended for everyone
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/Chat/SystemMessage/Listener.php6
-rw-r--r--lib/Events/ModifyEveryoneEvent.php27
-rw-r--r--lib/Service/ParticipantService.php12
3 files changed, 42 insertions, 3 deletions
diff --git a/lib/Chat/SystemMessage/Listener.php b/lib/Chat/SystemMessage/Listener.php
index 31f5a4ba6..f8fbd7d48 100644
--- a/lib/Chat/SystemMessage/Listener.php
+++ b/lib/Chat/SystemMessage/Listener.php
@@ -27,6 +27,7 @@ use OCA\Talk\Chat\ChatManager;
use OCA\Talk\Events\AddParticipantsEvent;
use OCA\Talk\Events\AttendeesAddedEvent;
use OCA\Talk\Events\AttendeesRemovedEvent;
+use OCA\Talk\Events\ModifyEveryoneEvent;
use OCA\Talk\Events\ModifyLobbyEvent;
use OCA\Talk\Events\ModifyParticipantEvent;
use OCA\Talk\Events\ModifyRoomEvent;
@@ -96,6 +97,11 @@ class Listener implements IEventListener {
}
});
$dispatcher->addListener(Room::EVENT_AFTER_SESSION_LEAVE_CALL, static function (ModifyParticipantEvent $event) {
+ if ($event instanceof ModifyEveryoneEvent) {
+ // No individual system message if the call is ended for everyone
+ return;
+ }
+
$room = $event->getRoom();
$session = $event->getParticipant()->getSession();
diff --git a/lib/Events/ModifyEveryoneEvent.php b/lib/Events/ModifyEveryoneEvent.php
new file mode 100644
index 000000000..5bcbe1596
--- /dev/null
+++ b/lib/Events/ModifyEveryoneEvent.php
@@ -0,0 +1,27 @@
+<?php
+
+declare(strict_types=1);
+/**
+ * @copyright Copyright (c) 2021 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\Events;
+
+class ModifyEveryoneEvent extends ModifyParticipantEvent {
+}
diff --git a/lib/Service/ParticipantService.php b/lib/Service/ParticipantService.php
index c9f05f32e..da15b56ed 100644
--- a/lib/Service/ParticipantService.php
+++ b/lib/Service/ParticipantService.php
@@ -32,6 +32,7 @@ use OCA\Talk\Events\AttendeesAddedEvent;
use OCA\Talk\Events\AttendeesRemovedEvent;
use OCA\Talk\Events\JoinRoomGuestEvent;
use OCA\Talk\Events\JoinRoomUserEvent;
+use OCA\Talk\Events\ModifyEveryoneEvent;
use OCA\Talk\Events\ModifyParticipantEvent;
use OCA\Talk\Events\ModifyRoomEvent;
use OCA\Talk\Events\ParticipantEvent;
@@ -915,13 +916,13 @@ class ParticipantService {
// kick out all participants out of the call
foreach ($participants as $participant) {
- $this->changeInCall($room, $participant, Participant::FLAG_DISCONNECTED);
+ $this->changeInCall($room, $participant, Participant::FLAG_DISCONNECTED, true);
}
$this->dispatcher->dispatch(Room::EVENT_AFTER_END_CALL_FOR_EVERYONE, $event);
}
- public function changeInCall(Room $room, Participant $participant, int $flags): void {
+ public function changeInCall(Room $room, Participant $participant, int $flags, bool $endCallForEveryone = false): void {
$session = $participant->getSession();
if (!$session instanceof Session) {
return;
@@ -935,10 +936,15 @@ class ParticipantService {
$flags &= ~Participant::FLAG_WITH_VIDEO;
}
- $event = new ModifyParticipantEvent($room, $participant, 'inCall', $flags, $session->getInCall());
if ($flags !== Participant::FLAG_DISCONNECTED) {
+ $event = new ModifyParticipantEvent($room, $participant, 'inCall', $flags, $session->getInCall());
$this->dispatcher->dispatch(Room::EVENT_BEFORE_SESSION_JOIN_CALL, $event);
} else {
+ if ($endCallForEveryone) {
+ $event = new ModifyEveryoneEvent($room, $participant, 'inCall', $flags, $session->getInCall());
+ } else {
+ $event = new ModifyParticipantEvent($room, $participant, 'inCall', $flags, $session->getInCall());
+ }
$this->dispatcher->dispatch(Room::EVENT_BEFORE_SESSION_LEAVE_CALL, $event);
}