From 7ea5ababe91f9140526c98321e048464211f32ed Mon Sep 17 00:00:00 2001 From: ChocoTaco Date: Sat, 24 Dec 2022 14:12:19 -0500 Subject: [PATCH] Persistent gag --- Classic/scripts/autoexec/dtBanSystem.cs | 27 +++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/Classic/scripts/autoexec/dtBanSystem.cs b/Classic/scripts/autoexec/dtBanSystem.cs index 3bf4e51..8715948 100644 --- a/Classic/scripts/autoexec/dtBanSystem.cs +++ b/Classic/scripts/autoexec/dtBanSystem.cs @@ -17,6 +17,33 @@ package dtBan { + +//Keep track of gags (Disconnecting and Reconnecting) +function GameConnection::onDrop(%client, %reason) +{ + %ip = %client.getAddress(); + %ip = getSubStr(%ip, 3, strLen(%ip)); + %ip = getSubStr(%ip, 0, strstr(%ip, ":")); + %ip = strReplace(%ip, ".", "_"); + + $chatGagged[%ip] = $chatGagged[%client.guid] = (%client.isGagged == 1); //save status of this + + parent::onDrop(%client, %reason); +} + +//Reapply the gag +function GameConnection::onConnect( %client, %name, %raceGender, %skin, %voice, %voicePitch ) +{ + parent::onConnect( %client, %name, %raceGender, %skin, %voice, %voicePitch ); + + %ip = %client.getAddress(); + %ip = getSubStr(%ip, 3, strLen(%ip)); + %ip = getSubStr(%ip, 0, strstr(%ip, ":")); + %ip = strReplace(%ip, ".", "_"); + + %client.isGagged = ($chatGagged[%ip] || $chatGagged[%client.guid]); //restore status +} + function ClassicLoadBanlist() { $ClassicPermaBans = 0;