Show name for bridged messages

Signed-off-by: Gary Kim <gary@garykim.dev>
This commit is contained in:
Gary Kim 2021-05-27 02:02:31 -04:00
Родитель a1550d1989
Коммит aaf51b70b2
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 9349B59FB54594AC
5 изменённых файлов: 9 добавлений и 1 удалений

Просмотреть файл

@ -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()];

Просмотреть файл

@ -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;

Просмотреть файл

@ -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'])) {

Просмотреть файл

@ -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;

Просмотреть файл

@ -54,6 +54,7 @@ export const ATTENDEE = {
GROUPS: 'groups',
CIRCLES: 'circles',
BOTS: 'bots',
BRIDGED: 'bridged',
},
BRIDGE_BOT_ID: 'bridge-bot',
CHANGELOG_BOT_ID: 'changelog',