rem: this.numeric("472", modestr[modechar] + " :is unknown mode char to me."); 
add: this.numeric("472", cm_args[0][modechar] + " :is unknown mode char to me."); 
context: function IRCClient_set_chanmode(cmdline,bounce_modes) {	cm_cmd=cmdline.split(' ');	chan = searchbychannel(cm_cmd[1]);	if (!chan)		return;	modestr = cm_cmd[2];	add=true;	mode_args=new Array();	mode_args_counter=2;	addbits=CHANMODE_NONE;	delbits=CHANMODE_NONE;	chan_key="";	chan_limit="";	chan_tmplist=new Array();	chan_tmplist[CHANLIST_OP]=new Array();	chan_tmplist[CHANLIST_DEOP]=new Array();	chan_tmplist[CHANLIST_VOICE]=new Array();	chan_tmplist[CHANLIST_DEVOICE]=new Array();	chan_tmplist[CHANLIST_BAN]=new Array();	chan_tmplist[CHANLIST_UNBAN]=new Array();	mode_counter=0;	for (modechar in modestr) {		mode_counter++;		switch (modestr[modechar]) {			case "+":				add=true;				mode_counter--;				break;			case "-":				add=false;				mode_counter--;				break;			case "b":				mode_args_counter++;				if(add && !cm_cmd[mode_args_counter]) {					addbits|=CHANMODE_BAN; // list bans					break;				}				this.tweaktmpmodelist(CHANLIST_BAN,CHANLIST_UNBAN);				break;			case "i":				this.tweaktmpmode(CHANMODE_INVITE);				break;			case "k":				mode_args_counter++;				if(cm_cmd[mode_args_counter]) {					this.tweaktmpmode(CHANMODE_KEY);					chan_key=cm_cmd[mode_args_counter];				}				break;			case "l":				mode_args_counter++;				this.tweaktmpmode(CHANMODE_LIMIT);				if(add && cm_cmd[mode_args_counter]) {					regexp = "^[0-9]{1,4}$";					if(cm_cmd[mode_args_counter].match(regexp))						chan_limit=cm_cmd[mode_args_counter];				}				break;			case "m":				this.tweaktmpmode(CHANMODE_MODERATED);				break;			case "n":				this.tweaktmpmode(CHANMODE_NOOUTSIDE);				break;			case "o":				mode_args_counter++;				if(!cm_cmd[mode_args_counter])					break;				this.tweaktmpmodelist(CHANLIST_OP,CHANLIST_DEOP);				break;			case "p":				this.tweaktmpmode(CHANMODE_PRIVATE);				break;			case "s":				this.tweaktmpmode(CHANMODE_SECRET);				break;			case "t":				this.tweaktmpmode(CHANMODE_TOPIC);				break;			case "v":				mode_args_counter++;				if (!cm_cmd[mode_args_counter])					break;				this.tweaktmpmodelist(CHANLIST_VOICE,CHANLIST_DEVOICE);				break;			default:				if ((!this.parent) && (!this.server))					this.numeric("472", modestr[modechar] + " :is unknown mode char to me.");				mode_counter--;				break;		}		if (mode_counter == max_modes)			break;	}	addmodes = "";	delmodes = "";	addmodeargs = "";	delmodeargs = "";	if (bounce_modes) {		bouncemodes=CHANMODE_NONE;		bouncemodes|=CHANMODE_INVITE;		bouncemodes|=CHANMODE_KEY;		bouncemodes|=CHANMODE_LIMIT;		bouncemodes|=CHANMODE_MODERATED;		bouncemodes|=CHANMODE_NOOUTSIDE;		bouncemodes|=CHANMODE_PRIVATE;		bouncemodes|=CHANMODE_SECRET;		bouncemodes|=CHANMODE_TOPIC;	}	if ((addbits&CHANMODE_INVITE) && !(chan.mode&CHANMODE_INVITE)) {		addmodes += "i";		chan.mode |= CHANMODE_INVITE;		if (bounce_modes)			bouncemodes &= ~CHANMODE_INVITE;	} else if ((delbits&CHANMODE_INVITE) && (chan.mode&CHANMODE_INVITE)) {		delmodes += "i";		chan.mode &= ~CHANMODE_INVITE;		if (bounce_modes)			bouncemodes |= CHANMODE_INVITE;	}	if ((addbits&CHANMODE_KEY) && chan_key && chan.key) {		if (!this.server && !this.parent)			this.numeric("467", chan.nam + " :Channel key aready set.");	} else if ((addbits&CHANMODE_KEY) && chan_key && !chan.key) {		addmodes += "k";		chan.mode |= CHANMODE_KEY;		addmodeargs += " " + chan_key;		chan.key = chan_key;		if (bounce_modes)			bouncemodes &= ~CHANMODE_KEY;	} else if ((delbits&CHANMODE_KEY) && (chan.mode&CHANMODE_KEY) &&		   (chan.key == chan_key) ) {		delmodes += "k";		chan.mode &= ~CHANMODE_KEY;		delmodeargs += " " + chan_key;		chan.key = "";		if (bounce_modes)			bouncemodes |= CHANMODE_KEY;	}	if ((addbits&CHANMODE_LIMIT) && chan_limit && (chan_limit != chan.limit)) {		addmodes += "l";		chan.mode |= CHANMODE_LIMIT;		addmodeargs += " " + chan_limit;		chan.limit = chan_limit;		if (bounce_modes)			bouncemodes &= ~CHANMODE_LIMIT;	} else if ((delbits&CHANMODE_LIMIT) && (chan.mode&CHANMODE_LIMIT)) {		delmodes += "l";		chan.mode &= ~CHANMODE_LIMIT;		if (bounce_modes)			bouncemodes |= CHANMODE_LIMIT;	}	if ((addbits&CHANMODE_MODERATED) && !(chan.mode&CHANMODE_MODERATED)) {		addmodes += "m";		chan.mode |= CHANMODE_MODERATED;		if (bounce_modes)			bouncemodes &= ~CHANMODE_MODERATED;	} else if ((delbits&CHANMODE_MODERATED) && (chan.mode&CHANMODE_MODERATED)) {		delmodes += "m";		chan.mode &= ~CHANMODE_MODERATED;		if (bounce_modes)			bouncemodes |= CHANMODE_MODERATED;	}	if ((addbits&CHANMODE_NOOUTSIDE) && !(chan.mode&CHANMODE_NOOUTSIDE)) {		addmodes += "n";		chan.mode |= CHANMODE_NOOUTSIDE;		if (bounce_modes)			bouncemodes &= ~CHANMODE_NOOUTSIDE;	} else if ((delbits&CHANMODE_NOOUTSIDE) && (chan.mode&CHANMODE_NOOUTSIDE)) {		delmodes += "n";		chan.mode &= ~CHANMODE_NOOUTSIDE;		if (bounce_modes)			bouncemodes |= CHANMODES_NOOUTSIDE;	}	if ((delbits&CHANMODE_PRIVATE) && (chan.mode&CHANMODE_PRIVATE)) {		delmodes += "p";		chan.mode &= ~CHANMODE_PRIVATE;		if (bounce_modes)			bouncemodes |= CHANMODE_PRIVATE;	}	if ((delbits&CHANMODE_SECRET) && (chan.mode&CHANMODE_SECRET)) {		delmodes += "s";		chan.mode &= ~CHANMODE_SECRET;		if (bounce_modes)			bouncemodes |= CHANMODE_SECRET;	}	if ((addbits&CHANMODE_PRIVATE) && !(chan.mode&CHANMODE_PRIVATE) &&	    !(chan.mode&CHANMODE_SECRET)) {		addmodes += "p";		chan.mode |= CHANMODE_PRIVATE;		if (bounce_modes)			bouncemodes &= ~CHANMODE_PRIVATE;	}	if ((addbits&CHANMODE_SECRET) && !(chan.mode&CHANMODE_SECRET) &&	    !(chan.mode&CHANMODE_PRIVATE)) {		addmodes += "s";		chan.mode |= CHANMODE_SECRET;		if (bounce_modes)			bouncemodes &= ~CHANMODE_SECRET;	}	if ((addbits&CHANMODE_TOPIC) && !(chan.mode&CHANMODE_TOPIC)) {		addmodes += "t";		chan.mode |= CHANMODE_TOPIC;		if (bounce_modes)			bouncemodes &= ~CHANMODE_TOPIC;	} else if ((delbits&CHANMODE_TOPIC) && (chan.mode&CHANMODE_TOPIC)) {		delmodes += "t";		chan.mode &= ~CHANMODE_TOPIC;		if (bounce_modes)			bouncemodes |= CHANMODE_TOPIC;	}	if (addbits&CHANMODE_BAN) {		for (the_ban in chan.modelist[CHANLIST_BAN]) {			this.numeric("367", chan.nam + " " + chan.modelist[CHANLIST_BAN][the_ban] + " " + chan.bancreator[the_ban] + " " + chan.bantime[the_ban]);		}		this.numeric("368", chan.nam + " :End of Channel Ban List.");	}	if (bounce_modes) {		str = "MODE " + chan.nam + " " + inverse_chanmode(bouncemodes);		this.bcast_to_channel(chan.nam, str, false);		for (op in chan.modelist[CHANLIST_OP]) {			str = "MODE " + chan.nam + " -o " + Clients[chan.modelist[CHANLIST_OP][op]].nick;			chan.del_modelist(chan.modelist[CHANLIST_OP][op],CHANLIST_OP);			this.bcast_to_channel(chan.nam, str, false);		}		for (voice in chan.modelist[CHANLIST_VOICE]) {			str = "MODE " + chan.nam + " -v " + Clients[chan.modelist[CHANLIST_VOICE][voice]].nick;			chan.del_modelist(chan.modelist[CHANLIST_VOICE][voice],CHANLIST_VOICE);			this.bcast_to_channel(chan.nam, str, false);		}		for (ban in chan.modelist[CHANLIST_BAN]) {			str = "MODE " + chan.nam + " -b " + Clients[chan.modelist[CHANLIST_VOICE][voice]].nick;			chan.del_modelist(chan.modelist[CHANLIST_BAN][ban],CHANLIST_BAN);			this.bcast_to_channel(chan.nam, str, false);		}	}	this.affect_mode_list(true,CHANLIST_VOICE);	this.affect_mode_list(false,CHANLIST_DEVOICE);	this.affect_mode_list(true,CHANLIST_OP);	this.affect_mode_list(false,CHANLIST_DEOP);	for (unban in chan_tmplist[CHANLIST_UNBAN]) {		for (ban in chan.modelist[CHANLIST_BAN]) {			if (chan_tmplist[CHANLIST_UNBAN][unban] ==			    chan.modelist[CHANLIST_BAN][ban]) {				delmodes += "b";				delmodeargs += " " + chan_tmplist[CHANLIST_UNBAN][unban];				banid = chan.del_modelist(chan_tmplist[CHANLIST_UNBAN][unban],CHANLIST_BAN);				delete chan.bantime[banid];				delete chan.bancreator[banid];			}		}	}	for (ban in chan_tmplist[CHANLIST_BAN]) {		set_ban = create_ban_mask(chan_tmplist[CHANLIST_BAN][ban]);		if (chan.count_modelist(CHANLIST_BAN) >= max_bans) {			this.numeric(478, chan.nam + " " + set_ban + " :Cannot add ban, channel's ban list is full.");		} else if (set_ban && !chan.isbanned(set_ban)) {			addmodes += "b";			addmodeargs += " " + set_ban;			banid = chan.add_modelist(set_ban,CHANLIST_BAN);			chan.bantime[banid] = time();			chan.bancreator[banid] = this.ircnuh;		}	}		if (!addmodes && !delmodes)		return 0;	final_modestr = "";	if (addmodes)		final_modestr += "+" + addmodes;	if (delmodes)		final_modestr += "-" + delmodes;	if (addmodeargs)		final_modestr += addmodeargs;	if (delmodeargs)		final_modestr += delmodeargs;	str = "MODE " + chan.nam + " " + final_modestr;	if (!this.server)		this.bcast_to_channel(chan.nam, str, true);	else		this.bcast_to_channel(chan.nam, str, false);	if (chan.nam[0] != "&")		this.bcast_to_servers(str);	return 1;}
meta: 9592	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/9592/6c93644dcb441e0f9ff7f6b44303edf0639bb4d9/ircd.js/clean/ircd.js