From d2c645fae082b66efd11bbb94df9cd58f9ab202a Mon Sep 17 00:00:00 2001
From: cyan <>
Date: Mon, 22 Sep 2003 02:56:39 +0000
Subject: [PATCH] * Correct a bug involving a 'break' instead of 'continue' in
 SJOIN. * Ignore a SJOIN for a nick if the nick is already on the channel.

---
 exec/ircd.js | 25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/exec/ircd.js b/exec/ircd.js
index 3b92d17e33..3c5cb6b081 100644
--- a/exec/ircd.js
+++ b/exec/ircd.js
@@ -273,6 +273,8 @@ function IRCClient_searchbyiline() {
 // used to fetch 'strings' from all sorts of commands.  PRIVMSG, NOTICE,
 // USER, PING, etc.
 function ircstring(str,startword) {
+	var cindex;
+
 	if (startword) {
 		for(sw_counter=0;sw_counter<startword;sw_counter++) {
 			str=str.slice(str.indexOf(" ")+1);
@@ -632,7 +634,8 @@ function IRCClient_tweaktmpmodelist(tmp_cl,tmp_ncl,chan) {
 }
 
 function count_channels() {
-	tmp_counter=0;
+	var tmp_counter = 0;
+
 	for (tmp_count in Channels) {
 		if (Channels[tmp_count])
 			tmp_counter++;
@@ -641,6 +644,8 @@ function count_channels() {
 }
 
 function count_servers(count_all) {
+	var tmp_counter;
+
 	if (count_all)
 		tmp_counter=1; // we start by counting ourself.
 	else
@@ -656,9 +661,10 @@ function count_servers(count_all) {
 }
 
 function count_nicks(count_bit) {
+	var tmp_counter = 0;
+
 	if(!count_bit)
 		count_bit=USERMODE_NONE;
-	tmp_counter=0;
 	for (tmp_count in Clients) {
 		if ((Clients[tmp_count] != undefined) && 
 		    ((Clients[tmp_count].conntype == TYPE_USER) ||
@@ -673,7 +679,8 @@ function count_nicks(count_bit) {
 }
 
 function count_local_nicks() {
-	tmp_counter=0;
+	var tmp_counter = 0;
+
 	for (tmp_count in Clients) {
 		if ((Clients[tmp_count] != undefined) &&
 		    !Clients[tmp_count].parent)
@@ -3756,6 +3763,9 @@ function IRCClient_server_commands(origin, command, cmdline) {
 			nickid.invited=chanid.nam.toUpperCase();
 			break;
 		case "KICK":
+			var chanid;
+			var nickid;
+
 			if (!cmd[2])
 				break;
 			chanid = searchbychannel(cmd[1]);
@@ -3865,7 +3875,11 @@ function IRCClient_server_commands(origin, command, cmdline) {
 					}
 					var member_obj = searchbynick(chan_members[member]);
 					if (!member_obj)
-						break;
+						continue;
+
+					if (member_obj.onchannel(chan.nam.toUpperCase()))
+						continue;
+
 					member_obj.channels.push(chan.nam.toUpperCase());
 					chan.users.push(member_obj.id);
 					member_obj.bcast_to_channel(chan.nam, "JOIN " + chan.nam, false);
@@ -3908,6 +3922,9 @@ function IRCClient_server_commands(origin, command, cmdline) {
 
 				this.bcast_to_servers_raw(":" + ThisOrigin.nick + " SJOIN " + chan.created + " " + chan.nam + " " + chan.chanmode(true) + " :" + new_chan_members)
 			} else {
+				if (ThisOrigin.onchannel(chan.nam.toUpperCase()))
+					break;
+
 				ThisOrigin.channels.push(chan.nam.toUpperCase());
 				chan.users.push(ThisOrigin.id);
 				ThisOrigin.bcast_to_channel(chan.nam, "JOIN " + chan.nam, false);
-- 
GitLab