diff options
author | Gary Kim <gary@garykim.dev> | 2021-05-28 00:00:01 +0300 |
---|---|---|
committer | Gary Kim <gary@garykim.dev> | 2021-07-14 20:44:31 +0300 |
commit | b885469c6c4884019b2f6bfd203da4ecedd8f1e0 (patch) | |
tree | dc9de3c61c23811cdb0bafe8e54df5567dd60173 /lib | |
parent | aaf51b70b28100a2b34caa7ec827e494cd44dff2 (diff) |
Set avatar correctly
Signed-off-by: Gary Kim <gary@garykim.dev>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Chat/MessageParser.php | 5 | ||||
-rw-r--r-- | lib/Controller/ChatController.php | 2 | ||||
-rw-r--r-- | lib/MatterbridgeManager.php | 2 |
3 files changed, 6 insertions, 3 deletions
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'])) { |