diff options
author | Gary Kim <gary@garykim.dev> | 2021-05-27 09:02:31 +0300 |
---|---|---|
committer | Gary Kim <gary@garykim.dev> | 2021-07-14 20:44:27 +0300 |
commit | aaf51b70b28100a2b34caa7ec827e494cd44dff2 (patch) | |
tree | d031ad06aeeac5a0c2904718547cc7cef67826a7 /lib | |
parent | a1550d198964f79119acd065793eac15f29e6878 (diff) |
Show name for bridged messages
Signed-off-by: Gary Kim <gary@garykim.dev>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Chat/MessageParser.php | 2 | ||||
-rw-r--r-- | lib/Controller/ChatController.php | 3 | ||||
-rw-r--r-- | lib/MatterbridgeManager.php | 3 | ||||
-rw-r--r-- | lib/Model/Attendee.php | 1 |
4 files changed, 8 insertions, 1 deletions
diff --git a/lib/Chat/MessageParser.php b/lib/Chat/MessageParser.php index b29c54f5b..008fb1746 100644 --- a/lib/Chat/MessageParser.php +++ b/lib/Chat/MessageParser.php @@ -77,6 +77,8 @@ class MessageParser { 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(); } elseif ($comment->getActorType() === Attendee::ACTOR_GUESTS) { if (isset($guestNames[$comment->getActorId()])) { $displayName = $this->guestNames[$comment->getActorId()]; diff --git a/lib/Controller/ChatController.php b/lib/Controller/ChatController.php index af9e13b31..a8221da78 100644 --- a/lib/Controller/ChatController.php +++ b/lib/Controller/ChatController.php @@ -160,6 +160,9 @@ class ChatController extends AEnvironmentAwareController { if ($actorDisplayName) { $this->guestManager->updateName($this->room, $this->participant, $actorDisplayName); } + } else if ($this->userId === MatterbridgeManager::BRIDGE_BOT_USERID) { + $actorType = Attendee::ACTOR_BRIDGED; + $actorId = str_replace(["/", "\""], "", $actorDisplayName); } else { $actorType = Attendee::ACTOR_USERS; $actorId = $this->userId; diff --git a/lib/MatterbridgeManager.php b/lib/MatterbridgeManager.php index 2c48b5aaf..a0cbd3528 100644 --- a/lib/MatterbridgeManager.php +++ b/lib/MatterbridgeManager.php @@ -387,6 +387,7 @@ class MatterbridgeManager { $serverUrl = $part['server']; } else { $serverUrl = preg_replace('/\/+$/', '', $this->urlGenerator->getAbsoluteURL('')); + $content .= " SeparateDisplayName = true" ."\n"; // TODO remove that //$serverUrl = preg_replace('/https:/', 'http:', $serverUrl); } @@ -394,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'])) { diff --git a/lib/Model/Attendee.php b/lib/Model/Attendee.php index 5a758d4ae..6f7b083a5 100644 --- a/lib/Model/Attendee.php +++ b/lib/Model/Attendee.php @@ -58,6 +58,7 @@ class Attendee extends Entity { public const ACTOR_GUESTS = 'guests'; public const ACTOR_EMAILS = 'emails'; public const ACTOR_CIRCLES = 'circles'; + public const ACTOR_BRIDGED = 'bridged'; public const PUBLISHING_PERMISSIONS_NONE = 0; public const PUBLISHING_PERMISSIONS_AUDIO = 1; |