mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-11-05 01:23:24 -08:00
[Servatrice] Relay room channel messages over ISL (#7480)
* [Servatrice] Relay room channel messages over ISL * [Servatrice] Skip audit log for unknown ISL channel per review - externalRoomSay drops messages for channels not in the local catalog, matching Server_Room::say, instead of logging what was never delivered --------- Co-authored-by: Lukas Brübach <Bruebach.Lukas@bdosecurity.de>
This commit is contained in:
parent
ce51e7147d
commit
155f7b0143
5 changed files with 34 additions and 9 deletions
|
|
@ -441,7 +441,7 @@ void Server::externalRoomUserLeft(int roomId, const QString &userName)
|
|||
room->removeExternalUser(userName);
|
||||
}
|
||||
|
||||
void Server::externalRoomSay(int roomId, const QString &userName, const QString &message)
|
||||
void Server::externalRoomSay(int roomId, const QString &userName, const QString &message, const QString &channelId)
|
||||
{
|
||||
// This function is always called from the main thread via signal/slot.
|
||||
QReadLocker locker(&roomsLock);
|
||||
|
|
@ -451,10 +451,22 @@ void Server::externalRoomSay(int roomId, const QString &userName, const QString
|
|||
qDebug() << "externalRoomSay: room id=" << roomId << "not found";
|
||||
return;
|
||||
}
|
||||
room->say(userName, message, QString(), false);
|
||||
if (!channelId.isEmpty() && !Server_Room::isMainChannel(channelId) && room->findChannel(channelId) == nullptr) {
|
||||
// The receiver does not know this channel; say() would drop it, so do
|
||||
// not log what was never delivered.
|
||||
qDebug() << "externalRoomSay: unknown channel" << channelId << "for room id=" << roomId << "dropping";
|
||||
return;
|
||||
}
|
||||
room->say(userName, message, channelId, false);
|
||||
|
||||
getDatabaseInterface()->logMessage(0, userName, "ISL", message, Server_DatabaseInterface::MessageTargetIslRoom,
|
||||
room->getId(), room->getName());
|
||||
if (channelId.isEmpty()) {
|
||||
getDatabaseInterface()->logMessage(0, userName, "ISL", message, Server_DatabaseInterface::MessageTargetIslRoom,
|
||||
room->getId(), room->getName());
|
||||
} else {
|
||||
getDatabaseInterface()->logMessage(0, userName, "ISL", message,
|
||||
Server_DatabaseInterface::MessageTargetRoomChannel, room->getId(),
|
||||
room->getName(), channelId);
|
||||
}
|
||||
}
|
||||
|
||||
void Server::externalRoomRemoveMessages(int roomId, const QString &userName, int amount)
|
||||
|
|
|
|||
|
|
@ -265,7 +265,7 @@ protected slots:
|
|||
void externalUserLeft(const QString &userName);
|
||||
void externalRoomUserJoined(int roomId, const ServerInfo_User &userInfo);
|
||||
void externalRoomUserLeft(int roomId, const QString &userName);
|
||||
void externalRoomSay(int roomId, const QString &userName, const QString &message);
|
||||
void externalRoomSay(int roomId, const QString &userName, const QString &message, const QString &channelId);
|
||||
void externalRoomRemoveMessages(int roomId, const QString &userName, int amount);
|
||||
void externalRoomGameListChanged(int roomId, const ServerInfo_Game &gameInfo);
|
||||
void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue