if client = webtv, use PRIVMSG instead of NOTICE from servers

This commit is contained in:
zefie
2025-06-17 13:17:08 -04:00
parent 363f4f94b4
commit 08f528fe4b

View File

@@ -182,6 +182,7 @@ class WTVIRC {
secureSocket.isserver = false; secureSocket.isserver = false;
secureSocket.is_srv_authorized = false; secureSocket.is_srv_authorized = false;
secureSocket.signedoff = false; secureSocket.signedoff = false;
secureSocket.client_version = '';
secureSocket.realhost = socket.remoteAddress secureSocket.realhost = socket.remoteAddress
secureSocket.host = this.filterHostname(secureSocket, socket.remoteAddress); secureSocket.host = this.filterHostname(secureSocket, socket.remoteAddress);
this.getHostname(secureSocket, (hostname) => { this.getHostname(secureSocket, (hostname) => {
@@ -228,6 +229,7 @@ class WTVIRC {
socket.is_srv_authorized = false; socket.is_srv_authorized = false;
socket.signedoff = false; socket.signedoff = false;
socket.realhost = socket.remoteAddress; socket.realhost = socket.remoteAddress;
socket.client_version = '';
socket.host = this.filterHostname(socket, socket.remoteAddress); socket.host = this.filterHostname(socket, socket.remoteAddress);
this.getHostname(socket, (hostname) => { this.getHostname(socket, (hostname) => {
socket.realhost = hostname; socket.realhost = hostname;
@@ -1065,6 +1067,9 @@ class WTVIRC {
if (message.startsWith(':')) { if (message.startsWith(':')) {
message = message.slice(1); // Remove leading ':' message = message.slice(1); // Remove leading ':'
} }
if (this.clientIsWebTV(targetSocket)) {
srvCommand = 'PRIVMSG';
}
await this.sendThrottled(targetSocket, [`:${sourceNickname}!${sourceUsername}@${sourceSocket.host} ${srvCommand} ${targetNickname} :${message}`], 30); await this.sendThrottled(targetSocket, [`:${sourceNickname}!${sourceUsername}@${sourceSocket.host} ${srvCommand} ${targetNickname} :${message}`], 30);
this.broadcastToAllServers(`:${sourceUniqueId} ${srvCommand} ${targetUniqueId} :${message}\r\n`, socket); this.broadcastToAllServers(`:${sourceUniqueId} ${srvCommand} ${targetUniqueId} :${message}\r\n`, socket);
break; break;
@@ -2330,6 +2335,14 @@ class WTVIRC {
} }
for (const t of targets) { for (const t of targets) {
let isChan = false; let isChan = false;
if (t === this.servername) {
// client responding to a system message
var msg = line.slice(line.indexOf(':', 1) + 1);
if (msg.startsWith('\x01VERSION')) {
socket.client_version = msg.replace('\x01VERSION ', '').replace('\x01', '');
break;
}
}
for (const prefix of this.channelprefixes) { for (const prefix of this.channelprefixes) {
if (t.startsWith(prefix)) { if (t.startsWith(prefix)) {
isChan = true; isChan = true;
@@ -3894,6 +3907,13 @@ class WTVIRC {
return null; return null;
} }
clientIsWebTV(socket) {
if (socket.client_version.includes('WebTV')) {
return true;
}
return false;
}
doLogin(nickname, socket) { doLogin(nickname, socket) {
for (const [srvSocket, serverName] of this.servers.entries()) { for (const [srvSocket, serverName] of this.servers.entries()) {
@@ -4007,6 +4027,7 @@ class WTVIRC {
} }
socket.write(`:${this.servername} 396 ${nickname} ${socket.host} :is now your visible host\r\n`); socket.write(`:${this.servername} 396 ${nickname} ${socket.host} :is now your visible host\r\n`);
}); });
socket.write(`:${this.servername} PRIVMSG ${socket.nickname} :\x01VERSION\x01\r\n`);
} }
} }