summaryrefslogtreecommitdiffstats
path: root/lib/Federation/BackendNotifier.php
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2024-02-27 14:40:34 +0100
committerJoas Schilling <coding@schilljs.com>2024-02-28 09:31:54 +0100
commit1105928de47ea2d1594250d7c3827fec7a91c494 (patch)
treef53f4686edcab35d36b722085ed2a958ae81819f /lib/Federation/BackendNotifier.php
parentdd294f2dc2ca31884fe483d3a2f16868c29e2c39 (diff)
feat(federation): Start proxying chat message events so the remotes can do things
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Federation/BackendNotifier.php')
-rw-r--r--lib/Federation/BackendNotifier.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/Federation/BackendNotifier.php b/lib/Federation/BackendNotifier.php
index 1fad3fbd1..487722c90 100644
--- a/lib/Federation/BackendNotifier.php
+++ b/lib/Federation/BackendNotifier.php
@@ -276,6 +276,36 @@ class BackendNotifier {
}
/**
+ * Send information to remote participants that a message was posted
+ * Sent from Host server to Remote participant server
+ */
+ public function sendMessageUpdate(
+ string $remoteServer,
+ int $localAttendeeId,
+ #[SensitiveParameter]
+ string $accessToken,
+ string $localToken,
+ array $messageData,
+ ): void {
+ $remote = $this->prepareRemoteUrl($remoteServer);
+
+ $notification = $this->cloudFederationFactory->getCloudFederationNotification();
+ $notification->setMessage(
+ FederationManager::NOTIFICATION_MESSAGE_POSTED,
+ FederationManager::TALK_ROOM_RESOURCE,
+ (string) $localAttendeeId,
+ [
+ 'remoteServerUrl' => $this->getServerRemoteUrl(),
+ 'sharedSecret' => $accessToken,
+ 'remoteToken' => $localToken,
+ 'messageData' => $messageData,
+ ],
+ );
+
+ $this->sendUpdateToRemote($remote, $notification);
+ }
+
+ /**
* @param string $remote
* @param array{notificationType: string, resourceType: string, providerId: string, notification: array} $data
* @param int $try