Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/Activity/Listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ public function handle(Event $event): void {
}

protected function setActive(ParticipantModifiedEvent $event): void {
if ($event->getRoom()->getToken() === 'c9bui2ju') {
\OC::$server->getLogger()->warning('Debugging step #8: ' . microtime(true));
}
if ($event->getProperty() !== AParticipantModifiedEvent::PROPERTY_IN_CALL) {
return;
}
Expand All @@ -82,14 +85,16 @@ protected function setActive(ParticipantModifiedEvent $event): void {
|| $event->getNewValue() === Participant::FLAG_DISCONNECTED) {
return;
}

$participant = $event->getParticipant();
$this->roomService->setActiveSince(
$event->getRoom(),
$this->timeFactory->getDateTime(),
$participant->getSession() ? $participant->getSession()->getInCall() : Participant::FLAG_DISCONNECTED,
$participant->getAttendee()->getActorType() !== Attendee::ACTOR_USERS
);
if ($event->getRoom()->getToken() === 'c9bui2ju') {
\OC::$server->getLogger()->warning('Debugging step #9: ' . microtime(true));
}
}

protected function handleParticipantModified(ParticipantModifiedEvent $event): void {
Expand Down
11 changes: 9 additions & 2 deletions lib/Controller/CallController.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ public function getPeersForCall(): DataResponse {
#[RequireParticipant]
#[RequireReadWriteConversation]
public function joinCall(?int $flags = null, ?int $forcePermissions = null, bool $silent = false, bool $recordingConsent = false): DataResponse {
if ($this->room->getToken() === 'c9bui2ju') {
\OC::$server->getLogger()->warning('Debugging step #0: ' . microtime(true));
}
if (!$recordingConsent && $this->talkConfig->recordingConsentRequired() !== RecordingService::CONSENT_REQUIRED_NO) {
if ($this->talkConfig->recordingConsentRequired() === RecordingService::CONSENT_REQUIRED_YES) {
return new DataResponse(['error' => 'consent'], Http::STATUS_BAD_REQUEST);
Expand Down Expand Up @@ -169,9 +172,13 @@ public function joinCall(?int $flags = null, ?int $forcePermissions = null, bool
if ($forcePermissions !== null && $this->participant->hasModeratorPermissions()) {
$this->roomService->setPermissions($this->room, 'call', Attendee::PERMISSIONS_MODIFY_SET, $forcePermissions, true);
}

if ($this->room->getToken() === 'c9bui2ju') {
\OC::$server->getLogger()->warning('Debugging step #1: ' . microtime(true));
}
$joined = $this->participantService->changeInCall($this->room, $this->participant, $flags, false, $silent);

if ($this->room->getToken() === 'c9bui2ju') {
\OC::$server->getLogger()->warning('Debugging step #2: ' . microtime(true));
}
if (!$joined) {
return new DataResponse([], Http::STATUS_BAD_REQUEST);
}
Expand Down
6 changes: 6 additions & 0 deletions lib/Listener/RestrictStartingCalls.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ public function handle(Event $event): void {
if (!$event instanceof BeforeParticipantModifiedEvent) {
return;
}
if ($event->getRoom()->getToken() === 'c9bui2ju') {
\OC::$server->getLogger()->warning('Debugging step #10: ' . microtime(true));
}

if ($event->getProperty() !== AParticipantModifiedEvent::PROPERTY_IN_CALL) {
return;
Expand All @@ -74,5 +77,8 @@ public function handle(Event $event): void {
&& !$this->participantService->hasActiveSessionsInCall($room)) {
throw new ForbiddenException('Can not start a call');
}
if ($event->getRoom()->getToken() === 'c9bui2ju') {
\OC::$server->getLogger()->warning('Debugging step #11: ' . microtime(true));
}
}
}
9 changes: 9 additions & 0 deletions lib/Notification/Listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,19 @@ protected function afterParticipantJoinedCall(ParticipantModifiedEvent $event):
return;
}

if ($event->getRoom()->getToken() === 'c9bui2ju') {
\OC::$server->getLogger()->warning('Debugging step #12: ' . microtime(true));
}
$this->markCallNotificationsRead($event->getRoom());
if ($event->getRoom()->getToken() === 'c9bui2ju') {
\OC::$server->getLogger()->warning('Debugging step #13: ' . microtime(true));
}
if ($this->shouldSendCallNotification) {
$this->sendCallNotifications($event->getRoom());
}
if ($event->getRoom()->getToken() === 'c9bui2ju') {
\OC::$server->getLogger()->warning('Debugging step #14: ' . microtime(true));
}
}

/**
Expand Down
24 changes: 21 additions & 3 deletions lib/Service/ParticipantService.php
Original file line number Diff line number Diff line change
Expand Up @@ -1155,6 +1155,9 @@ public function endCallForEveryone(Room $room, Participant $moderator): void {
}

public function changeInCall(Room $room, Participant $participant, int $flags, bool $endCallForEveryone = false, bool $silent = false): bool {
if ($room->getToken() === 'c9bui2ju') {
\OC::$server->getLogger()->warning('Debugging step #3: ' . microtime(true));
}
if ($room->getType() === Room::TYPE_CHANGELOG
|| $room->getType() === Room::TYPE_ONE_TO_ONE_FORMER
|| $room->getType() === Room::TYPE_NOTE_TO_SELF) {
Expand All @@ -1177,6 +1180,9 @@ public function changeInCall(Room $room, Participant $participant, int $flags, b
$oldFlags = $session->getInCall();
$details = [];

if ($room->getToken() === 'c9bui2ju') {
\OC::$server->getLogger()->warning('Debugging step #4: ' . microtime(true));
}
if ($flags !== Participant::FLAG_DISCONNECTED) {
if ($silent) {
$legacyEvent = new SilentModifyParticipantEvent($room, $participant, 'inCall', $flags, $session->getInCall());
Expand All @@ -1194,10 +1200,14 @@ public function changeInCall(Room $room, Participant $participant, int $flags, b
}
$this->dispatcher->dispatch(Room::EVENT_BEFORE_SESSION_LEAVE_CALL, $legacyEvent);
}

if ($room->getToken() === 'c9bui2ju') {
\OC::$server->getLogger()->warning('Debugging step #4.1: ' . microtime(true));
}
$event = new BeforeParticipantModifiedEvent($room, $participant, AParticipantModifiedEvent::PROPERTY_IN_CALL, $flags, $oldFlags, $details);
$this->dispatcher->dispatchTyped($event);

if ($room->getToken() === 'c9bui2ju') {
\OC::$server->getLogger()->warning('Debugging step #5: ' . microtime(true));
}
$session->setInCall($flags);
if (!$endCallForEveryone) {
$this->sessionMapper->update($session);
Expand All @@ -1211,14 +1221,22 @@ public function changeInCall(Room $room, Participant $participant, int $flags, b
$attendee->setCallId('');
$this->attendeeMapper->update($attendee);
}

if ($room->getToken() === 'c9bui2ju') {
\OC::$server->getLogger()->warning('Debugging step #6: ' . microtime(true));
}
if ($flags !== Participant::FLAG_DISCONNECTED) {
$this->dispatcher->dispatch(Room::EVENT_AFTER_SESSION_JOIN_CALL, $legacyEvent);
} else {
$this->dispatcher->dispatch(Room::EVENT_AFTER_SESSION_LEAVE_CALL, $legacyEvent);
}
if ($room->getToken() === 'c9bui2ju') {
\OC::$server->getLogger()->warning('Debugging step #6.1: ' . microtime(true));
}
$event = new ParticipantModifiedEvent($room, $participant, AParticipantModifiedEvent::PROPERTY_IN_CALL, $flags, $oldFlags, $details);
$this->dispatcher->dispatchTyped($event);
if ($room->getToken() === 'c9bui2ju') {
\OC::$server->getLogger()->warning('Debugging step #7: ' . microtime(true));
}

return true;
}
Expand Down