From b885469c6c4884019b2f6bfd203da4ecedd8f1e0 Mon Sep 17 00:00:00 2001 From: Gary Kim Date: Thu, 27 May 2021 17:00:01 -0400 Subject: Set avatar correctly Signed-off-by: Gary Kim --- lib/Chat/MessageParser.php | 5 ++++- lib/Controller/ChatController.php | 2 +- lib/MatterbridgeManager.php | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/Chat/MessageParser.php b/lib/Chat/MessageParser.php index 008fb1746..ff944c2f4 100644 --- a/lib/Chat/MessageParser.php +++ b/lib/Chat/MessageParser.php @@ -26,6 +26,7 @@ namespace OCA\Talk\Chat; use OCA\Talk\Events\ChatMessageEvent; use OCA\Talk\Exceptions\ParticipantNotFoundException; +use OCA\Talk\MatterbridgeManager; use OCA\Talk\Model\Attendee; use OCA\Talk\Model\Message; use OCA\Talk\Participant; @@ -73,12 +74,14 @@ class MessageParser { protected function setActor(Message $message): void { $comment = $message->getComment(); + $actorId = $comment->getActorId(); $displayName = ''; if ($comment->getActorType() === Attendee::ACTOR_USERS) { $user = $this->userManager->get($comment->getActorId()); $displayName = $user instanceof IUser ? $user->getDisplayName() : $comment->getActorId(); } elseif ($comment->getActorType() === Attendee::ACTOR_BRIDGED) { $displayName = $comment->getActorId(); + $actorId = MatterbridgeManager::BRIDGE_BOT_USERID; } elseif ($comment->getActorType() === Attendee::ACTOR_GUESTS) { if (isset($guestNames[$comment->getActorId()])) { $displayName = $this->guestNames[$comment->getActorId()]; @@ -96,7 +99,7 @@ class MessageParser { $message->setActor( $comment->getActorType(), - $comment->getActorId(), + $actorId, $displayName ); } diff --git a/lib/Controller/ChatController.php b/lib/Controller/ChatController.php index a8221da78..ba0e5e60f 100644 --- a/lib/Controller/ChatController.php +++ b/lib/Controller/ChatController.php @@ -160,7 +160,7 @@ class ChatController extends AEnvironmentAwareController { if ($actorDisplayName) { $this->guestManager->updateName($this->room, $this->participant, $actorDisplayName); } - } else if ($this->userId === MatterbridgeManager::BRIDGE_BOT_USERID) { + } elseif ($this->userId === MatterbridgeManager::BRIDGE_BOT_USERID) { $actorType = Attendee::ACTOR_BRIDGED; $actorId = str_replace(["/", "\""], "", $actorDisplayName); } else { diff --git a/lib/MatterbridgeManager.php b/lib/MatterbridgeManager.php index a0cbd3528..2297e528a 100644 --- a/lib/MatterbridgeManager.php +++ b/lib/MatterbridgeManager.php @@ -395,7 +395,7 @@ class MatterbridgeManager { $content .= sprintf(' Login = "%s"', $part['login']) . "\n"; $content .= sprintf(' Password = "%s"', $part['password']) . "\n"; $content .= ' PrefixMessagesWithNick = true' . "\n"; - $content .= ' RemoteNickFormat="[{PROTOCOL}] <{NICK}>"' . "\n\n"; + $content .= ' RemoteNickFormat="[{PROTOCOL}] <{NICK}> "' . "\n\n"; } elseif ($type === 'mattermost') { // remove protocol from server URL if (preg_match('/^https?:/', $part['server'])) { -- cgit v1.2.3