From 15210e1f7c7d0bf7441b1bfc21b2a98ae1e39f17 Mon Sep 17 00:00:00 2001
From: cyan <>
Date: Thu, 4 Dec 2003 11:59:28 +0000
Subject: [PATCH] More various fixes..

---
 exec/ircd.js             | 28 ++++++++++++++++++++--------
 exec/load/ircd_server.js |  7 ++++---
 2 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/exec/ircd.js b/exec/ircd.js
index 6188e462a8..df41b107aa 100644
--- a/exec/ircd.js
+++ b/exec/ircd.js
@@ -823,9 +823,17 @@ function IRCClient_netsplit(ns_reason) {
 	if (!ns_reason)
 		ns_reason = "net.split.net.split net.split.net.split";
 	for (sqclient in Users) {
-		if (Users[sqclient].servername == this.nick)
+		if (Users[sqclient] &&
+		    (Users[sqclient].servername == this.nick)
+		   )
 			Users[sqclient].quit(ns_reason,true,true);
 	}
+	for (sqserver in Servers) {
+		if (Servers[sqserver] &&
+		    (Servers[sqserver].linkparent == this.nick)
+		   )
+			Servers[sqserver].quit(ns_reason,true,true);
+	}
 }
 
 function IRCClient_RMChan(rmchan_obj) {
@@ -896,12 +904,15 @@ function originatorout(str,origin) {
 
 	sendsock = this.socket;
 	if(this.local && !this.server) {
-		send_data = ":" + origin.nuh + " " + str;
-	} else if (this.parent) {
-		sendsock = Servers[this.parent].socket;
-		send_data = ":" + origin.nick + " " + str;
+		if (origin.server)
+			send_data = ":" + origin.nick + " " + str;
+		else
+			send_data = ":" + origin.nuh + " " + str;
 	} else if (this.server) {
 		send_data = ":" + origin.nick + " " + str;
+	} else if (!this.local) {
+		sendsock = Servers[this.parent].socket;
+		send_data = ":" + origin.nick + " " + str;
 	} else {
 		log("!ERROR: No socket to send to?");
 		return 0;
@@ -1233,7 +1244,8 @@ function IRCClient_bcast_to_list(chan, str, bounce, list_bit) {
 function IRCClient_bcast_to_channel(chan, str, bounce) {
 	for(thisUser in chan.users) {
 		var aUser=chan.users[thisUser];
-		if ( ( aUser.id != this.id || (bounce) ) && aUser.local )
+		if ( ( aUser.id != this.id || (bounce) ) &&
+		     aUser.local )
 			aUser.originatorout(str,this);
 	}
 }
@@ -1511,8 +1523,8 @@ function IRCClient_do_info() {
 	this.numeric(371, ":   Palom, Psyko, Torke, and all the #square oldbies.");
 	this.numeric(371, ":--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--");
 	this.numeric(371, ":Synchronet " + system.full_version);
-	this.numeric(371, ":Running on " + system.os_version);
 	this.numeric(371, ":Compiled with " + system.compiled_with + " at " + system.compiled_when);
+	this.numeric(371, ":Running on " + system.os_version);
 	this.numeric(371, ":Utilizing socket library: " + system.socket_lib);
 	this.numeric(371, ":Javascript library: " + system.js_version);
 	this.numeric(371, ":This BBS has been up since " + system.timestr(system.uptime));
@@ -1522,7 +1534,7 @@ function IRCClient_do_info() {
 		this.numeric(371, ":" + server.version_detail);
 	}
 	this.numeric(371, ":IRCd CVS revisions:")
-	this.numeric(371, ":Main: " + MAIN_REVISION + " User: " + USER_REVISION + " Channel: " + CHANNEL_REVISION + " Server: " + SERVER_REVISION + " Unreg: " + UNREG_REVISION);
+	this.numeric(371, ":Main(" + MAIN_REVISION + ") User(" + USER_REVISION + ") Channel(" + CHANNEL_REVISION + ") Server(" + SERVER_REVISION + ") Unreg(" + UNREG_REVISION + ")");
 	this.numeric(371, ":IRClib Version: " + IRCLIB_VERSION);
 	this.numeric(371, ":--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--");
 	this.numeric(371, ":This program is distributed under the terms of the GNU General Public");
diff --git a/exec/load/ircd_server.js b/exec/load/ircd_server.js
index b38abd5e29..b09194759f 100644
--- a/exec/load/ircd_server.js
+++ b/exec/load/ircd_server.js
@@ -1005,10 +1005,10 @@ function Server_Quit(str,suppress_bcast,is_netsplit,origin) {
 		this.netsplit();
 	}
 
-	if((server.client_remove!=undefined) && this.local)
-		server.client_remove(this.socket);
-
 	if (this.local) {
+		if (server.client_remove!=undefined)
+			server.client_remove(this.socket);
+
 		this.rawout("ERROR :Closing Link: [" + this.uprefix + "@" + this.hostname + "] (" + str + ")");
 		// FIXME: wrong phrasing below
 		umode_notice(USERMODE_CLIENT,"Client","SERVER exiting: " +
@@ -1106,3 +1106,4 @@ function IRCClient_server_chan_info(sni_chan) {
 	if (modeargs)
 		this.ircout("MODE " + sni_chan.nam + " " + modestr + " " + modeargs);
 }
+
-- 
GitLab