From 2e66dfb96bbd748746b61fa4dca64842ae42e85f Mon Sep 17 00:00:00 2001
From: cyan <>
Date: Thu, 16 Oct 2003 07:46:29 +0000
Subject: [PATCH] * 382 numeric was sending an extra argument (oops) * Added
 support for /REHASH arguments: GC, TKLINES, AKILLS will force a JS   garbage
 collection, clearing of temporary K:Lines, and services-enabled   autokills
 respectively.  These are per Bahamut 1.4.35.

---
 exec/ircd.js | 51 ++++++++++++++++++++++++++++++++++++++++-----------
 1 file changed, 40 insertions(+), 11 deletions(-)

diff --git a/exec/ircd.js b/exec/ircd.js
index e0f9c11556..a27f2818cb 100644
--- a/exec/ircd.js
+++ b/exec/ircd.js
@@ -1149,6 +1149,7 @@ function IRCClient(socket,new_id,local_client,do_newconn) {
 	this.numeric351=IRCClient_numeric351;
 	this.numeric352=IRCClient_numeric352;
 	this.numeric353=IRCClient_numeric353;
+	this.numeric382=IRCClient_numeric382;
 	this.numeric391=IRCClient_numeric391;
 	this.numeric401=IRCClient_numeric401;
 	this.numeric402=IRCClient_numeric402;
@@ -1679,6 +1680,10 @@ function IRCClient_numeric353(chan, str) {
 	this.numeric("353", ctype_str + " " + Channels[chan].nam + " :" + str);
 }
 
+function IRCClient_numeric382(str) {
+	this.numeric(382, "ircd.conf :" + str);
+}
+
 function IRCClient_numeric391() {
 	this.numeric(391, servername + " :" + strftime("%A %B %d %Y -- %H:%M %z",time()));
 }
@@ -2717,12 +2722,10 @@ function IRCClient_do_complex_who(cmd) {
 			else if ((who.del_flags&WHO_IP) &&
 			    match_irc_mask(wc.ip,who.IP))
 				continue;
-			log("----mark : " + wc.nick);
 			if (who.add_flags&WHO_UMODE) { // no -m
 				var sic = false;
 				var madd = true;
 				for (mm in who.UMode) {
-					log("XXX switch: " + who.UMode[mm]);
 					switch(who.UMode[mm]) {
 						case "+":
 							if (!madd)
@@ -2812,8 +2815,6 @@ function IRCClient_do_complex_who(cmd) {
 			if (whomask && !wc.match_who_mask(whomask))
 				continue;       
 
-			log("---mark: " + wc.nick);
-
 			chan = "";
 			if ((who.add_flags&WHO_FIRST_CHANNEL) && !who.Channel) {
 				for (x in wc.channels) {
@@ -2832,8 +2833,6 @@ function IRCClient_do_complex_who(cmd) {
 				}
 			}
 
-			log("--mark: " + wc.nick);
-
 			if (who.Channel)
 				chan = who.Channel;
 
@@ -4712,11 +4711,41 @@ function IRCClient_registered_commands(command, cmdline) {
 				this.numeric481();
 				break;
 			}
-			this.numeric(382, this.nick + " ircd.conf :Rehashing.");
-			umode_notice(USERMODE_SERVER,"Notice",this.nick +
-				" is rehashing Server config file while " +
-				"whistling innocently");
-			read_config_file();
+			if (cmd[1]) {
+				switch(cmd[1].toUpperCase()) {
+					case "TKLINES":
+						this.numeric382("temp klines");
+						for (kl in KLines) {
+							if(KLines[kl].type ==
+							   "k")
+								delete KLines[kl];
+						}
+						break;
+					case "GC":
+						if (js.gc!=undefined) {
+							this.numeric382("garbage collecting");
+							js.gc();
+						}
+						break;
+					case "AKILLS":
+						this.numeric382("akills");
+						for (kl in KLines) {
+							if(KLines[kl].type ==
+							   "A")
+								delete KLines[kl
+];
+						}
+						break;
+					default:
+						break;
+				}
+			} else {
+				this.numeric382("Rehashing.");
+				umode_notice(USERMODE_SERVER,"Notice",this.nick +
+					" is rehashing Server config file while " +
+					"whistling innocently");
+				read_config_file();
+			}
 			break;
 		case "RESTART":
 			if (!((this.mode&USERMODE_OPER) &&
-- 
GitLab