rem: chan.topictime = cmd[2]; chan.topicchangedby = cmd[1]; 
add: chan.topictime = cmd[3]; chan.topicchangedby = cmd[2]; 
context: function IRCClient_server_commands(origin, command, cmdline) {	ThisOrigin = searchbynick(origin);	if (!ThisOrigin)		ThisOrigin = searchbyserver(origin);	if (!ThisOrigin)		ThisOrigin = this;	cmd=cmdline.split(' ');	switch(command) {		case "GNOTICE":		case "GLOBOPS":		case "WALLOPS":			if (!cmd[1])				break;			str = ":" + origin + " WALLOPS :" + ircstring(cmdline);			wallopers(str);			this.bcast_to_servers(str);			break;		case "AWAY":			if (!cmd[1])				ThisOrigin.away = "";			else				ThisOrigin.away = ircstring(cmdline);			break;		case "ERROR":			server_wallops("ERROR from " + ThisOrigin.nick + ": " + ircstring(cmdline));			ThisOrigin.quit();			break;		case "KICK":			if (!cmd[2])				break;			chanid = searchbychannel(cmd[1]);			if (!chanid)				break;			nickid = searchbynick(cmd[2]);			if (!nickid)				break;			if (!nickid.onchannel(chanid.nam.toUpperCase()))				break;			if (cmd[3])				kick_reason = ircstring(cmdline).slice(0,max_kicklen);			else				kick_reason = ThisOrigin.nick;			str = "KICK " + chanid.nam + " " + nickid.nick + " :" + kick_reason;			ThisOrigin.bcast_to_channel(chanid.nam, str, false);			this.bcast_to_servers_raw(":" + ThisOrigin.nick + " " + str);			nickid.rmchan(Channels[chanid.nam.toUpperCase()]);			break;		case "JOIN":			if (!cmd[1])				break;			if (cmd[1][0] == ":")				cmd[1]=cmd[1].slice(1);			the_channels = cmd[1].split(",");			for (jchan in the_channels) {				if (the_channels[jchan][0] != "#")					break;				ThisOrigin.do_join(the_channels[jchan].slice(0,max_chanlen),"");			}			break;		case "SJOIN":			if (!cmd[2])				break;			if (cmd[2][0] != "#")				break;			chan = searchbychannel(cmd[2]);			if (!chan) {				cn_tuc = cmd[2].toUpperCase();				Channels[cn_tuc]=new Channel(cn_tuc);				chan = Channels[cn_tuc];				chan.nam = cmd[2];				chan.created = cmd[1];				chan.topic = "";				chan.users = new Array();				chan.modelist[CHANLIST_BAN] = new Array();				chan.modelist[CHANLIST_VOICE] = new Array();				chan.modelist[CHANLIST_OP] = new Array();				chan.mode = CHANMODE_NONE;			}			if (cmd[3]) {				if (chan.created == cmd[1])					bounce_modes = false;				else					bounce_modes = true;				mode_args="";				tmp_modeargs=0;				for (tmpmc in cmd[3]) {					if (cmd[3][tmpmc] == "k") {						tmp_modeargs++;						mode_args += cmd[3 + tmp_modeargs];					} else if (cmd[3][tmpmc] == "l") {						tmp_modeargs++;						mode_args += cmd[3 + tmp_modeargs];					}				}				if (chan.created >= cmd[1]) {					if (mode_args)						this.set_chanmode("MODE " + chan.nam + " " + cmd[3] + " " + mode_args, bounce_modes);					else						this.set_chanmode("MODE " + chan.nam + " " + cmd[3], bounce_modes);				}				if ((cmd[4] == "") && cmd[5])					tmp_modeargs++;				chan_members = ircstring(cmdline,4+tmp_modeargs).split(' ');				for (member in chan_members) {					is_op = false;					is_voice = false;					if (chan_members[member][0] == "@") {						is_op = true;						chan_members[member] = chan_members[member].slice(1);					}					if (chan_members[member][0] == "+") {						is_voice = true;						chan_members[member] = chan_members[member].slice(1);					}					member_obj = searchbynick(chan_members[member]);					if (!member_obj)						break;					member_obj.channels.push(chan.nam.toUpperCase());					chan.users.push(member_obj.id);					member_obj.bcast_to_channel(chan.nam, "JOIN " + chan.nam, false);					if (chan.created >= cmd[1]) {						if (is_op) {							chan.modelist[CHANLIST_OP].push(member_obj.id);							this.bcast_to_channel(chan.nam, "MODE " + chan.nam + " +o " + member_obj.nick);						}						if (is_voice) {							chan.modelist[CHANLIST_VOICE].push(member_obj.id);							this.bcast_to_channel(chan.nam, "MODE " + chan.nam + " +v " + member_obj.nick);						}					}				}			} else {				ThisOrigin.channels.push(chan.nam.toUpperCase());				chan.users.push(ThisOrigin.id);				ThisOrigin.bcast_to_channel(chan.nam, "JOIN " + chan.nam, false);			}			this.bcast_to_servers_raw(":" + servername + " SJOIN " + chan.created + " " + chan.nam + " " + chan.chanmode(true) + " :" + ircstring(cmdline))			break;		case "SQUIT":			if (!cmd[2])				break;			sq_server = searchbyserver(cmd[1]);			if (!sq_server)				break;			sq_server.quit(ThisOrigin.nick + " " + sq_server.nick);			break;		case "KILL":			if (!cmd[2])				break;			if (cmd[1].match(/[.]+/))				break;			if (cmd[2] == ":")				break;			reason = ircstring(cmdline);			kills = cmd[1].split(",");			for(kill in kills) {				target = searchbynick(kills[kill]);				if (target) {					this.bcast_to_servers_raw(":" + ThisOrigin.nick + " KILL " + target.nick + " :" + reason);					target.quit("KILLED by " + ThisOrigin.nick + " (" + reason + ")",false);				}			}			break;		case "MODE":			if (!cmd[1])				break;			// nasty kludge since we don't support per-mode TS yet.			if (cmd[2].match(/^[0-9]+$/) && 			    (cmd[1][0] == "#") ) {				cmdline="MODE " + cmd[1];				for(xx=3;xx<cmd.length;xx++) {					cmdline += " ";					cmdline += cmd[xx];				}			}			if (cmd[1][0] == "#")				ThisOrigin.set_chanmode(cmdline);			break;		case "NICK":			if (!cmd[8] && (cmd[2][0] != ":"))				break;			collide = searchbynick(cmd[1]);			if ((collide) && (parseInt(collide.connecttime) <			    parseInt(cmd[3]) ) ) {				// FIXME: At the moment, we rely on the remote				// end to do the right thing.				break;			} else if ((collide) && (parseInt(collide.connecttime) >			    parseInt(cmd[3]) ) ) {				// Nuke our side of things, allow this newly				// introduced nick to overrule.				this.bcast_to_servers("KILL " + collide.nick + " :Nickname Collision.");				collide.quit("Nickname Collision");			}			if (cmd[2][0] == ":") {				cmd[2] = cmd[2].slice(1);				ThisOrigin.created = cmd[2];				ThisOrigin.bcast_to_uchans_unique("NICK " + cmd[1]);				this.bcast_to_servers_raw(":" + origin + " NICK " + cmd[1] + " :" + cmd[2]);				ThisOrigin.nick = cmd[1];			} else if (cmd[10]) {				new_id = get_next_clientid();				Clients[new_id]=new IRCClient(-1,new_id,false,true);				NewNick = Clients[new_id];				NewNick.nick = cmd[1];				NewNick.hops = cmd[2];				NewNick.created = cmd[3];				NewNick.uprefix = cmd[5];				NewNick.hostname = cmd[6];				NewNick.servername = cmd[7];				NewNick.realname = ircstring(cmdline,10);				NewNick.conntype = TYPE_USER_REMOTE;				NewNick.away = "";				NewNick.mode = USERMODE_NONE;				NewNick.connecttime = time(); // BROKEN XXX FIXME				NewNick.idletime = 0;				NewNick.talkidle = 0;				NewNick.parent = this.id;				NewNick.decip = cmd[9];				NewNick.setusermode(cmd[4]);				true_hops = parseInt(NewNick.hops)+1;				this.bcast_to_servers_raw("NICK " + NewNick.nick + " " + true_hops + " " + NewNick.created + " " + NewNick.get_usermode() + " " + NewNick.uprefix + " " + NewNick.hostname + " " + NewNick.servername + " 0 " + NewNick.decip + " :" + NewNick.realname);			}			break;		case "NOTICE":			if (!cmd[1])				break;			if ( !cmd[2] || ( !cmd[3] && (			     (cmd[2] == ":") && (ircstring(cmdline) == "")			    ) ) )				break;			notice_targets = cmd[1].split(',');			for (notice in notice_targets) {				if (notice_targets[notice][0] != "&")					ThisOrigin.do_msg(notice_targets[notice],"NOTICE",ircstring(cmdline));			}			break;		case "PART":			if (!cmd[1])				break;			the_channels = cmd[1].split(",");			for(pchan in the_channels) {				ThisOrigin.do_part(the_channels[pchan]);			}			break;		case "PRIVMSG":			if (!cmd[1])				break;			if ( !cmd[2] || ( !cmd[3] && (			     (cmd[2] == ":") && (ircstring(cmdline) == "")			   ) ) )				break;			privmsg_targets = cmd[1].split(',');			for (privmsg in privmsg_targets) {				if (privmsg_targets[privmsg][0] != "&")					ThisOrigin.do_msg(privmsg_targets[privmsg],"PRIVMSG",ircstring(cmdline));			}			break;		case "PING":			if (!cmd[1]) {				break;			} else {				if (cmd[1][0] == ":")					cmd[1] = cmd[1].slice(1);				this.ircout("PONG " + servername + " :" + cmd[1]);              			}                                                       			break;		case "PONG":			this.pinged = false;			break;		case "QUIT":			ThisOrigin.quit(ircstring(cmdline),true);			break;		case "SERVER":			if (!cmd[3])				break;			if ((cmd[2] == 1) && !this.realname) {				this.nick = cmd[1];				this.hops = 1;				this.realname = ircstring(cmdline);				this.linkparent = servername;				newsrv = this;			} else if (parseInt(cmd[2]) > 1) {				new_id = get_next_clientid();				Clients[new_id] = new IRCClient(-1,new_id,false,false);				newsrv = Clients[new_id];				newsrv.hops = cmd[2];				newsrv.nick = cmd[1];				newsrv.realname = ircstring(cmdline);				newsrv.server = true;				newsrv.parent = this.id;				newsrv.conntype = TYPE_SERVER;				newsrv.linkparent = ThisOrigin.nick;			} else {				break;			}			this.bcast_to_servers_raw(":" + newsrv.linkparent + " SERVER " + newsrv.nick + " " + (parseInt(newsrv.hops)+1) + " :" + newsrv.realname);			break;		case "TOPIC":			if (!cmd[4])				break;			chan = searchbychannel(cmd[1]);			if (!chan)				break;			chan.topic = ircstring(cmdline);			chan.topictime = cmd[2];			chan.topicchangedby = cmd[1];			str = "TOPIC " + chan.nam + " :" + chan.topic;			this.bcast_to_channel(chan.nam,str,false);			break;		case "AKILL":			if (!cmd[6])				break;			this_uh = cmd[2] + "@" + cmd[1];			if (isklined(this_uh))				break;			KLines.push(new KLine(this_uh,ircstring(cmdline),"A"));			this.bcast_to_servers_raw(":" + ThisOrigin.nick + " " + cmdline);			scan_for_klined_clients();			break;		default:			break;	}}
meta: 9592	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9592/8f476ef82a5af7070c0487f75d876863ef12799e/ircd.js/clean/ircd.js