Allow bouncers to set NETWORK in ISUPPORT

This allows bouncers to customize the name they appear with.
This commit is contained in:
Simon Ser 2021-10-18 19:51:30 +02:00
parent 12440691c9
commit d9f36c82ba

View file

@ -66,18 +66,23 @@ export function getMessageURL(buf, msg) {
export function getServerName(server, bouncerNetwork, isBouncer) { export function getServerName(server, bouncerNetwork, isBouncer) {
let netName = server.isupport.get("NETWORK"); let netName = server.isupport.get("NETWORK");
if (bouncerNetwork) { if (bouncerNetwork && bouncerNetwork.name && bouncerNetwork.name !== bouncerNetwork.host) {
if (bouncerNetwork.name && bouncerNetwork.name !== bouncerNetwork.host) { // User has picked a custom name for the network, use that
// User has picked a custom name for the network, use that return bouncerNetwork.name;
return bouncerNetwork.name;
}
return netName || bouncerNetwork.name || bouncerNetwork.host || "server";
}
if (isBouncer) {
return "bouncer";
} }
return netName || "server"; if (netName) {
// Server has specified a name
return netName;
}
if (bouncerNetwork) {
return bouncerNetwork.name || bouncerNetwork.host || "server";
} else if (isBouncer) {
return "bouncer";
} else {
return "server";
}
} }
function updateState(state, updater) { function updateState(state, updater) {