rem
stringlengths
0
126k
add
stringlengths
0
441k
context
stringlengths
15
136k
function IRCClient_affect_mode_list(tmp_add,list_bit) { for (tmp_index in chan_tmplist[list_bit]) { tmp_nick = searchbynick(chan_tmplist[list_bit][tmp_index]); if (!tmp_nick) tmp_nick = searchbynick(search_nickbuf(chan_tmplist[list_bit][tmp_index])); if (tmp_nick) { if (tmp_add && (!chan.ismode(tmp_nick.id,list_bit))) { addmodes += const_modechar[list_bit]; addmodeargs += " " + tmp_nick.nick; chan.add_modelist(tmp_nick.id,list_bit); } else if (chan.ismode(tmp_nick.id,list_bit-1)) { delmodes += const_modechar[list_bit]; delmodeargs += " " + tmp_nick.nick; chan.del_modelist(tmp_nick.id,list_bit-1);
function IRCClient_affect_mode_list(list_bit) { for (x=list_bit;x<=(list_bit+1);x++) { for (tmp_index in chan_tmplist[x]) { if (list_bit >= CHANLIST_BAN) { if (x == CHANLIST_BAN) { set_ban = create_ban_mask(chan_tmplist[x][tmp_index]); 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; } } else if (x == CHANLIST_UNBAN) { for (ban in chan.modelist[CHANLIST_BAN]) { if (chan_tmplist[CHANLIST_UNBAN][tmp_index].toUpperCase() == chan.modelist[CHANLIST_BAN][ban].toUpperCase()) { delmodes += "b"; delmodeargs += " " + chan_tmplist[CHANLIST_UNBAN][tmp_index]; banid = chan.del_modelist(chan_tmplist[CHANLIST_UNBAN][tmp_index],CHANLIST_BAN); delete chan.bantime[banid]; delete chan.bancreator[banid]; } } } } else { tmp_nick = searchbynick(chan_tmplist[x][tmp_index]); if (!tmp_nick) tmp_nick = searchbynick(search_nickbuf(chan_tmplist[x][tmp_index])); if (tmp_nick) { if ((x == list_bit) && (!chan.ismode(tmp_nick.id,list_bit))) { addmodes += MODECHAR[list_bit]; addmodeargs += " " + tmp_nick.nick; chan.add_modelist(tmp_nick.id,x); } else if (chan.ismode(tmp_nick.id,list_bit)) { delmodes += MODECHAR[list_bit]; delmodeargs += " " + tmp_nick.nick; chan.del_modelist(tmp_nick.id,list_bit); } } else { this.numeric401(chan_tmplist[x][tmp_index]); }
function IRCClient_affect_mode_list(tmp_add,list_bit) { for (tmp_index in chan_tmplist[list_bit]) { tmp_nick = searchbynick(chan_tmplist[list_bit][tmp_index]); if (!tmp_nick) tmp_nick = searchbynick(search_nickbuf(chan_tmplist[list_bit][tmp_index])); if (tmp_nick) { // FIXME: check for user existing on channel? if (tmp_add && (!chan.ismode(tmp_nick.id,list_bit))) { addmodes += const_modechar[list_bit]; addmodeargs += " " + tmp_nick.nick; chan.add_modelist(tmp_nick.id,list_bit); } else if (chan.ismode(tmp_nick.id,list_bit-1)) { delmodes += const_modechar[list_bit]; delmodeargs += " " + tmp_nick.nick; chan.del_modelist(tmp_nick.id,list_bit-1); } } else { this.numeric401(chan_tmplist[list_bit][tmp_index]); } }}
} else { this.numeric401(chan_tmplist[list_bit][tmp_index]);
function IRCClient_affect_mode_list(tmp_add,list_bit) { for (tmp_index in chan_tmplist[list_bit]) { tmp_nick = searchbynick(chan_tmplist[list_bit][tmp_index]); if (!tmp_nick) tmp_nick = searchbynick(search_nickbuf(chan_tmplist[list_bit][tmp_index])); if (tmp_nick) { // FIXME: check for user existing on channel? if (tmp_add && (!chan.ismode(tmp_nick.id,list_bit))) { addmodes += const_modechar[list_bit]; addmodeargs += " " + tmp_nick.nick; chan.add_modelist(tmp_nick.id,list_bit); } else if (chan.ismode(tmp_nick.id,list_bit-1)) { delmodes += const_modechar[list_bit]; delmodeargs += " " + tmp_nick.nick; chan.del_modelist(tmp_nick.id,list_bit-1); } } else { this.numeric401(chan_tmplist[list_bit][tmp_index]); } }}
function IRCClient_affect_mode_list(list_bit) {
function IRCClient_affect_mode_list(list_bit,chan) {
function IRCClient_affect_mode_list(list_bit) { for (x=list_bit;x<=(list_bit+1);x++) { for (tmp_index in chan_tmplist[x]) { if (list_bit >= CHANLIST_BAN) { if (x == CHANLIST_BAN) { set_ban = create_ban_mask(chan_tmplist[x][tmp_index]); 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; } } else if (x == CHANLIST_UNBAN) { for (ban in chan.modelist[CHANLIST_BAN]) { if (chan_tmplist[CHANLIST_UNBAN][tmp_index].toUpperCase() == chan.modelist[CHANLIST_BAN][ban].toUpperCase()) { delmodes += "b"; delmodeargs += " " + chan_tmplist[CHANLIST_UNBAN][tmp_index]; banid = chan.del_modelist(chan_tmplist[CHANLIST_UNBAN][tmp_index],CHANLIST_BAN); delete chan.bantime[banid]; delete chan.bancreator[banid]; } } } } else { tmp_nick = searchbynick(chan_tmplist[x][tmp_index]); if (!tmp_nick) tmp_nick = searchbynick(search_nickbuf(chan_tmplist[x][tmp_index])); if (tmp_nick) { // FIXME: check for user existing on channel? if ((x == list_bit) && (!chan.ismode(tmp_nick.id,list_bit))) { addmodes += MODECHAR[list_bit]; addmodeargs += " " + tmp_nick.nick; chan.add_modelist(tmp_nick.id,x); } else if (chan.ismode(tmp_nick.id,list_bit)) { delmodes += MODECHAR[list_bit]; delmodeargs += " " + tmp_nick.nick; chan.del_modelist(tmp_nick.id,list_bit); } } else { this.numeric401(chan_tmplist[x][tmp_index]); } } } }}
tmp_nickid = tmp_nick.id; if (tmp_nickid) { if (tmp_add && (!chan.ismode(tmp_nickid,list_bit))) {
if (!tmp_nick) tmp_nick = searchbynick(search_nickbuf(chan_tmplist[list_bit][tmp_index])); if (tmp_nick) { if (tmp_add && (!chan.ismode(tmp_nick.id,list_bit))) {
function IRCClient_affect_mode_list(tmp_add,list_bit) { for (tmp_index in chan_tmplist[list_bit]) { tmp_nick = searchbynick(chan_tmplist[list_bit][tmp_index]); tmp_nickid = tmp_nick.id; if (tmp_nickid) { if (tmp_add && (!chan.ismode(tmp_nickid,list_bit))) { addmodes += const_modechar[list_bit]; addmodeargs += " " + tmp_nick.nick; chan.add_modelist(tmp_nickid,list_bit); } else if (chan.ismode(tmp_nickid,list_bit-1)) { delmodes += const_modechar[list_bit]; delmodeargs += " " + tmp_nick.nick; chan.del_modelist(tmp_nickid,list_bit-1); } } else { this.numeric401(chan_tmplist[list_bit][tmp_index]); this.numeric441(cm_cmd[1]); } }}
chan.add_modelist(tmp_nickid,list_bit); } else if (chan.ismode(tmp_nickid,list_bit-1)) {
chan.add_modelist(tmp_nick.id,list_bit); } else if (chan.ismode(tmp_nick.id,list_bit-1)) {
function IRCClient_affect_mode_list(tmp_add,list_bit) { for (tmp_index in chan_tmplist[list_bit]) { tmp_nick = searchbynick(chan_tmplist[list_bit][tmp_index]); tmp_nickid = tmp_nick.id; if (tmp_nickid) { if (tmp_add && (!chan.ismode(tmp_nickid,list_bit))) { addmodes += const_modechar[list_bit]; addmodeargs += " " + tmp_nick.nick; chan.add_modelist(tmp_nickid,list_bit); } else if (chan.ismode(tmp_nickid,list_bit-1)) { delmodes += const_modechar[list_bit]; delmodeargs += " " + tmp_nick.nick; chan.del_modelist(tmp_nickid,list_bit-1); } } else { this.numeric401(chan_tmplist[list_bit][tmp_index]); this.numeric441(cm_cmd[1]); } }}
chan.del_modelist(tmp_nickid,list_bit-1);
chan.del_modelist(tmp_nick.id,list_bit-1);
function IRCClient_affect_mode_list(tmp_add,list_bit) { for (tmp_index in chan_tmplist[list_bit]) { tmp_nick = searchbynick(chan_tmplist[list_bit][tmp_index]); tmp_nickid = tmp_nick.id; if (tmp_nickid) { if (tmp_add && (!chan.ismode(tmp_nickid,list_bit))) { addmodes += const_modechar[list_bit]; addmodeargs += " " + tmp_nick.nick; chan.add_modelist(tmp_nickid,list_bit); } else if (chan.ismode(tmp_nickid,list_bit-1)) { delmodes += const_modechar[list_bit]; delmodeargs += " " + tmp_nick.nick; chan.del_modelist(tmp_nickid,list_bit-1); } } else { this.numeric401(chan_tmplist[list_bit][tmp_index]); this.numeric441(cm_cmd[1]); } }}
this.numeric441(cm_cmd[1]);
function IRCClient_affect_mode_list(tmp_add,list_bit) { for (tmp_index in chan_tmplist[list_bit]) { tmp_nick = searchbynick(chan_tmplist[list_bit][tmp_index]); tmp_nickid = tmp_nick.id; if (tmp_nickid) { if (tmp_add && (!chan.ismode(tmp_nickid,list_bit))) { addmodes += const_modechar[list_bit]; addmodeargs += " " + tmp_nick.nick; chan.add_modelist(tmp_nickid,list_bit); } else if (chan.ismode(tmp_nickid,list_bit-1)) { delmodes += const_modechar[list_bit]; delmodeargs += " " + tmp_nick.nick; chan.del_modelist(tmp_nickid,list_bit-1); } } else { this.numeric401(chan_tmplist[list_bit][tmp_index]); this.numeric441(cm_cmd[1]); } }}
!sent_to_servers[aUser.parent]) {
!sent_to_servers[aUser.parent.toLowerCase()]) {
function IRCClient_bcast_to_channel_servers(chan, str) { var sent_to_servers = new Array; for(thisUser in chan.users) { var aUser=chan.users[thisUser]; if (!aUser.local && (this.parent != aUser.parent) && !sent_to_servers[aUser.parent]) { aUser.originatorout(str,this); sent_to_servers[aUser.parent] = true; } }}
sent_to_servers[aUser.parent] = true;
sent_to_servers[aUser.parent.toLowerCase()] = true;
function IRCClient_bcast_to_channel_servers(chan, str) { var sent_to_servers = new Array; for(thisUser in chan.users) { var aUser=chan.users[thisUser]; if (!aUser.local && (this.parent != aUser.parent) && !sent_to_servers[aUser.parent]) { aUser.originatorout(str,this); sent_to_servers[aUser.parent] = true; } }}
var sent_to_servers = new Array;
var sent_to_servers = new Object;
function IRCClient_bcast_to_channel_servers(chan, str) { var sent_to_servers = new Array; for(thisUser in chan.users) { var aUser=chan.users[thisUser]; if (!aUser.local && (this.parent != aUser.parent) && !sent_to_servers[aUser.parent.toLowerCase()]) { aUser.originatorout(str,this); sent_to_servers[aUser.parent.toLowerCase()] = true; } }}
function IRCClient_bcast_to_servers(str) {
function IRCClient_bcast_to_servers(str,type) {
function IRCClient_bcast_to_servers(str) { for(thisClient in Local_Servers) { if (Local_Servers[thisClient].nick != this.parent) Local_Servers[thisClient].originatorout(str,this); }}
if (Local_Servers[thisClient].nick != this.parent)
var srv = Local_Servers[thisClient]; if ( (srv.nick != this.parent) && (!type || (srv.type == type)))
function IRCClient_bcast_to_servers(str) { for(thisClient in Local_Servers) { if (Local_Servers[thisClient].nick != this.parent) Local_Servers[thisClient].originatorout(str,this); }}
function IRCClient_bcast_to_servers_raw(str) {
function IRCClient_bcast_to_servers_raw(str,type) {
function IRCClient_bcast_to_servers_raw(str) { for(thisClient in Local_Servers) { if (Local_Servers[thisClient].nick != this.parent) Local_Servers[thisClient].rawout(str); }}
if (Local_Servers[thisClient].nick != this.parent)
var srv = Local_Servers[thisClient]; if ( (srv.nick != this.parent) && (!type || (srv.type == type)))
function IRCClient_bcast_to_servers_raw(str) { for(thisClient in Local_Servers) { if (Local_Servers[thisClient].nick != this.parent) Local_Servers[thisClient].rawout(str); }}
var already_bcast = new Array();
var already_bcast = new Object;
function IRCClient_bcast_to_uchans_unique(str) { var already_bcast = new Array(); for(thisChannel in this.channels) { var userchannel=this.channels[thisChannel]; for (j in userchannel.users) { var usr = userchannel.users[j]; if (!already_bcast[usr.nick] && (usr.id != this.id) && usr.local) { usr.originatorout(str,this); already_bcast[usr.nick] = true; } } }}
qline_nick = QLines[ql].nick; qline_nick = qline_nick.replace(/[?]/g,"."); qline_nick = qline_nick.replace(/[*]/g,".*?"); regexp = new RegExp("^" + qline_nick + "$","i"); if(newnick.match(regexp)) {
if(wildmatch(newnick, QLines[ql].nick)) {
function IRCClient_check_nickname(newnick,squelch) { var qline_nick; var checknick; var regexp; newnick = newnick.slice(0,max_nicklen); // If you're trying to NICK to yourself, drop silently. if(newnick == this.nick) return -1; // First, check for valid nick against irclib. if(IRC_check_nick(newnick)) { if (!squelch) this.numeric("432", newnick + " :Foobar'd Nickname."); return 0; } // Second, check for existing nickname. checknick = Users[newnick.toUpperCase()]; if(checknick && (checknick.nick != this.nick) ) { if (!squelch) this.numeric("433", newnick + " :Nickname is already in use."); return 0; } // Third, match against Q:Lines for (ql in QLines) { qline_nick = QLines[ql].nick; qline_nick = qline_nick.replace(/[?]/g,"."); qline_nick = qline_nick.replace(/[*]/g,".*?"); regexp = new RegExp("^" + qline_nick + "$","i"); if(newnick.match(regexp)) { if (!squelch) this.numeric(432, newnick + " :" + QLines[ql].reason); return 0; } } return 1; // if we made it this far, we're good!}
if(newnick.toUpperCase() == this.nick.toUpperCase())
if(newnick == this.nick)
function IRCClient_check_nickname(newnick) { newnick = newnick.slice(0,max_nicklen); // If you're trying to NICK to yourself, drop silently. if(newnick.toUpperCase() == this.nick.toUpperCase()) return 0; // First, check for valid characters. regexp="^[A-Za-z\{\}\`\^\_\|\\]\\[\\\\][A-Za-z0-9\-\{\}\`\^\_\|\\]\\[\\\\]*$"; if(!newnick.match(regexp)) { if (!this.server) this.numeric("432", newnick + " :Foobar'd Nickname."); return 0; } // Second, check for existing nickname. if(searchbynick(newnick)) { if (!this.server) this.numeric("433", newnick + " :Nickname is already in use."); return 0; } // Third, match against Q:Lines for (ql in QLines) { qline_nick = QLines[ql].nick; qline_nick = qline_nick.replace(/[?]/g,"."); qline_nick = qline_nick.replace(/[*]/g,".*?"); regexp = new RegExp("^" + qline_nick + "$","i"); if(newnick.match(regexp)) { if (!this.server) this.numeric(432, newnick + " :" + QLines[ql].reason); return 0; } } return 1; // if we made it this far, we're good!}
if(searchbynick(newnick)) {
checknick = searchbynick(newnick); if(checknick && (checknick.nick != this.nick) ) {
function IRCClient_check_nickname(newnick) { newnick = newnick.slice(0,max_nicklen); // If you're trying to NICK to yourself, drop silently. if(newnick.toUpperCase() == this.nick.toUpperCase()) return 0; // First, check for valid characters. regexp="^[A-Za-z\{\}\`\^\_\|\\]\\[\\\\][A-Za-z0-9\-\{\}\`\^\_\|\\]\\[\\\\]*$"; if(!newnick.match(regexp)) { if (!this.server) this.numeric("432", newnick + " :Foobar'd Nickname."); return 0; } // Second, check for existing nickname. if(searchbynick(newnick)) { if (!this.server) this.numeric("433", newnick + " :Nickname is already in use."); return 0; } // Third, match against Q:Lines for (ql in QLines) { qline_nick = QLines[ql].nick; qline_nick = qline_nick.replace(/[?]/g,"."); qline_nick = qline_nick.replace(/[*]/g,".*?"); regexp = new RegExp("^" + qline_nick + "$","i"); if(newnick.match(regexp)) { if (!this.server) this.numeric(432, newnick + " :" + QLines[ql].reason); return 0; } } return 1; // if we made it this far, we're good!}
umode_notice(USERMODE_SPY,"ADMIN requested by " + this.nick + " (" + this.uprefix + "@" + this.hostname + ") [" + this.servername + "]");
function IRCClient_do_admin() { if (Admin1 && Admin2 && Admin3) { this.numeric(256, ":Administrative info about " + servername); this.numeric(257, ":" + Admin1); this.numeric(258, ":" + Admin2); this.numeric(259, ":" + Admin3); } else { this.numeric(423, servername + " :No administrative information available."); }}
if (!chkwho) umode_notice(USERMODE_OPER,"Notice","WHO returned 0 for user: " + usr.nick + " (A)");
if (!chkwho) { umode_notice(USERMODE_OPER,"Notice", "WHO returned 0 for user: " + usr.nick + " (A)"); }
function IRCClient_do_basic_who(whomask) { var eow = "*"; var regexp = "^[0]{1,}$"; if (whomask.match(regexp)) whomask = "*"; if ((whomask[0] == "#") || (whomask[0] == "&")) { var chan = Channels[whomask.toUpperCase()]; if (chan && ( ( !(chan.mode&CHANMODE_SECRET) && !(chan.mode&CHANMODE_PRIVATE) ) || this.channels[chan.nam.toUpperCase()] || (this.mode&USERMODE_OPER)) ) { for(i in chan.users) { var usr = chan.users[i]; if (!(usr.mode&USERMODE_INVISIBLE) || (this.mode&USERMODE_OPER) || this.onchanwith(usr) ) { var chkwho = this.numeric352(usr,false,chan); if (!chkwho) umode_notice(USERMODE_OPER,"Notice","WHO returned 0 for user: " + usr.nick + " (A)"); } } eow = chan.nam; } } else { for (i in Users) { var usr = Users[i]; if (usr.match_who_mask(whomask) && (!(usr.mode&USERMODE_INVISIBLE) || (this.mode&USERMODE_OPER) || this.onchanwith(usr) ) ) { var chkwho = this.numeric352(usr); if (!chkwho) umode_notice(USERMODE_OPER,"Notice","WHO returned 0 for user: " + usr.nick + " (B)"); } } eow = whomask; } this.numeric(315, eow + " :End of /WHO list. (Basic)");}
if (!chkwho) umode_notice(USERMODE_OPER,"Notice","WHO returned 0 for user: " + usr.nick + " (B)");
if (!chkwho) { umode_notice(USERMODE_OPER,"Notice", "WHO returned 0 for user: " + usr.nick + " (B)"); }
function IRCClient_do_basic_who(whomask) { var eow = "*"; var regexp = "^[0]{1,}$"; if (whomask.match(regexp)) whomask = "*"; if ((whomask[0] == "#") || (whomask[0] == "&")) { var chan = Channels[whomask.toUpperCase()]; if (chan && ( ( !(chan.mode&CHANMODE_SECRET) && !(chan.mode&CHANMODE_PRIVATE) ) || this.channels[chan.nam.toUpperCase()] || (this.mode&USERMODE_OPER)) ) { for(i in chan.users) { var usr = chan.users[i]; if (!(usr.mode&USERMODE_INVISIBLE) || (this.mode&USERMODE_OPER) || this.onchanwith(usr) ) { var chkwho = this.numeric352(usr,false,chan); if (!chkwho) umode_notice(USERMODE_OPER,"Notice","WHO returned 0 for user: " + usr.nick + " (A)"); } } eow = chan.nam; } } else { for (i in Users) { var usr = Users[i]; if (usr.match_who_mask(whomask) && (!(usr.mode&USERMODE_INVISIBLE) || (this.mode&USERMODE_OPER) || this.onchanwith(usr) ) ) { var chkwho = this.numeric352(usr); if (!chkwho) umode_notice(USERMODE_OPER,"Notice","WHO returned 0 for user: " + usr.nick + " (B)"); } } eow = whomask; } this.numeric(315, eow + " :End of /WHO list. (Basic)");}
this.numeric352(Clients[Channels[chan].users[i]],Channels[chan]);
this.numeric352(Clients[Channels[chan].users[i]],false,Channels[chan]);
function IRCClient_do_basic_who(whomask) { var eow = "*"; if ((whomask[0] == "#") || (whomask[0] == "&")) { var chan = whomask.toUpperCase(); if (Channels[chan] != undefined) { var channel=Channels[chan].nam; for(i in Channels[chan].users) { if (Channels[chan].users[i]) this.numeric352(Clients[Channels[chan].users[i]],Channels[chan]); } eow = Channels[chan].nam; } } else { for (i in Clients) { if (Clients[i] && !Clients[i].server && ((Clients[i].conntype > 1) && (Clients[i].conntype < 4)) && Clients[i].match_who_mask(whomask)) this.numeric352(Clients[i]); } eow = whomask; } this.numeric(315, eow + " :End of /WHO list. (Basic)");}
if (Channels[chan] != undefined) { var channel=Channels[chan].nam;
if ((Channels[chan] != undefined) && ( ( !(Channels[chan].mode&CHANMODE_SECRET) && !(Channels[chan].mode&CHANMODE_PRIVATE) ) || this.onchannel(chan) || (this.mode&USERMODE_OPER)) ) {
function IRCClient_do_basic_who(whomask) { var eow = "*"; var regexp = "^[0]{1,}$"; if (whomask.match(regexp)) whomask = "*"; if ((whomask[0] == "#") || (whomask[0] == "&")) { var chan = whomask.toUpperCase(); if (Channels[chan] != undefined) { var channel=Channels[chan].nam; for(i in Channels[chan].users) { if (Channels[chan].users[i]) this.numeric352(Clients[Channels[chan].users[i]],false,Channels[chan]); } eow = Channels[chan].nam; } } else { for (i in Clients) { if (Clients[i] && !Clients[i].server && ((Clients[i].conntype > 1) && (Clients[i].conntype < 4)) && Clients[i].match_who_mask(whomask)) this.numeric352(Clients[i]); } eow = whomask; } this.numeric(315, eow + " :End of /WHO list. (Basic)");}
if (Channels[chan].users[i])
var usr = Clients[Channels[chan].users[i]]; if (usr && (!(usr.mode&USERMODE_INVISIBLE) || (this.mode&USERMODE_OPER) || this.onchanwith(usr) ) )
function IRCClient_do_basic_who(whomask) { var eow = "*"; var regexp = "^[0]{1,}$"; if (whomask.match(regexp)) whomask = "*"; if ((whomask[0] == "#") || (whomask[0] == "&")) { var chan = whomask.toUpperCase(); if (Channels[chan] != undefined) { var channel=Channels[chan].nam; for(i in Channels[chan].users) { if (Channels[chan].users[i]) this.numeric352(Clients[Channels[chan].users[i]],false,Channels[chan]); } eow = Channels[chan].nam; } } else { for (i in Clients) { if (Clients[i] && !Clients[i].server && ((Clients[i].conntype > 1) && (Clients[i].conntype < 4)) && Clients[i].match_who_mask(whomask)) this.numeric352(Clients[i]); } eow = whomask; } this.numeric(315, eow + " :End of /WHO list. (Basic)");}
if (Clients[i] && !Clients[i].server && ((Clients[i].conntype > 1) && (Clients[i].conntype < 4)) && Clients[i].match_who_mask(whomask))
var usr = Clients[i]; if (usr && !usr.server && ((usr.conntype > 1) && (usr.conntype < 4)) && usr.match_who_mask(whomask) && (!(usr.mode&USERMODE_INVISIBLE) || (this.mode&USERMODE_OPER) || this.onchanwith(usr) ) )
function IRCClient_do_basic_who(whomask) { var eow = "*"; var regexp = "^[0]{1,}$"; if (whomask.match(regexp)) whomask = "*"; if ((whomask[0] == "#") || (whomask[0] == "&")) { var chan = whomask.toUpperCase(); if (Channels[chan] != undefined) { var channel=Channels[chan].nam; for(i in Channels[chan].users) { if (Channels[chan].users[i]) this.numeric352(Clients[Channels[chan].users[i]],false,Channels[chan]); } eow = Channels[chan].nam; } } else { for (i in Clients) { if (Clients[i] && !Clients[i].server && ((Clients[i].conntype > 1) && (Clients[i].conntype < 4)) && Clients[i].match_who_mask(whomask)) this.numeric352(Clients[i]); } eow = whomask; } this.numeric(315, eow + " :End of /WHO list. (Basic)");}
(Channels[aChan].count_users() < list.People) )
(true_array_len(Channels[aChan].users) < list.People) )
function IRCClient_do_complex_list(cmd) { var add = true; var arg = 1; var list = new List(); var listmask; var listmask_items; this.numeric321(); for (lc in cmd[1]) { switch(cmd[1][lc]) { case "+": if (!add) add = true; break; case "-": if (add) add = false; break; case "a": arg++; if (cmd[arg]) { list.tweak_mode(LIST_CHANMASK,add); list.Mask = cmd[arg]; } break; case "c": arg++; if (cmd[arg]) { list.tweak_mode(LIST_CREATED,add); list.Created = parseInt(cmd[arg])*60; } break; case "m": // we never set -m, inverse. arg++; if (cmd[arg]) { list.tweak_mode(LIST_MODES,true); if (!add) { var tmp_mode = ""; if((cmd[arg][0] != "+") || (cmd[arg][0] != "-") ) tmp_mode += "+"; tmp_mode += cmd[arg].replace(/[-]/g," "); tmp_mode = tmp_mode.replace(/[+]/g,"-"); list.Modes = tmp_mode.replace(/[ ]/g,"+"); } else { list.Modes = cmd[arg]; } } break; case "o": arg++; if (cmd[arg]) { list.tweak_mode(LIST_TOPIC,add); list.Topic = cmd[arg]; } break; case "p": arg++; if (cmd[arg]) { list.tweak_mode(LIST_PEOPLE,add); list.People = parseInt(cmd[arg]); } break; case "t": arg++; if (cmd[arg]) { list.tweak_mode(LIST_TOPICAGE,add); list.TopicTime = parseInt(cmd[arg])*60; } break; case "M": list.tweak_mode(LIST_DISPLAY_CHAN_MODES,add); break; default: break; } } // Generic mask atop all this crap? arg++; if (cmd[arg]) listmask = cmd[arg]; // Here we go... for (aChan in Channels) { // Is the user allowed to see this channel, for starters? if (!(Channels[aChan].mode&CHANMODE_SECRET) || (this.mode&USERMODE_OPER) || this.channels[aChan]) { if ((list.add_flags&LIST_CHANMASK) && !IRC_match(aChan,list.Mask.toUpperCase())) continue; else if ((list.del_flags&LIST_CHANMASK) && IRC_match(aChan,list.Mask.toUpperCase())) continue; if ((list.add_flags&LIST_CREATED) && (Channels[aChan].created < (time() - list.Created))) continue; else if ((list.del_flags&LIST_CREATED) && (Channels[aChan].created > (time() - list.Created))) continue; if ((list.add_flags&LIST_TOPIC) && (!IRC_match(Channels[aChan].topic,list.Topic))) continue; else if ((list.del_flags&LIST_TOPIC) && (IRC_match(Channels[aChan].topic,list.Topic))) continue; if ((list.add_flags&LIST_PEOPLE) && (Channels[aChan].count_users() < list.People) ) continue; else if ((list.del_flags&LIST_PEOPLE) && (Channels[aChan].count_users() >= list.People) ) continue; if ((list.add_flags&LIST_TOPICAGE) && list.TopicTime && (Channels[aChan].topictime > (time()-list.TopicTime))) continue; else if((list.del_flags&LIST_TOPICAGE)&&list.TopicTime&& (Channels[aChan].topictime < (time()-list.TopicTime))) continue; if (list.add_flags&LIST_MODES) { // there's no -m var sic = false; var madd = true; var c = Channels[aChan]; for (mm in list.Modes) { switch(list.Modes[mm]) { case "+": if (!madd) madd = true; break; case "-": if (madd) madd = false; break; case "i": if ( (!madd && (c.mode& CHANMODE_INVITE)) || (madd && !(c.mode& CHANMODE_INVITE)) ) sic = true; break; case "k": if ( (!madd && (c.mode& CHANMODE_KEY)) || (madd && !(c.mode& CHANMODE_KEY)) ) sic = true; break; case "l": if ( (!madd && (c.mode& CHANMODE_LIMIT)) || (madd && !(c.mode& CHANMODE_LIMIT)) ) sic = true; break; case "m": if ( (!madd && (c.mode& CHANMODE_MODERATED)) || (madd && !(c.mode& CHANMODE_MODERATED)) ) sic = true; break; case "n": if ( (!madd && (c.mode& CHANMODE_NOOUTSIDE)) || (madd && !(c.mode& CHANMODE_NOOUTSIDE)) ) sic = true; break; case "p": if ( (!madd && (c.mode& CHANMODE_PRIVATE)) || (madd && !(c.mode& CHANMODE_PRIVATE)) ) sic = true; break; case "s": if ( (!madd && (c.mode& CHANMODE_SECRET)) || (madd && !(c.mode& CHANMODE_SECRET)) ) sic = true; break; case "t": if ( (!madd && (c.mode& CHANMODE_TOPIC)) || (madd && !(c.mode& CHANMODE_TOPIC)) ) sic = true; break; default: break; } if (sic) break; } if (sic) continue; } if (listmask) listmask_items = listmask.split(","); var l_match = false; // assume we match nothing. if (listmask_items) { for (l in listmask_items) { if (Channels[aChan].match_list_mask (listmask_items[l])) { l_match = true; break; } } if (!l_match) continue; } // We made it. if (list.add_flags&LIST_DISPLAY_CHAN_MODES) this.numeric322(Channels[aChan],true); else this.numeric322(Channels[aChan]); } } this.numeric(323, ":End of /LIST. (Complex)");}
(Channels[aChan].count_users() >= list.People) )
(true_array_len(Channels[aChan].users) >= list.People) )
function IRCClient_do_complex_list(cmd) { var add = true; var arg = 1; var list = new List(); var listmask; var listmask_items; this.numeric321(); for (lc in cmd[1]) { switch(cmd[1][lc]) { case "+": if (!add) add = true; break; case "-": if (add) add = false; break; case "a": arg++; if (cmd[arg]) { list.tweak_mode(LIST_CHANMASK,add); list.Mask = cmd[arg]; } break; case "c": arg++; if (cmd[arg]) { list.tweak_mode(LIST_CREATED,add); list.Created = parseInt(cmd[arg])*60; } break; case "m": // we never set -m, inverse. arg++; if (cmd[arg]) { list.tweak_mode(LIST_MODES,true); if (!add) { var tmp_mode = ""; if((cmd[arg][0] != "+") || (cmd[arg][0] != "-") ) tmp_mode += "+"; tmp_mode += cmd[arg].replace(/[-]/g," "); tmp_mode = tmp_mode.replace(/[+]/g,"-"); list.Modes = tmp_mode.replace(/[ ]/g,"+"); } else { list.Modes = cmd[arg]; } } break; case "o": arg++; if (cmd[arg]) { list.tweak_mode(LIST_TOPIC,add); list.Topic = cmd[arg]; } break; case "p": arg++; if (cmd[arg]) { list.tweak_mode(LIST_PEOPLE,add); list.People = parseInt(cmd[arg]); } break; case "t": arg++; if (cmd[arg]) { list.tweak_mode(LIST_TOPICAGE,add); list.TopicTime = parseInt(cmd[arg])*60; } break; case "M": list.tweak_mode(LIST_DISPLAY_CHAN_MODES,add); break; default: break; } } // Generic mask atop all this crap? arg++; if (cmd[arg]) listmask = cmd[arg]; // Here we go... for (aChan in Channels) { // Is the user allowed to see this channel, for starters? if (!(Channels[aChan].mode&CHANMODE_SECRET) || (this.mode&USERMODE_OPER) || this.channels[aChan]) { if ((list.add_flags&LIST_CHANMASK) && !IRC_match(aChan,list.Mask.toUpperCase())) continue; else if ((list.del_flags&LIST_CHANMASK) && IRC_match(aChan,list.Mask.toUpperCase())) continue; if ((list.add_flags&LIST_CREATED) && (Channels[aChan].created < (time() - list.Created))) continue; else if ((list.del_flags&LIST_CREATED) && (Channels[aChan].created > (time() - list.Created))) continue; if ((list.add_flags&LIST_TOPIC) && (!IRC_match(Channels[aChan].topic,list.Topic))) continue; else if ((list.del_flags&LIST_TOPIC) && (IRC_match(Channels[aChan].topic,list.Topic))) continue; if ((list.add_flags&LIST_PEOPLE) && (Channels[aChan].count_users() < list.People) ) continue; else if ((list.del_flags&LIST_PEOPLE) && (Channels[aChan].count_users() >= list.People) ) continue; if ((list.add_flags&LIST_TOPICAGE) && list.TopicTime && (Channels[aChan].topictime > (time()-list.TopicTime))) continue; else if((list.del_flags&LIST_TOPICAGE)&&list.TopicTime&& (Channels[aChan].topictime < (time()-list.TopicTime))) continue; if (list.add_flags&LIST_MODES) { // there's no -m var sic = false; var madd = true; var c = Channels[aChan]; for (mm in list.Modes) { switch(list.Modes[mm]) { case "+": if (!madd) madd = true; break; case "-": if (madd) madd = false; break; case "i": if ( (!madd && (c.mode& CHANMODE_INVITE)) || (madd && !(c.mode& CHANMODE_INVITE)) ) sic = true; break; case "k": if ( (!madd && (c.mode& CHANMODE_KEY)) || (madd && !(c.mode& CHANMODE_KEY)) ) sic = true; break; case "l": if ( (!madd && (c.mode& CHANMODE_LIMIT)) || (madd && !(c.mode& CHANMODE_LIMIT)) ) sic = true; break; case "m": if ( (!madd && (c.mode& CHANMODE_MODERATED)) || (madd && !(c.mode& CHANMODE_MODERATED)) ) sic = true; break; case "n": if ( (!madd && (c.mode& CHANMODE_NOOUTSIDE)) || (madd && !(c.mode& CHANMODE_NOOUTSIDE)) ) sic = true; break; case "p": if ( (!madd && (c.mode& CHANMODE_PRIVATE)) || (madd && !(c.mode& CHANMODE_PRIVATE)) ) sic = true; break; case "s": if ( (!madd && (c.mode& CHANMODE_SECRET)) || (madd && !(c.mode& CHANMODE_SECRET)) ) sic = true; break; case "t": if ( (!madd && (c.mode& CHANMODE_TOPIC)) || (madd && !(c.mode& CHANMODE_TOPIC)) ) sic = true; break; default: break; } if (sic) break; } if (sic) continue; } if (listmask) listmask_items = listmask.split(","); var l_match = false; // assume we match nothing. if (listmask_items) { for (l in listmask_items) { if (Channels[aChan].match_list_mask (listmask_items[l])) { l_match = true; break; } } if (!l_match) continue; } // We made it. if (list.add_flags&LIST_DISPLAY_CHAN_MODES) this.numeric322(Channels[aChan],true); else this.numeric322(Channels[aChan]); } } this.numeric(323, ":End of /LIST. (Complex)");}
if (listmask && !Channels[aChan].match_list_mask(listmask)) continue;
if (listmask) listmask_items = listmask.split(","); var l_match = false; if (listmask_items) { for (l in listmask_items) { if (Channels[aChan].match_list_mask (listmask_items[l])) { l_match = true; break; } } if (!l_match) continue; }
function IRCClient_do_complex_list(cmd) { var add = true; var arg = 1; var list = new List(); var listmask; for (lc in cmd[1]) { switch(cmd[1][lc]) { case "+": if (!add) add = true; break; case "-": if (add) add = false; break; case "a": arg++; if (cmd[arg]) { list.tweak_mode(LIST_CHANMASK,add); list.Mask = cmd[arg]; } break; case "c": arg++; if (cmd[arg]) { list.tweak_mode(LIST_CREATED,add); list.Created = parseInt(cmd[arg])*60; } break; case "m": // we never set -m, inverse. arg++; if (cmd[arg]) { list.tweak_mode(LIST_MODES,true); if (!add) { var tmp_mode = ""; if((cmd[arg][0] != "+") || (cmd[arg][0] != "-") ) tmp_mode += "+"; tmp_mode += cmd[arg].replace(/[-]/g," "); tmp_mode = tmp_mode.replace(/[+]/g,"-"); list.Modes = tmp_mode.replace(/[ ]/g,"+"); } else { list.Modes = cmd[arg]; } } break; case "o": arg++; if (cmd[arg]) { list.tweak_mode(LIST_TOPIC,add); list.Topic = cmd[arg]; } break; case "p": arg++; if (cmd[arg]) { list.tweak_mode(LIST_PEOPLE,add); list.People = parseInt(cmd[arg]); } break; case "t": arg++; if (cmd[arg]) { list.tweak_mode(LIST_TOPICAGE,add); list.TopicTime = parseInt(cmd[arg])*60; } break; case "M": list.tweak_mode(LIST_DISPLAY_CHAN_MODES,add); break; default: break; } } // Generic mask atop all this crap? arg++; if (cmd[arg]) listmask = cmd[arg]; // Here we go... for (aChan in Channels) { // Is the user allowed to see this channel, for starters? if (!(Channels[aChan].mode&CHANMODE_SECRET) || (this.mode&USERMODE_OPER) || this.onchannel(aChan)) { if ((list.add_flags&LIST_CHANMASK) && !match_irc_mask(aChan,list.Mask.toUpperCase())) continue; else if ((list.del_flags&LIST_CHANMASK) && match_irc_mask(aChan,list.Mask.toUpperCase())) continue; if ((list.add_flags&LIST_CREATED) && (Channels[aChan].created < (time() - list.Created))) continue; else if ((list.del_flags&LIST_CREATED) && (Channels[aChan].created > (time() - list.Created))) continue; if ((list.add_flags&LIST_TOPIC) && (!match_irc_mask(Channels[aChan].topic,list.Topic))) continue; else if ((list.del_flags&LIST_TOPIC) && (match_irc_mask(Channels[aChan].topic,list.Topic))) continue; if ((list.add_flags&LIST_PEOPLE) && (Channels[aChan].count_users() < list.People) ) continue; else if ((list.del_flags&LIST_PEOPLE) && (Channels[aChan].count_users() >= list.People) ) continue; if ((list.add_flags&LIST_TOPICAGE) && list.TopicTime && (Channels[aChan].topictime > (time()-list.TopicTime))) continue; else if((list.del_flags&LIST_TOPICAGE)&&list.TopicTime&& (Channels[aChan].topictime < (time()-list.TopicTime))) continue; if (list.add_flags&LIST_MODES) { // there's no -m var sic = false; var madd = true; var c = Channels[aChan]; for (mm in list.Modes) { switch(list.Modes[mm]) { case "+": if (!madd) madd = true; break; case "-": if (madd) madd = false; break; case "i": if ( (!madd && (c.mode& CHANMODE_INVITE)) || (madd && !(c.mode& CHANMODE_INVITE)) ) sic = true; break; case "k": if ( (!madd && (c.mode& CHANMODE_KEY)) || (madd && !(c.mode& CHANMODE_KEY)) ) sic = true; break; case "l": if ( (!madd && (c.mode& CHANMODE_LIMIT)) || (madd && !(c.mode& CHANMODE_LIMIT)) ) sic = true; break; case "m": if ( (!madd && (c.mode& CHANMODE_MODERATED)) || (madd && !(c.mode& CHANMODE_MODERATED)) ) sic = true; break; case "n": if ( (!madd && (c.mode& CHANMODE_NOOUTSIDE)) || (madd && !(c.mode& CHANMODE_NOOUTSIDE)) ) sic = true; break; case "p": if ( (!madd && (c.mode& CHANMODE_PRIVATE)) || (madd && !(c.mode& CHANMODE_PRIVATE)) ) sic = true; break; case "s": if ( (!madd && (c.mode& CHANMODE_SECRET)) || (madd && !(c.mode& CHANMODE_SECRET)) ) sic = true; break; case "t": if ( (!madd && (c.mode& CHANMODE_TOPIC)) || (madd && !(c.mode& CHANMODE_TOPIC)) ) sic = true; break; default: break; } if (sic) break; } if (sic) continue; } if (listmask && !Channels[aChan].match_list_mask(listmask)) continue; // We made it. if (list.add_flags&LIST_DISPLAY_CHAN_MODES) this.numeric322(Channels[aChan],true); else this.numeric322(Channels[aChan]); } } this.numeric(323, ":End of /LIST. (Complex)");}
if(wc.channels[x] && (!(Channels[wc.channels[x]].mode& CHANMODE_SECRET || Channels[wc.channels[x]].mode& CHANMODE_PRIVATE ) || this.channels[wc.channels[x].toUpperCase]|| this.mode&USERMODE_OPER) ) { chan = Channels[wc.channels[x]].nam;
if (!(Channels[x].mode&CHANMODE_SECRET || Channels[x].mode&CHANMODE_PRIVATE) || this.channels[x] || this.mode&USERMODE_OPER) { chan = Channels[x].nam;
function IRCClient_do_complex_who(cmd) { var who = new Who(); var tmp; var eow = "*"; var add = true; // assume the user is doing + by default var arg = 1; var whomask = ""; var chan; // RFC1459 Compatibility. "WHO <mask> o" Only do it if we find a // wildcard, otherwise assume we're doing a complex WHO with 'modes' if (cmd[2] && ( (cmd[1].match(/[*]/)) || cmd[1].match(/[?]/)) || (cmd[1].match(/[0]/)) && !cmd[3] && (cmd[2].toLowerCase() == "o")) { tmp = cmd[1]; cmd[1] = cmd[2]; cmd[2] = tmp; } for (myflag in cmd[1]) { switch (cmd[1][myflag]) { case "+": if (!add) add = true; break; case "-": if (add) add = false; break; case "a": who.tweak_mode(WHO_AWAY,add); break; case "c": arg++; if (cmd[arg]) { who.tweak_mode(WHO_CHANNEL,add); who.Channel = cmd[arg]; } break; case "g": arg++; if (cmd[arg]) { who.tweak_mode(WHO_REALNAME,add); who.RealName = cmd[arg]; } break; case "h": arg++; if (cmd[arg]) { who.tweak_mode(WHO_HOST,add); who.Host = cmd[arg]; } break; case "i": arg++; if (cmd[arg]) { who.tweak_mode(WHO_IP,add); who.IP = cmd[arg]; } break; case "l": arg++; if (cmd[arg]) { who.tweak_mode(WHO_CLASS,add); who.Class = parseInt(cmd[arg]); } case "m": // we never set -m arg++; if (cmd[arg]) { who.tweak_mode(WHO_UMODE,true); if (!add) { var tmp_umode = ""; if ((cmd[arg][0] != "+") || (cmd[arg][0] != "-") ) tmp_umode += "+"; tmp_umode += cmd[arg].replace(/[-]/g," "); tmp_umode = tmp_umode.replace(/[+]/g,"-"); who.UMode = tmp_umode.replace(/[ ]/g,"+"); } else { who.UMode = cmd[arg]; } } break; case "n": arg++; if (cmd[arg]) { who.Nick = cmd[arg]; who.tweak_mode(WHO_NICK,add); } break; case "o": who.tweak_mode(WHO_OPER,add); break; case "s": arg++; if (cmd[arg]) { who.Server = cmd[arg]; who.tweak_mode(WHO_SERVER,add); } break; case "t": arg++; if (cmd[arg]) { who.Time = parseInt(cmd[arg]); who.tweak_mode(WHO_TIME,add); } break; case "u": arg++; if (cmd[arg]) { who.User = cmd[arg]; who.tweak_mode(WHO_USER,add); } break; case "C": who.tweak_mode(WHO_FIRST_CHANNEL,add); break; case "M": who.tweak_mode(WHO_MEMBER_CHANNEL,add); break; case "I": who.tweak_mode(WHO_SHOW_IPS_ONLY,add); break; default: break; } } // Check to see if the user passed a generic mask to us for processing. arg++; if (cmd[arg]) whomask = cmd[arg]; var regexp = "^[0]{1,}$"; if (whomask.match(regexp)) whomask = "*"; // allow +c/-c to override. if (!who.Channel && ((whomask[0] == "#") || (whomask[0] == "&"))) who.Channel = whomask; // Strip off any @ or + in front of a channel and set the flags. var sf_op = false; var sf_voice = false; var sf_done = false; var tmp_wc = who.Channel; for (cc in tmp_wc) { switch(tmp_wc[cc]) { case "@": sf_op = true; who.Channel = who.Channel.slice(1); break; case "+": sf_voice = true; who.Channel = who.Channel.slice(1); break; default: // assume we're done sf_done = true; break; } if (sf_done) break; } delete tmp_wc; // don't need this anymore. // Now we traverse everything and apply the criteria the user passed. var who_count = 0; for (who_client in Users) { var wc = Users[who_client]; var flag_M = this.onchanwith(wc); // Don't even bother if the target is +i and the // user isn't an oper or on a channel with the target. if ( (wc.mode&USERMODE_INVISIBLE) && !(this.mode&USERMODE_OPER) && !flag_M) continue; if ((who.add_flags&WHO_AWAY) && !wc.away) continue; else if ((who.del_flags&WHO_AWAY) && wc.away) continue; if (who.add_flags&WHO_CHANNEL) { if (!wc.channels[who.Channel.toUpperCase()]) continue; if (sf_op && Channels[who.Channel.toUpperCase()]&& !Channels[who.Channel.toUpperCase()].modelist [CHANMODE_OP][wc.id]) continue; if(sf_voice&&Channels[who.Channel.toUpperCase()]&& !Channels[who.Channel.toUpperCase()].modelist [CHANMODE_VOICE][wc.id]) continue; } else if (who.del_flags&WHO_CHANNEL) { if (wc.channels[who.Channel.toUpperCase()]) continue; if (sf_op && Channels[who.Channel.toUpperCase()]&& Channels[who.Channel.toUpperCase()].modelist [CHANMODE_OP][wc.id]) continue; if(sf_voice&&Channels[who.Channel.toUpperCase()]&& Channels[who.Channel.toUpperCase()].modelist [CHANMODE_VOICE][wc.id]) continue; } if ((who.add_flags&WHO_REALNAME) && !wildmatch(wc.realname,who.RealName)) continue; else if ((who.del_flags&WHO_REALNAME) && wildmatch(wc.realname,who.RealName)) continue; if ((who.add_flags&WHO_HOST) && !wildmatch(wc.hostname,who.Host)) continue; else if ((who.del_flags&WHO_HOST) && wildmatch(wc.hostname,who.Host)) continue; if ((who.add_flags&WHO_IP) && !wildmatch(wc.ip,who.IP)) continue; else if ((who.del_flags&WHO_IP) && wildmatch(wc.ip,who.IP)) continue; if (who.add_flags&WHO_UMODE) { // no -m var sic = false; var madd = true; for (mm in who.UMode) { switch(who.UMode[mm]) { case "+": if (!madd) madd = true; break; case "-": if (madd) madd = false; break; case "o": case "i": case "w": case "b": case "g": case "s": case "c": case "r": case "k": case "f": case "y": case "d": case "n": case "h": case "F": if ( (!madd && (wc.mode& USERMODE_CHAR [who.UMode[mm]]) ) || (madd && !(wc.mode& USERMODE_CHAR [who.UMode[mm]]) ) ) sic = true; break; default: break; } if (sic) break; } if (sic) continue; } if ((who.add_flags&WHO_NICK) && !wildmatch(wc.nick,who.Nick)) continue; else if ((who.del_flags&WHO_NICK) && wildmatch(wc.nick,who.Nick)) continue; if ((who.add_flags&WHO_OPER) && !(wc.mode&USERMODE_OPER)) continue; else if ((who.del_flags&WHO_OPER) && (wc.mode&USERMODE_OPER)) continue; if ((who.add_flags&WHO_SERVER) && !wildmatch(wc.servername,who.Server)) continue; else if ((who.del_flags&WHO_SERVER) && wildmatch(wc.servername,who.Server)) continue; if ((who.add_flags&WHO_USER) && !wildmatch(wc.uprefix,who.User)) continue; else if ((who.del_flags&WHO_USER) && wildmatch(wc.uprefix,who.User)) continue; if ((who.add_flags&WHO_MEMBER_CHANNEL) && !flag_M) continue; else if ((who.del_flags&WHO_MEMBER_CHANNEL) && flag_M) continue; if ((who.add_flags&WHO_TIME) && ((time() - wc.connecttime) < who.Time) ) continue; else if ((who.del_flags&WHO_TIME) && ((time() - wc.connecttime) > who.Time) ) continue; if ((who.add_flags&WHO_CLASS) && (wc.ircclass != who.Class)) continue; else if ((who.del_flags&WHO_CLASS) && (wc.ircclass == who.Class)) continue; if (whomask && !wc.match_who_mask(whomask)) continue; chan = ""; if ((who.add_flags&WHO_FIRST_CHANNEL) && !who.Channel) { for (x in wc.channels) { if(wc.channels[x] && (!(Channels[wc.channels[x]].mode& CHANMODE_SECRET || Channels[wc.channels[x]].mode& CHANMODE_PRIVATE ) || this.channels[wc.channels[x].toUpperCase]|| this.mode&USERMODE_OPER) ) { chan = Channels[wc.channels[x]].nam; break; } } } if (who.Channel) chan = who.Channel; var show_ips_only; if (who.add_flags&WHO_SHOW_IPS_ONLY) show_ips_only = true; else show_ips_only = false; // If we made it this far, we're good. if (chan && Channels[chan.toUpperCase()]) { var chkwho = this.numeric352(wc,show_ips_only,Channels[chan.toUpperCase()]); if (!chkwho) umode_notice(USERMODE_OPER,"Notice","WHO returned 0 for user: " + wc.nick + " (C)"); } else { var chkwho = this.numeric352(wc,show_ips_only); if (!chkwho) umode_notice(USERMODE_OPER,"Notice","WHO returned 0 for user: " + wc.nick + " (D)"); } who_count++; if (!(this.mode&USERMODE_OPER) && (who_count >= max_who)) break; } if (who.Channel) eow = who.Channel; else if (cmd[2]) eow = cmd[2]; this.numeric(315, eow + " :End of /WHO list. (Complex)");}
} if (who.Channel)
} else if (who.Channel) {
function IRCClient_do_complex_who(cmd) { var who = new Who(); var tmp; var eow = "*"; var add = true; // assume the user is doing + by default var arg = 1; var whomask = ""; var chan; // RFC1459 Compatibility. "WHO <mask> o" Only do it if we find a // wildcard, otherwise assume we're doing a complex WHO with 'modes' if (cmd[2] && ( (cmd[1].match(/[*]/)) || cmd[1].match(/[?]/)) || (cmd[1].match(/[0]/)) && !cmd[3] && (cmd[2].toLowerCase() == "o")) { tmp = cmd[1]; cmd[1] = cmd[2]; cmd[2] = tmp; } for (myflag in cmd[1]) { switch (cmd[1][myflag]) { case "+": if (!add) add = true; break; case "-": if (add) add = false; break; case "a": who.tweak_mode(WHO_AWAY,add); break; case "c": arg++; if (cmd[arg]) { who.tweak_mode(WHO_CHANNEL,add); who.Channel = cmd[arg]; } break; case "g": arg++; if (cmd[arg]) { who.tweak_mode(WHO_REALNAME,add); who.RealName = cmd[arg]; } break; case "h": arg++; if (cmd[arg]) { who.tweak_mode(WHO_HOST,add); who.Host = cmd[arg]; } break; case "i": arg++; if (cmd[arg]) { who.tweak_mode(WHO_IP,add); who.IP = cmd[arg]; } break; case "l": arg++; if (cmd[arg]) { who.tweak_mode(WHO_CLASS,add); who.Class = parseInt(cmd[arg]); } case "m": // we never set -m arg++; if (cmd[arg]) { who.tweak_mode(WHO_UMODE,true); if (!add) { var tmp_umode = ""; if ((cmd[arg][0] != "+") || (cmd[arg][0] != "-") ) tmp_umode += "+"; tmp_umode += cmd[arg].replace(/[-]/g," "); tmp_umode = tmp_umode.replace(/[+]/g,"-"); who.UMode = tmp_umode.replace(/[ ]/g,"+"); } else { who.UMode = cmd[arg]; } } break; case "n": arg++; if (cmd[arg]) { who.Nick = cmd[arg]; who.tweak_mode(WHO_NICK,add); } break; case "o": who.tweak_mode(WHO_OPER,add); break; case "s": arg++; if (cmd[arg]) { who.Server = cmd[arg]; who.tweak_mode(WHO_SERVER,add); } break; case "t": arg++; if (cmd[arg]) { who.Time = parseInt(cmd[arg]); who.tweak_mode(WHO_TIME,add); } break; case "u": arg++; if (cmd[arg]) { who.User = cmd[arg]; who.tweak_mode(WHO_USER,add); } break; case "C": who.tweak_mode(WHO_FIRST_CHANNEL,add); break; case "M": who.tweak_mode(WHO_MEMBER_CHANNEL,add); break; case "I": who.tweak_mode(WHO_SHOW_IPS_ONLY,add); break; default: break; } } // Check to see if the user passed a generic mask to us for processing. arg++; if (cmd[arg]) whomask = cmd[arg]; var regexp = "^[0]{1,}$"; if (whomask.match(regexp)) whomask = "*"; // allow +c/-c to override. if (!who.Channel && ((whomask[0] == "#") || (whomask[0] == "&"))) who.Channel = whomask; // Strip off any @ or + in front of a channel and set the flags. var sf_op = false; var sf_voice = false; var sf_done = false; var tmp_wc = who.Channel; for (cc in tmp_wc) { switch(tmp_wc[cc]) { case "@": sf_op = true; who.Channel = who.Channel.slice(1); break; case "+": sf_voice = true; who.Channel = who.Channel.slice(1); break; default: // assume we're done sf_done = true; break; } if (sf_done) break; } delete tmp_wc; // don't need this anymore. // Now we traverse everything and apply the criteria the user passed. var who_count = 0; for (who_client in Users) { var wc = Users[who_client]; var flag_M = this.onchanwith(wc); // Don't even bother if the target is +i and the // user isn't an oper or on a channel with the target. if ( (wc.mode&USERMODE_INVISIBLE) && !(this.mode&USERMODE_OPER) && !flag_M) continue; if ((who.add_flags&WHO_AWAY) && !wc.away) continue; else if ((who.del_flags&WHO_AWAY) && wc.away) continue; if (who.add_flags&WHO_CHANNEL) { if (!wc.channels[who.Channel.toUpperCase()]) continue; if (sf_op && Channels[who.Channel.toUpperCase()]&& !Channels[who.Channel.toUpperCase()].modelist [CHANMODE_OP][wc.id]) continue; if(sf_voice&&Channels[who.Channel.toUpperCase()]&& !Channels[who.Channel.toUpperCase()].modelist [CHANMODE_VOICE][wc.id]) continue; } else if (who.del_flags&WHO_CHANNEL) { if (wc.channels[who.Channel.toUpperCase()]) continue; if (sf_op && Channels[who.Channel.toUpperCase()]&& Channels[who.Channel.toUpperCase()].modelist [CHANMODE_OP][wc.id]) continue; if(sf_voice&&Channels[who.Channel.toUpperCase()]&& Channels[who.Channel.toUpperCase()].modelist [CHANMODE_VOICE][wc.id]) continue; } if ((who.add_flags&WHO_REALNAME) && !wildmatch(wc.realname,who.RealName)) continue; else if ((who.del_flags&WHO_REALNAME) && wildmatch(wc.realname,who.RealName)) continue; if ((who.add_flags&WHO_HOST) && !wildmatch(wc.hostname,who.Host)) continue; else if ((who.del_flags&WHO_HOST) && wildmatch(wc.hostname,who.Host)) continue; if ((who.add_flags&WHO_IP) && !wildmatch(wc.ip,who.IP)) continue; else if ((who.del_flags&WHO_IP) && wildmatch(wc.ip,who.IP)) continue; if (who.add_flags&WHO_UMODE) { // no -m var sic = false; var madd = true; for (mm in who.UMode) { switch(who.UMode[mm]) { case "+": if (!madd) madd = true; break; case "-": if (madd) madd = false; break; case "o": case "i": case "w": case "b": case "g": case "s": case "c": case "r": case "k": case "f": case "y": case "d": case "n": case "h": case "F": if ( (!madd && (wc.mode& USERMODE_CHAR [who.UMode[mm]]) ) || (madd && !(wc.mode& USERMODE_CHAR [who.UMode[mm]]) ) ) sic = true; break; default: break; } if (sic) break; } if (sic) continue; } if ((who.add_flags&WHO_NICK) && !wildmatch(wc.nick,who.Nick)) continue; else if ((who.del_flags&WHO_NICK) && wildmatch(wc.nick,who.Nick)) continue; if ((who.add_flags&WHO_OPER) && !(wc.mode&USERMODE_OPER)) continue; else if ((who.del_flags&WHO_OPER) && (wc.mode&USERMODE_OPER)) continue; if ((who.add_flags&WHO_SERVER) && !wildmatch(wc.servername,who.Server)) continue; else if ((who.del_flags&WHO_SERVER) && wildmatch(wc.servername,who.Server)) continue; if ((who.add_flags&WHO_USER) && !wildmatch(wc.uprefix,who.User)) continue; else if ((who.del_flags&WHO_USER) && wildmatch(wc.uprefix,who.User)) continue; if ((who.add_flags&WHO_MEMBER_CHANNEL) && !flag_M) continue; else if ((who.del_flags&WHO_MEMBER_CHANNEL) && flag_M) continue; if ((who.add_flags&WHO_TIME) && ((time() - wc.connecttime) < who.Time) ) continue; else if ((who.del_flags&WHO_TIME) && ((time() - wc.connecttime) > who.Time) ) continue; if ((who.add_flags&WHO_CLASS) && (wc.ircclass != who.Class)) continue; else if ((who.del_flags&WHO_CLASS) && (wc.ircclass == who.Class)) continue; if (whomask && !wc.match_who_mask(whomask)) continue; chan = ""; if ((who.add_flags&WHO_FIRST_CHANNEL) && !who.Channel) { for (x in wc.channels) { if(wc.channels[x] && (!(Channels[wc.channels[x]].mode& CHANMODE_SECRET || Channels[wc.channels[x]].mode& CHANMODE_PRIVATE ) || this.channels[wc.channels[x].toUpperCase]|| this.mode&USERMODE_OPER) ) { chan = Channels[wc.channels[x]].nam; break; } } } if (who.Channel) chan = who.Channel; var show_ips_only; if (who.add_flags&WHO_SHOW_IPS_ONLY) show_ips_only = true; else show_ips_only = false; // If we made it this far, we're good. if (chan && Channels[chan.toUpperCase()]) { var chkwho = this.numeric352(wc,show_ips_only,Channels[chan.toUpperCase()]); if (!chkwho) umode_notice(USERMODE_OPER,"Notice","WHO returned 0 for user: " + wc.nick + " (C)"); } else { var chkwho = this.numeric352(wc,show_ips_only); if (!chkwho) umode_notice(USERMODE_OPER,"Notice","WHO returned 0 for user: " + wc.nick + " (D)"); } who_count++; if (!(this.mode&USERMODE_OPER) && (who_count >= max_who)) break; } if (who.Channel) eow = who.Channel; else if (cmd[2]) eow = cmd[2]; this.numeric(315, eow + " :End of /WHO list. (Complex)");}
var chkwho = this.numeric352(wc,show_ips_only,Channels[chan.toUpperCase()]); if (!chkwho) umode_notice(USERMODE_OPER,"Notice","WHO returned 0 for user: " + wc.nick + " (C)");
var chkwho = this.numeric352(wc,show_ips_only, Channels[chan.toUpperCase()]); if (!chkwho) { umode_notice(USERMODE_OPER,"Notice", "WHO returned 0 for user: " + wc.nick + " (C)"); }
function IRCClient_do_complex_who(cmd) { var who = new Who(); var tmp; var eow = "*"; var add = true; // assume the user is doing + by default var arg = 1; var whomask = ""; var chan; // RFC1459 Compatibility. "WHO <mask> o" Only do it if we find a // wildcard, otherwise assume we're doing a complex WHO with 'modes' if (cmd[2] && ( (cmd[1].match(/[*]/)) || cmd[1].match(/[?]/)) || (cmd[1].match(/[0]/)) && !cmd[3] && (cmd[2].toLowerCase() == "o")) { tmp = cmd[1]; cmd[1] = cmd[2]; cmd[2] = tmp; } for (myflag in cmd[1]) { switch (cmd[1][myflag]) { case "+": if (!add) add = true; break; case "-": if (add) add = false; break; case "a": who.tweak_mode(WHO_AWAY,add); break; case "c": arg++; if (cmd[arg]) { who.tweak_mode(WHO_CHANNEL,add); who.Channel = cmd[arg]; } break; case "g": arg++; if (cmd[arg]) { who.tweak_mode(WHO_REALNAME,add); who.RealName = cmd[arg]; } break; case "h": arg++; if (cmd[arg]) { who.tweak_mode(WHO_HOST,add); who.Host = cmd[arg]; } break; case "i": arg++; if (cmd[arg]) { who.tweak_mode(WHO_IP,add); who.IP = cmd[arg]; } break; case "l": arg++; if (cmd[arg]) { who.tweak_mode(WHO_CLASS,add); who.Class = parseInt(cmd[arg]); } case "m": // we never set -m arg++; if (cmd[arg]) { who.tweak_mode(WHO_UMODE,true); if (!add) { var tmp_umode = ""; if ((cmd[arg][0] != "+") || (cmd[arg][0] != "-") ) tmp_umode += "+"; tmp_umode += cmd[arg].replace(/[-]/g," "); tmp_umode = tmp_umode.replace(/[+]/g,"-"); who.UMode = tmp_umode.replace(/[ ]/g,"+"); } else { who.UMode = cmd[arg]; } } break; case "n": arg++; if (cmd[arg]) { who.Nick = cmd[arg]; who.tweak_mode(WHO_NICK,add); } break; case "o": who.tweak_mode(WHO_OPER,add); break; case "s": arg++; if (cmd[arg]) { who.Server = cmd[arg]; who.tweak_mode(WHO_SERVER,add); } break; case "t": arg++; if (cmd[arg]) { who.Time = parseInt(cmd[arg]); who.tweak_mode(WHO_TIME,add); } break; case "u": arg++; if (cmd[arg]) { who.User = cmd[arg]; who.tweak_mode(WHO_USER,add); } break; case "C": who.tweak_mode(WHO_FIRST_CHANNEL,add); break; case "M": who.tweak_mode(WHO_MEMBER_CHANNEL,add); break; case "I": who.tweak_mode(WHO_SHOW_IPS_ONLY,add); break; default: break; } } // Check to see if the user passed a generic mask to us for processing. arg++; if (cmd[arg]) whomask = cmd[arg]; var regexp = "^[0]{1,}$"; if (whomask.match(regexp)) whomask = "*"; // allow +c/-c to override. if (!who.Channel && ((whomask[0] == "#") || (whomask[0] == "&"))) who.Channel = whomask; // Strip off any @ or + in front of a channel and set the flags. var sf_op = false; var sf_voice = false; var sf_done = false; var tmp_wc = who.Channel; for (cc in tmp_wc) { switch(tmp_wc[cc]) { case "@": sf_op = true; who.Channel = who.Channel.slice(1); break; case "+": sf_voice = true; who.Channel = who.Channel.slice(1); break; default: // assume we're done sf_done = true; break; } if (sf_done) break; } delete tmp_wc; // don't need this anymore. // Now we traverse everything and apply the criteria the user passed. var who_count = 0; for (who_client in Users) { var wc = Users[who_client]; var flag_M = this.onchanwith(wc); // Don't even bother if the target is +i and the // user isn't an oper or on a channel with the target. if ( (wc.mode&USERMODE_INVISIBLE) && !(this.mode&USERMODE_OPER) && !flag_M) continue; if ((who.add_flags&WHO_AWAY) && !wc.away) continue; else if ((who.del_flags&WHO_AWAY) && wc.away) continue; if (who.add_flags&WHO_CHANNEL) { if (!wc.channels[who.Channel.toUpperCase()]) continue; if (sf_op && Channels[who.Channel.toUpperCase()]&& !Channels[who.Channel.toUpperCase()].modelist [CHANMODE_OP][wc.id]) continue; if(sf_voice&&Channels[who.Channel.toUpperCase()]&& !Channels[who.Channel.toUpperCase()].modelist [CHANMODE_VOICE][wc.id]) continue; } else if (who.del_flags&WHO_CHANNEL) { if (wc.channels[who.Channel.toUpperCase()]) continue; if (sf_op && Channels[who.Channel.toUpperCase()]&& Channels[who.Channel.toUpperCase()].modelist [CHANMODE_OP][wc.id]) continue; if(sf_voice&&Channels[who.Channel.toUpperCase()]&& Channels[who.Channel.toUpperCase()].modelist [CHANMODE_VOICE][wc.id]) continue; } if ((who.add_flags&WHO_REALNAME) && !wildmatch(wc.realname,who.RealName)) continue; else if ((who.del_flags&WHO_REALNAME) && wildmatch(wc.realname,who.RealName)) continue; if ((who.add_flags&WHO_HOST) && !wildmatch(wc.hostname,who.Host)) continue; else if ((who.del_flags&WHO_HOST) && wildmatch(wc.hostname,who.Host)) continue; if ((who.add_flags&WHO_IP) && !wildmatch(wc.ip,who.IP)) continue; else if ((who.del_flags&WHO_IP) && wildmatch(wc.ip,who.IP)) continue; if (who.add_flags&WHO_UMODE) { // no -m var sic = false; var madd = true; for (mm in who.UMode) { switch(who.UMode[mm]) { case "+": if (!madd) madd = true; break; case "-": if (madd) madd = false; break; case "o": case "i": case "w": case "b": case "g": case "s": case "c": case "r": case "k": case "f": case "y": case "d": case "n": case "h": case "F": if ( (!madd && (wc.mode& USERMODE_CHAR [who.UMode[mm]]) ) || (madd && !(wc.mode& USERMODE_CHAR [who.UMode[mm]]) ) ) sic = true; break; default: break; } if (sic) break; } if (sic) continue; } if ((who.add_flags&WHO_NICK) && !wildmatch(wc.nick,who.Nick)) continue; else if ((who.del_flags&WHO_NICK) && wildmatch(wc.nick,who.Nick)) continue; if ((who.add_flags&WHO_OPER) && !(wc.mode&USERMODE_OPER)) continue; else if ((who.del_flags&WHO_OPER) && (wc.mode&USERMODE_OPER)) continue; if ((who.add_flags&WHO_SERVER) && !wildmatch(wc.servername,who.Server)) continue; else if ((who.del_flags&WHO_SERVER) && wildmatch(wc.servername,who.Server)) continue; if ((who.add_flags&WHO_USER) && !wildmatch(wc.uprefix,who.User)) continue; else if ((who.del_flags&WHO_USER) && wildmatch(wc.uprefix,who.User)) continue; if ((who.add_flags&WHO_MEMBER_CHANNEL) && !flag_M) continue; else if ((who.del_flags&WHO_MEMBER_CHANNEL) && flag_M) continue; if ((who.add_flags&WHO_TIME) && ((time() - wc.connecttime) < who.Time) ) continue; else if ((who.del_flags&WHO_TIME) && ((time() - wc.connecttime) > who.Time) ) continue; if ((who.add_flags&WHO_CLASS) && (wc.ircclass != who.Class)) continue; else if ((who.del_flags&WHO_CLASS) && (wc.ircclass == who.Class)) continue; if (whomask && !wc.match_who_mask(whomask)) continue; chan = ""; if ((who.add_flags&WHO_FIRST_CHANNEL) && !who.Channel) { for (x in wc.channels) { if(wc.channels[x] && (!(Channels[wc.channels[x]].mode& CHANMODE_SECRET || Channels[wc.channels[x]].mode& CHANMODE_PRIVATE ) || this.channels[wc.channels[x].toUpperCase]|| this.mode&USERMODE_OPER) ) { chan = Channels[wc.channels[x]].nam; break; } } } if (who.Channel) chan = who.Channel; var show_ips_only; if (who.add_flags&WHO_SHOW_IPS_ONLY) show_ips_only = true; else show_ips_only = false; // If we made it this far, we're good. if (chan && Channels[chan.toUpperCase()]) { var chkwho = this.numeric352(wc,show_ips_only,Channels[chan.toUpperCase()]); if (!chkwho) umode_notice(USERMODE_OPER,"Notice","WHO returned 0 for user: " + wc.nick + " (C)"); } else { var chkwho = this.numeric352(wc,show_ips_only); if (!chkwho) umode_notice(USERMODE_OPER,"Notice","WHO returned 0 for user: " + wc.nick + " (D)"); } who_count++; if (!(this.mode&USERMODE_OPER) && (who_count >= max_who)) break; } if (who.Channel) eow = who.Channel; else if (cmd[2]) eow = cmd[2]; this.numeric(315, eow + " :End of /WHO list. (Complex)");}
if (!chkwho) umode_notice(USERMODE_OPER,"Notice","WHO returned 0 for user: " + wc.nick + " (D)");
if (!chkwho) { umode_notice(USERMODE_OPER,"Notice", "WHO returned 0 for user: " + wc.nick + " (D)"); }
function IRCClient_do_complex_who(cmd) { var who = new Who(); var tmp; var eow = "*"; var add = true; // assume the user is doing + by default var arg = 1; var whomask = ""; var chan; // RFC1459 Compatibility. "WHO <mask> o" Only do it if we find a // wildcard, otherwise assume we're doing a complex WHO with 'modes' if (cmd[2] && ( (cmd[1].match(/[*]/)) || cmd[1].match(/[?]/)) || (cmd[1].match(/[0]/)) && !cmd[3] && (cmd[2].toLowerCase() == "o")) { tmp = cmd[1]; cmd[1] = cmd[2]; cmd[2] = tmp; } for (myflag in cmd[1]) { switch (cmd[1][myflag]) { case "+": if (!add) add = true; break; case "-": if (add) add = false; break; case "a": who.tweak_mode(WHO_AWAY,add); break; case "c": arg++; if (cmd[arg]) { who.tweak_mode(WHO_CHANNEL,add); who.Channel = cmd[arg]; } break; case "g": arg++; if (cmd[arg]) { who.tweak_mode(WHO_REALNAME,add); who.RealName = cmd[arg]; } break; case "h": arg++; if (cmd[arg]) { who.tweak_mode(WHO_HOST,add); who.Host = cmd[arg]; } break; case "i": arg++; if (cmd[arg]) { who.tweak_mode(WHO_IP,add); who.IP = cmd[arg]; } break; case "l": arg++; if (cmd[arg]) { who.tweak_mode(WHO_CLASS,add); who.Class = parseInt(cmd[arg]); } case "m": // we never set -m arg++; if (cmd[arg]) { who.tweak_mode(WHO_UMODE,true); if (!add) { var tmp_umode = ""; if ((cmd[arg][0] != "+") || (cmd[arg][0] != "-") ) tmp_umode += "+"; tmp_umode += cmd[arg].replace(/[-]/g," "); tmp_umode = tmp_umode.replace(/[+]/g,"-"); who.UMode = tmp_umode.replace(/[ ]/g,"+"); } else { who.UMode = cmd[arg]; } } break; case "n": arg++; if (cmd[arg]) { who.Nick = cmd[arg]; who.tweak_mode(WHO_NICK,add); } break; case "o": who.tweak_mode(WHO_OPER,add); break; case "s": arg++; if (cmd[arg]) { who.Server = cmd[arg]; who.tweak_mode(WHO_SERVER,add); } break; case "t": arg++; if (cmd[arg]) { who.Time = parseInt(cmd[arg]); who.tweak_mode(WHO_TIME,add); } break; case "u": arg++; if (cmd[arg]) { who.User = cmd[arg]; who.tweak_mode(WHO_USER,add); } break; case "C": who.tweak_mode(WHO_FIRST_CHANNEL,add); break; case "M": who.tweak_mode(WHO_MEMBER_CHANNEL,add); break; case "I": who.tweak_mode(WHO_SHOW_IPS_ONLY,add); break; default: break; } } // Check to see if the user passed a generic mask to us for processing. arg++; if (cmd[arg]) whomask = cmd[arg]; var regexp = "^[0]{1,}$"; if (whomask.match(regexp)) whomask = "*"; // allow +c/-c to override. if (!who.Channel && ((whomask[0] == "#") || (whomask[0] == "&"))) who.Channel = whomask; // Strip off any @ or + in front of a channel and set the flags. var sf_op = false; var sf_voice = false; var sf_done = false; var tmp_wc = who.Channel; for (cc in tmp_wc) { switch(tmp_wc[cc]) { case "@": sf_op = true; who.Channel = who.Channel.slice(1); break; case "+": sf_voice = true; who.Channel = who.Channel.slice(1); break; default: // assume we're done sf_done = true; break; } if (sf_done) break; } delete tmp_wc; // don't need this anymore. // Now we traverse everything and apply the criteria the user passed. var who_count = 0; for (who_client in Users) { var wc = Users[who_client]; var flag_M = this.onchanwith(wc); // Don't even bother if the target is +i and the // user isn't an oper or on a channel with the target. if ( (wc.mode&USERMODE_INVISIBLE) && !(this.mode&USERMODE_OPER) && !flag_M) continue; if ((who.add_flags&WHO_AWAY) && !wc.away) continue; else if ((who.del_flags&WHO_AWAY) && wc.away) continue; if (who.add_flags&WHO_CHANNEL) { if (!wc.channels[who.Channel.toUpperCase()]) continue; if (sf_op && Channels[who.Channel.toUpperCase()]&& !Channels[who.Channel.toUpperCase()].modelist [CHANMODE_OP][wc.id]) continue; if(sf_voice&&Channels[who.Channel.toUpperCase()]&& !Channels[who.Channel.toUpperCase()].modelist [CHANMODE_VOICE][wc.id]) continue; } else if (who.del_flags&WHO_CHANNEL) { if (wc.channels[who.Channel.toUpperCase()]) continue; if (sf_op && Channels[who.Channel.toUpperCase()]&& Channels[who.Channel.toUpperCase()].modelist [CHANMODE_OP][wc.id]) continue; if(sf_voice&&Channels[who.Channel.toUpperCase()]&& Channels[who.Channel.toUpperCase()].modelist [CHANMODE_VOICE][wc.id]) continue; } if ((who.add_flags&WHO_REALNAME) && !wildmatch(wc.realname,who.RealName)) continue; else if ((who.del_flags&WHO_REALNAME) && wildmatch(wc.realname,who.RealName)) continue; if ((who.add_flags&WHO_HOST) && !wildmatch(wc.hostname,who.Host)) continue; else if ((who.del_flags&WHO_HOST) && wildmatch(wc.hostname,who.Host)) continue; if ((who.add_flags&WHO_IP) && !wildmatch(wc.ip,who.IP)) continue; else if ((who.del_flags&WHO_IP) && wildmatch(wc.ip,who.IP)) continue; if (who.add_flags&WHO_UMODE) { // no -m var sic = false; var madd = true; for (mm in who.UMode) { switch(who.UMode[mm]) { case "+": if (!madd) madd = true; break; case "-": if (madd) madd = false; break; case "o": case "i": case "w": case "b": case "g": case "s": case "c": case "r": case "k": case "f": case "y": case "d": case "n": case "h": case "F": if ( (!madd && (wc.mode& USERMODE_CHAR [who.UMode[mm]]) ) || (madd && !(wc.mode& USERMODE_CHAR [who.UMode[mm]]) ) ) sic = true; break; default: break; } if (sic) break; } if (sic) continue; } if ((who.add_flags&WHO_NICK) && !wildmatch(wc.nick,who.Nick)) continue; else if ((who.del_flags&WHO_NICK) && wildmatch(wc.nick,who.Nick)) continue; if ((who.add_flags&WHO_OPER) && !(wc.mode&USERMODE_OPER)) continue; else if ((who.del_flags&WHO_OPER) && (wc.mode&USERMODE_OPER)) continue; if ((who.add_flags&WHO_SERVER) && !wildmatch(wc.servername,who.Server)) continue; else if ((who.del_flags&WHO_SERVER) && wildmatch(wc.servername,who.Server)) continue; if ((who.add_flags&WHO_USER) && !wildmatch(wc.uprefix,who.User)) continue; else if ((who.del_flags&WHO_USER) && wildmatch(wc.uprefix,who.User)) continue; if ((who.add_flags&WHO_MEMBER_CHANNEL) && !flag_M) continue; else if ((who.del_flags&WHO_MEMBER_CHANNEL) && flag_M) continue; if ((who.add_flags&WHO_TIME) && ((time() - wc.connecttime) < who.Time) ) continue; else if ((who.del_flags&WHO_TIME) && ((time() - wc.connecttime) > who.Time) ) continue; if ((who.add_flags&WHO_CLASS) && (wc.ircclass != who.Class)) continue; else if ((who.del_flags&WHO_CLASS) && (wc.ircclass == who.Class)) continue; if (whomask && !wc.match_who_mask(whomask)) continue; chan = ""; if ((who.add_flags&WHO_FIRST_CHANNEL) && !who.Channel) { for (x in wc.channels) { if(wc.channels[x] && (!(Channels[wc.channels[x]].mode& CHANMODE_SECRET || Channels[wc.channels[x]].mode& CHANMODE_PRIVATE ) || this.channels[wc.channels[x].toUpperCase]|| this.mode&USERMODE_OPER) ) { chan = Channels[wc.channels[x]].nam; break; } } } if (who.Channel) chan = who.Channel; var show_ips_only; if (who.add_flags&WHO_SHOW_IPS_ONLY) show_ips_only = true; else show_ips_only = false; // If we made it this far, we're good. if (chan && Channels[chan.toUpperCase()]) { var chkwho = this.numeric352(wc,show_ips_only,Channels[chan.toUpperCase()]); if (!chkwho) umode_notice(USERMODE_OPER,"Notice","WHO returned 0 for user: " + wc.nick + " (C)"); } else { var chkwho = this.numeric352(wc,show_ips_only); if (!chkwho) umode_notice(USERMODE_OPER,"Notice","WHO returned 0 for user: " + wc.nick + " (D)"); } who_count++; if (!(this.mode&USERMODE_OPER) && (who_count >= max_who)) break; } if (who.Channel) eow = who.Channel; else if (cmd[2]) eow = cmd[2]; this.numeric(315, eow + " :End of /WHO list. (Complex)");}
if (sic) break;
function IRCClient_do_complex_who(cmd) { var who = new Who(); var tmp; var eow = "*"; var add = true; // assume the user is doing + by default var arg = 1; var whomask = ""; var chan; if (cmd[2] && cmd[2].toLowerCase() == "o") { // RFC1459 Compatibility. tmp = cmd[1]; cmd[1] = cmd[2]; cmd[2] = tmp; } for (myflag in cmd[1]) { switch (cmd[1][myflag]) { case "+": if (!add) add = true; break; case "-": if (add) add = false; break; case "a": who.tweak_mode(WHO_AWAY,add); break; case "c": arg++; if (cmd[arg]) { who.tweak_mode(WHO_CHANNEL,add); who.Channel = cmd[arg]; } break; case "g": arg++; if (cmd[arg]) { who.tweak_mode(WHO_REALNAME,add); who.RealName = cmd[arg]; } break; case "h": arg++; if (cmd[arg]) { who.tweak_mode(WHO_HOST,add); who.Host = cmd[arg]; } break; case "i": arg++; if (cmd[arg]) { who.tweak_mode(WHO_IP,add); who.IP = cmd[arg]; } break; case "l": arg++; if (cmd[arg]) { who.tweak_mode(WHO_CLASS,add); who.Class = parseInt(cmd[arg]); } case "m": // we never set -m arg++; if (cmd[arg]) { who.tweak_mode(WHO_UMODE,true); if (!add) { var tmp_umode = ""; if ((cmd[arg][0] != "+") || (cmd[arg][0] != "-") ) tmp_umode += "+"; tmp_umode += cmd[arg].replace(/[-]/g," "); tmp_umode = tmp_umode.replace(/[+]/g,"-"); who.UMode = tmp_umode.replace(/[ ]/g,"+"); } else { who.UMode = cmd[arg]; } } break; case "n": arg++; if (cmd[arg]) { who.Nick = cmd[arg]; who.tweak_mode(WHO_NICK,add); } break; case "o": who.tweak_mode(WHO_OPER,add); break; case "s": arg++; if (cmd[arg]) { who.Server = cmd[arg]; who.tweak_mode(WHO_SERVER,add); } break; case "t": arg++; if (cmd[arg]) { who.Time = parseInt(cmd[arg]); who.tweak_mode(WHO_TIME,add); } break; case "u": arg++; if (cmd[arg]) { who.User = cmd[arg]; who.tweak_mode(WHO_USER,add); } break; case "C": who.tweak_mode(WHO_FIRST_CHANNEL,add); break; case "M": who.tweak_mode(WHO_MEMBER_CHANNEL,add); break; case "I": who.tweak_mode(WHO_SHOW_IPS_ONLY,add); break; default: break; } } // Check to see if the user passed a generic mask to us for processing. arg++; if (cmd[arg]) whomask = cmd[arg]; // allow +c/-c to override. if (!who.Channel && ((whomask[0] == "#") || (whomask[0] == "&"))) who.Channel = whomask; // Strip off any @ or + in front of a channel and set the flags. var sf_op = false; var sf_voice = false; var sf_done = false; var tmp_wc = who.Channel; for (cc in tmp_wc) { switch(tmp_wc[cc]) { case "@": sf_op = true; who.Channel = who.Channel.slice(1); break; case "+": sf_voice = true; who.Channel = who.Channel.slice(1); break; default: // assume we're done sf_done = true; break; } if (sf_done) break; } delete tmp_wc; // don't need this anymore. // Now we traverse everything and apply the criteria the user passed. var who_count = 0; for (who_client in Clients) { if (Clients[who_client] && !Clients[who_client].server && ( (Clients[who_client].conntype > 1) && (Clients[who_client].conntype < 4) ) ) { var wc = Clients[who_client]; var flag_M = this.onchanwith(wc); // Don't even bother if the target is +i and the // user isn't an oper or on a channel with the target. if ( (wc.mode&USERMODE_INVISIBLE) && (!(this.mode&USERMODE_OPER) || !flag_M) ) continue; if ((who.add_flags&WHO_AWAY) && !wc.away) continue; else if ((who.del_flags&WHO_AWAY) && wc.away) continue; if (who.add_flags&WHO_CHANNEL) { if (!wc.onchannel(who.Channel.toUpperCase())) continue; if (sf_op && Channels[who.Channel.toUpperCase()]&& !Channels[who.Channel.toUpperCase()].ismode( wc.id,CHANLIST_OP)) continue; if(sf_voice&&Channels[who.Channel.toUpperCase()]&& !Channels[who.Channel.toUpperCase()].ismode( wc.id,CHANLIST_VOICE)) continue; } else if (who.del_flags&WHO_CHANNEL) { if (wc.onchannel(who.Channel.toUpperCase())) continue; if (sf_op && Channels[who.Channel.toUpperCase()]&& Channels[who.Channel.toUpperCase()].ismode( wc.id,CHANLIST_OP)) continue; if(sf_voice&&Channels[who.Channel.toUpperCase()]&& Channels[who.Channel.toUpperCase()].ismode( wc.id,CHANLIST_VOICE)) continue; } if ((who.add_flags&WHO_REALNAME) && !match_irc_mask(wc.realname,who.RealName)) continue; else if ((who.del_flags&WHO_REALNAME) && match_irc_mask(wc.realname,who.RealName)) continue; if ((who.add_flags&WHO_HOST) && !match_irc_mask(wc.hostname,who.Host)) continue; else if ((who.del_flags&WHO_HOST) && match_irc_mask(wc.hostname,who.Host)) continue; if ((who.add_flags&WHO_IP) && !match_irc_mask(wc.ip,who.IP)) continue; else if ((who.del_flags&WHO_IP) && match_irc_mask(wc.ip,who.IP)) continue; if (who.add_flags&WHO_UMODE) { // no -m var sic = false; var madd = true; for (mm in who.UMode) { switch(who.UMode[mm]) { case "+": if (!madd) madd = true; break; case "-": if (madd) madd = false; break; case "o": if ( (!madd && (wc.mode& USERMODE_OPER)) || (madd && !(wc.mode& USERMODE_OPER)) ) sic = true; break; case "i": if ( (!madd && (wc.mode& USERMODE_INVISIBLE)) || (madd && !(wc.mode& USERMODE_INVISIBLE)) ) sic = true; break; default: break; } } if (sic) continue; } if ((who.add_flags&WHO_NICK) && !match_irc_mask(wc.nick,who.Nick)) continue; else if ((who.del_flags&WHO_NICK) && match_irc_mask(wc.nick,who.Nick)) continue; if ((who.add_flags&WHO_OPER) && !(wc.mode&USERMODE_OPER)) continue; else if ((who.del_flags&WHO_OPER) && (wc.mode&USERMODE_OPER)) continue; if ((who.add_flags&WHO_SERVER) && !match_irc_mask(wc.servername,who.Server)) continue; else if ((who.del_flags&WHO_SERVER) && match_irc_mask(wc.servername,who.Server)) continue; if ((who.add_flags&WHO_USER) && !match_irc_mask(wc.uprefix,who.User)) continue; else if ((who.del_flags&WHO_USER) && match_irc_mask(wc.uprefix,who.User)) continue; if ((who.add_flags&WHO_MEMBER_CHANNEL) && !flag_M) continue; else if ((who.del_flags&WHO_MEMBER_CHANNEL) && flag_M) continue; if ((who.add_flags&WHO_TIME) && ((time() - wc.connecttime) < who.Time) ) continue; else if ((who.del_flags&WHO_TIME) && ((time() - wc.connecttime) > who.Time) ) continue; if ((who.add_flags&WHO_CLASS) && (wc.ircclass != who.Class)) continue; else if ((who.del_flags&WHO_CLASS) && (wc.ircclass == who.Class)) continue; if (whomask && !wc.match_who_mask(whomask)) continue; chan = ""; if ((who.add_flags&WHO_FIRST_CHANNEL) && !who.Channel) { for (x in wc.channels) { if(wc.channels[x] && (!(Channels[wc.channels[x]].mode& CHANMODE_SECRET || Channels[wc.channels[x]].mode& CHANMODE_PRIVATE ) || this.onchannel(wc.channels[x])|| this.mode&USERMODE_OPER) ) { chan = Channels[wc.channels[x]].nam; break; } } } if (who.Channel) chan = who.Channel; var show_ips_only; if (who.add_flags&WHO_SHOW_IPS_ONLY) show_ips_only = true; else show_ips_only = false; // If we made it this far, we're good. if (chan && Channels[chan.toUpperCase()]) this.numeric352(wc,show_ips_only,Channels[chan.toUpperCase()]); else this.numeric352(wc,show_ips_only); who_count++; } if (!(this.mode&USERMODE_OPER) && (who_count >= max_who)) break; } if (who.Channel) eow = who.Channel; else if (cmd[2]) eow = cmd[2]; this.numeric(315, eow + " :End of /WHO list. (Complex)");}
wc.id,CHANLIST_OP))
wc.id,CHANMODE_OP))
function IRCClient_do_complex_who(cmd) { var who = new Who(); var tmp; var eow = "*"; var add = true; // assume the user is doing + by default var arg = 1; var whomask = ""; var chan; if (cmd[2] && cmd[2].toLowerCase() == "o") { // RFC1459 Compatibility. tmp = cmd[1]; cmd[1] = cmd[2]; cmd[2] = tmp; } for (myflag in cmd[1]) { switch (cmd[1][myflag]) { case "+": if (!add) add = true; break; case "-": if (add) add = false; break; case "a": who.tweak_mode(WHO_AWAY,add); break; case "c": arg++; if (cmd[arg]) { who.tweak_mode(WHO_CHANNEL,add); who.Channel = cmd[arg]; } break; case "g": arg++; if (cmd[arg]) { who.tweak_mode(WHO_REALNAME,add); who.RealName = cmd[arg]; } break; case "h": arg++; if (cmd[arg]) { who.tweak_mode(WHO_HOST,add); who.Host = cmd[arg]; } break; case "i": arg++; if (cmd[arg]) { who.tweak_mode(WHO_IP,add); who.IP = cmd[arg]; } break; case "l": arg++; if (cmd[arg]) { who.tweak_mode(WHO_CLASS,add); who.Class = parseInt(cmd[arg]); } case "m": // we never set -m arg++; if (cmd[arg]) { who.tweak_mode(WHO_UMODE,true); if (!add) { var tmp_umode = ""; if ((cmd[arg][0] != "+") || (cmd[arg][0] != "-") ) tmp_umode += "+"; tmp_umode += cmd[arg].replace(/[-]/g," "); tmp_umode = tmp_umode.replace(/[+]/g,"-"); who.UMode = tmp_umode.replace(/[ ]/g,"+"); } else { who.UMode = cmd[arg]; } } break; case "n": arg++; if (cmd[arg]) { who.Nick = cmd[arg]; who.tweak_mode(WHO_NICK,add); } break; case "o": who.tweak_mode(WHO_OPER,add); break; case "s": arg++; if (cmd[arg]) { who.Server = cmd[arg]; who.tweak_mode(WHO_SERVER,add); } break; case "t": arg++; if (cmd[arg]) { who.Time = parseInt(cmd[arg]); who.tweak_mode(WHO_TIME,add); } break; case "u": arg++; if (cmd[arg]) { who.User = cmd[arg]; who.tweak_mode(WHO_USER,add); } break; case "C": who.tweak_mode(WHO_FIRST_CHANNEL,add); break; case "M": who.tweak_mode(WHO_MEMBER_CHANNEL,add); break; case "I": who.tweak_mode(WHO_SHOW_IPS_ONLY,add); break; default: break; } } // Check to see if the user passed a generic mask to us for processing. arg++; if (cmd[arg]) whomask = cmd[arg]; var regexp = "^[0]{1,}$"; if (whomask.match(regexp)) whomask = "*"; // allow +c/-c to override. if (!who.Channel && ((whomask[0] == "#") || (whomask[0] == "&"))) who.Channel = whomask; // Strip off any @ or + in front of a channel and set the flags. var sf_op = false; var sf_voice = false; var sf_done = false; var tmp_wc = who.Channel; for (cc in tmp_wc) { switch(tmp_wc[cc]) { case "@": sf_op = true; who.Channel = who.Channel.slice(1); break; case "+": sf_voice = true; who.Channel = who.Channel.slice(1); break; default: // assume we're done sf_done = true; break; } if (sf_done) break; } delete tmp_wc; // don't need this anymore. // Now we traverse everything and apply the criteria the user passed. var who_count = 0; for (who_client in Clients) { if (Clients[who_client] && !Clients[who_client].server && ( (Clients[who_client].conntype > 1) && (Clients[who_client].conntype < 4) ) ) { var wc = Clients[who_client]; var flag_M = this.onchanwith(wc); // Don't even bother if the target is +i and the // user isn't an oper or on a channel with the target. if ( (wc.mode&USERMODE_INVISIBLE) && (!(this.mode&USERMODE_OPER) || !flag_M) ) continue; if ((who.add_flags&WHO_AWAY) && !wc.away) continue; else if ((who.del_flags&WHO_AWAY) && wc.away) continue; if (who.add_flags&WHO_CHANNEL) { if (!wc.onchannel(who.Channel.toUpperCase())) continue; if (sf_op && Channels[who.Channel.toUpperCase()]&& !Channels[who.Channel.toUpperCase()].ismode( wc.id,CHANLIST_OP)) continue; if(sf_voice&&Channels[who.Channel.toUpperCase()]&& !Channels[who.Channel.toUpperCase()].ismode( wc.id,CHANLIST_VOICE)) continue; } else if (who.del_flags&WHO_CHANNEL) { if (wc.onchannel(who.Channel.toUpperCase())) continue; if (sf_op && Channels[who.Channel.toUpperCase()]&& Channels[who.Channel.toUpperCase()].ismode( wc.id,CHANLIST_OP)) continue; if(sf_voice&&Channels[who.Channel.toUpperCase()]&& Channels[who.Channel.toUpperCase()].ismode( wc.id,CHANLIST_VOICE)) continue; } if ((who.add_flags&WHO_REALNAME) && !match_irc_mask(wc.realname,who.RealName)) continue; else if ((who.del_flags&WHO_REALNAME) && match_irc_mask(wc.realname,who.RealName)) continue; if ((who.add_flags&WHO_HOST) && !match_irc_mask(wc.hostname,who.Host)) continue; else if ((who.del_flags&WHO_HOST) && match_irc_mask(wc.hostname,who.Host)) continue; if ((who.add_flags&WHO_IP) && !match_irc_mask(wc.ip,who.IP)) continue; else if ((who.del_flags&WHO_IP) && match_irc_mask(wc.ip,who.IP)) continue; if (who.add_flags&WHO_UMODE) { // no -m var sic = false; var madd = true; for (mm in who.UMode) { switch(who.UMode[mm]) { case "+": if (!madd) madd = true; break; case "-": if (madd) madd = false; break; case "o": if ( (!madd && (wc.mode& USERMODE_OPER)) || (madd && !(wc.mode& USERMODE_OPER)) ) sic = true; break; case "i": if ( (!madd && (wc.mode& USERMODE_INVISIBLE)) || (madd && !(wc.mode& USERMODE_INVISIBLE)) ) sic = true; break; default: break; } if (sic) break; } if (sic) continue; } if ((who.add_flags&WHO_NICK) && !match_irc_mask(wc.nick,who.Nick)) continue; else if ((who.del_flags&WHO_NICK) && match_irc_mask(wc.nick,who.Nick)) continue; if ((who.add_flags&WHO_OPER) && !(wc.mode&USERMODE_OPER)) continue; else if ((who.del_flags&WHO_OPER) && (wc.mode&USERMODE_OPER)) continue; if ((who.add_flags&WHO_SERVER) && !match_irc_mask(wc.servername,who.Server)) continue; else if ((who.del_flags&WHO_SERVER) && match_irc_mask(wc.servername,who.Server)) continue; if ((who.add_flags&WHO_USER) && !match_irc_mask(wc.uprefix,who.User)) continue; else if ((who.del_flags&WHO_USER) && match_irc_mask(wc.uprefix,who.User)) continue; if ((who.add_flags&WHO_MEMBER_CHANNEL) && !flag_M) continue; else if ((who.del_flags&WHO_MEMBER_CHANNEL) && flag_M) continue; if ((who.add_flags&WHO_TIME) && ((time() - wc.connecttime) < who.Time) ) continue; else if ((who.del_flags&WHO_TIME) && ((time() - wc.connecttime) > who.Time) ) continue; if ((who.add_flags&WHO_CLASS) && (wc.ircclass != who.Class)) continue; else if ((who.del_flags&WHO_CLASS) && (wc.ircclass == who.Class)) continue; if (whomask && !wc.match_who_mask(whomask)) continue; chan = ""; if ((who.add_flags&WHO_FIRST_CHANNEL) && !who.Channel) { for (x in wc.channels) { if(wc.channels[x] && (!(Channels[wc.channels[x]].mode& CHANMODE_SECRET || Channels[wc.channels[x]].mode& CHANMODE_PRIVATE ) || this.onchannel(wc.channels[x])|| this.mode&USERMODE_OPER) ) { chan = Channels[wc.channels[x]].nam; break; } } } if (who.Channel) chan = who.Channel; var show_ips_only; if (who.add_flags&WHO_SHOW_IPS_ONLY) show_ips_only = true; else show_ips_only = false; // If we made it this far, we're good. if (chan && Channels[chan.toUpperCase()]) this.numeric352(wc,show_ips_only,Channels[chan.toUpperCase()]); else this.numeric352(wc,show_ips_only); who_count++; } if (!(this.mode&USERMODE_OPER) && (who_count >= max_who)) break; } if (who.Channel) eow = who.Channel; else if (cmd[2]) eow = cmd[2]; this.numeric(315, eow + " :End of /WHO list. (Complex)");}
wc.id,CHANLIST_VOICE))
wc.id,CHANMODE_VIOCE))
function IRCClient_do_complex_who(cmd) { var who = new Who(); var tmp; var eow = "*"; var add = true; // assume the user is doing + by default var arg = 1; var whomask = ""; var chan; if (cmd[2] && cmd[2].toLowerCase() == "o") { // RFC1459 Compatibility. tmp = cmd[1]; cmd[1] = cmd[2]; cmd[2] = tmp; } for (myflag in cmd[1]) { switch (cmd[1][myflag]) { case "+": if (!add) add = true; break; case "-": if (add) add = false; break; case "a": who.tweak_mode(WHO_AWAY,add); break; case "c": arg++; if (cmd[arg]) { who.tweak_mode(WHO_CHANNEL,add); who.Channel = cmd[arg]; } break; case "g": arg++; if (cmd[arg]) { who.tweak_mode(WHO_REALNAME,add); who.RealName = cmd[arg]; } break; case "h": arg++; if (cmd[arg]) { who.tweak_mode(WHO_HOST,add); who.Host = cmd[arg]; } break; case "i": arg++; if (cmd[arg]) { who.tweak_mode(WHO_IP,add); who.IP = cmd[arg]; } break; case "l": arg++; if (cmd[arg]) { who.tweak_mode(WHO_CLASS,add); who.Class = parseInt(cmd[arg]); } case "m": // we never set -m arg++; if (cmd[arg]) { who.tweak_mode(WHO_UMODE,true); if (!add) { var tmp_umode = ""; if ((cmd[arg][0] != "+") || (cmd[arg][0] != "-") ) tmp_umode += "+"; tmp_umode += cmd[arg].replace(/[-]/g," "); tmp_umode = tmp_umode.replace(/[+]/g,"-"); who.UMode = tmp_umode.replace(/[ ]/g,"+"); } else { who.UMode = cmd[arg]; } } break; case "n": arg++; if (cmd[arg]) { who.Nick = cmd[arg]; who.tweak_mode(WHO_NICK,add); } break; case "o": who.tweak_mode(WHO_OPER,add); break; case "s": arg++; if (cmd[arg]) { who.Server = cmd[arg]; who.tweak_mode(WHO_SERVER,add); } break; case "t": arg++; if (cmd[arg]) { who.Time = parseInt(cmd[arg]); who.tweak_mode(WHO_TIME,add); } break; case "u": arg++; if (cmd[arg]) { who.User = cmd[arg]; who.tweak_mode(WHO_USER,add); } break; case "C": who.tweak_mode(WHO_FIRST_CHANNEL,add); break; case "M": who.tweak_mode(WHO_MEMBER_CHANNEL,add); break; case "I": who.tweak_mode(WHO_SHOW_IPS_ONLY,add); break; default: break; } } // Check to see if the user passed a generic mask to us for processing. arg++; if (cmd[arg]) whomask = cmd[arg]; var regexp = "^[0]{1,}$"; if (whomask.match(regexp)) whomask = "*"; // allow +c/-c to override. if (!who.Channel && ((whomask[0] == "#") || (whomask[0] == "&"))) who.Channel = whomask; // Strip off any @ or + in front of a channel and set the flags. var sf_op = false; var sf_voice = false; var sf_done = false; var tmp_wc = who.Channel; for (cc in tmp_wc) { switch(tmp_wc[cc]) { case "@": sf_op = true; who.Channel = who.Channel.slice(1); break; case "+": sf_voice = true; who.Channel = who.Channel.slice(1); break; default: // assume we're done sf_done = true; break; } if (sf_done) break; } delete tmp_wc; // don't need this anymore. // Now we traverse everything and apply the criteria the user passed. var who_count = 0; for (who_client in Clients) { if (Clients[who_client] && !Clients[who_client].server && ( (Clients[who_client].conntype > 1) && (Clients[who_client].conntype < 4) ) ) { var wc = Clients[who_client]; var flag_M = this.onchanwith(wc); // Don't even bother if the target is +i and the // user isn't an oper or on a channel with the target. if ( (wc.mode&USERMODE_INVISIBLE) && (!(this.mode&USERMODE_OPER) || !flag_M) ) continue; if ((who.add_flags&WHO_AWAY) && !wc.away) continue; else if ((who.del_flags&WHO_AWAY) && wc.away) continue; if (who.add_flags&WHO_CHANNEL) { if (!wc.onchannel(who.Channel.toUpperCase())) continue; if (sf_op && Channels[who.Channel.toUpperCase()]&& !Channels[who.Channel.toUpperCase()].ismode( wc.id,CHANLIST_OP)) continue; if(sf_voice&&Channels[who.Channel.toUpperCase()]&& !Channels[who.Channel.toUpperCase()].ismode( wc.id,CHANLIST_VOICE)) continue; } else if (who.del_flags&WHO_CHANNEL) { if (wc.onchannel(who.Channel.toUpperCase())) continue; if (sf_op && Channels[who.Channel.toUpperCase()]&& Channels[who.Channel.toUpperCase()].ismode( wc.id,CHANLIST_OP)) continue; if(sf_voice&&Channels[who.Channel.toUpperCase()]&& Channels[who.Channel.toUpperCase()].ismode( wc.id,CHANLIST_VOICE)) continue; } if ((who.add_flags&WHO_REALNAME) && !match_irc_mask(wc.realname,who.RealName)) continue; else if ((who.del_flags&WHO_REALNAME) && match_irc_mask(wc.realname,who.RealName)) continue; if ((who.add_flags&WHO_HOST) && !match_irc_mask(wc.hostname,who.Host)) continue; else if ((who.del_flags&WHO_HOST) && match_irc_mask(wc.hostname,who.Host)) continue; if ((who.add_flags&WHO_IP) && !match_irc_mask(wc.ip,who.IP)) continue; else if ((who.del_flags&WHO_IP) && match_irc_mask(wc.ip,who.IP)) continue; if (who.add_flags&WHO_UMODE) { // no -m var sic = false; var madd = true; for (mm in who.UMode) { switch(who.UMode[mm]) { case "+": if (!madd) madd = true; break; case "-": if (madd) madd = false; break; case "o": if ( (!madd && (wc.mode& USERMODE_OPER)) || (madd && !(wc.mode& USERMODE_OPER)) ) sic = true; break; case "i": if ( (!madd && (wc.mode& USERMODE_INVISIBLE)) || (madd && !(wc.mode& USERMODE_INVISIBLE)) ) sic = true; break; default: break; } if (sic) break; } if (sic) continue; } if ((who.add_flags&WHO_NICK) && !match_irc_mask(wc.nick,who.Nick)) continue; else if ((who.del_flags&WHO_NICK) && match_irc_mask(wc.nick,who.Nick)) continue; if ((who.add_flags&WHO_OPER) && !(wc.mode&USERMODE_OPER)) continue; else if ((who.del_flags&WHO_OPER) && (wc.mode&USERMODE_OPER)) continue; if ((who.add_flags&WHO_SERVER) && !match_irc_mask(wc.servername,who.Server)) continue; else if ((who.del_flags&WHO_SERVER) && match_irc_mask(wc.servername,who.Server)) continue; if ((who.add_flags&WHO_USER) && !match_irc_mask(wc.uprefix,who.User)) continue; else if ((who.del_flags&WHO_USER) && match_irc_mask(wc.uprefix,who.User)) continue; if ((who.add_flags&WHO_MEMBER_CHANNEL) && !flag_M) continue; else if ((who.del_flags&WHO_MEMBER_CHANNEL) && flag_M) continue; if ((who.add_flags&WHO_TIME) && ((time() - wc.connecttime) < who.Time) ) continue; else if ((who.del_flags&WHO_TIME) && ((time() - wc.connecttime) > who.Time) ) continue; if ((who.add_flags&WHO_CLASS) && (wc.ircclass != who.Class)) continue; else if ((who.del_flags&WHO_CLASS) && (wc.ircclass == who.Class)) continue; if (whomask && !wc.match_who_mask(whomask)) continue; chan = ""; if ((who.add_flags&WHO_FIRST_CHANNEL) && !who.Channel) { for (x in wc.channels) { if(wc.channels[x] && (!(Channels[wc.channels[x]].mode& CHANMODE_SECRET || Channels[wc.channels[x]].mode& CHANMODE_PRIVATE ) || this.onchannel(wc.channels[x])|| this.mode&USERMODE_OPER) ) { chan = Channels[wc.channels[x]].nam; break; } } } if (who.Channel) chan = who.Channel; var show_ips_only; if (who.add_flags&WHO_SHOW_IPS_ONLY) show_ips_only = true; else show_ips_only = false; // If we made it this far, we're good. if (chan && Channels[chan.toUpperCase()]) this.numeric352(wc,show_ips_only,Channels[chan.toUpperCase()]); else this.numeric352(wc,show_ips_only); who_count++; } if (!(this.mode&USERMODE_OPER) && (who_count >= max_who)) break; } if (who.Channel) eow = who.Channel; else if (cmd[2]) eow = cmd[2]; this.numeric(315, eow + " :End of /WHO list. (Complex)");}
wc.id,CHANLIST_VOICE))
wc.id,CHANMODE_VOICE))
function IRCClient_do_complex_who(cmd) { var who = new Who(); var tmp; var eow = "*"; var add = true; // assume the user is doing + by default var arg = 1; var whomask = ""; var chan; if (cmd[2] && cmd[2].toLowerCase() == "o") { // RFC1459 Compatibility. tmp = cmd[1]; cmd[1] = cmd[2]; cmd[2] = tmp; } for (myflag in cmd[1]) { switch (cmd[1][myflag]) { case "+": if (!add) add = true; break; case "-": if (add) add = false; break; case "a": who.tweak_mode(WHO_AWAY,add); break; case "c": arg++; if (cmd[arg]) { who.tweak_mode(WHO_CHANNEL,add); who.Channel = cmd[arg]; } break; case "g": arg++; if (cmd[arg]) { who.tweak_mode(WHO_REALNAME,add); who.RealName = cmd[arg]; } break; case "h": arg++; if (cmd[arg]) { who.tweak_mode(WHO_HOST,add); who.Host = cmd[arg]; } break; case "i": arg++; if (cmd[arg]) { who.tweak_mode(WHO_IP,add); who.IP = cmd[arg]; } break; case "l": arg++; if (cmd[arg]) { who.tweak_mode(WHO_CLASS,add); who.Class = parseInt(cmd[arg]); } case "m": // we never set -m arg++; if (cmd[arg]) { who.tweak_mode(WHO_UMODE,true); if (!add) { var tmp_umode = ""; if ((cmd[arg][0] != "+") || (cmd[arg][0] != "-") ) tmp_umode += "+"; tmp_umode += cmd[arg].replace(/[-]/g," "); tmp_umode = tmp_umode.replace(/[+]/g,"-"); who.UMode = tmp_umode.replace(/[ ]/g,"+"); } else { who.UMode = cmd[arg]; } } break; case "n": arg++; if (cmd[arg]) { who.Nick = cmd[arg]; who.tweak_mode(WHO_NICK,add); } break; case "o": who.tweak_mode(WHO_OPER,add); break; case "s": arg++; if (cmd[arg]) { who.Server = cmd[arg]; who.tweak_mode(WHO_SERVER,add); } break; case "t": arg++; if (cmd[arg]) { who.Time = parseInt(cmd[arg]); who.tweak_mode(WHO_TIME,add); } break; case "u": arg++; if (cmd[arg]) { who.User = cmd[arg]; who.tweak_mode(WHO_USER,add); } break; case "C": who.tweak_mode(WHO_FIRST_CHANNEL,add); break; case "M": who.tweak_mode(WHO_MEMBER_CHANNEL,add); break; case "I": who.tweak_mode(WHO_SHOW_IPS_ONLY,add); break; default: break; } } // Check to see if the user passed a generic mask to us for processing. arg++; if (cmd[arg]) whomask = cmd[arg]; var regexp = "^[0]{1,}$"; if (whomask.match(regexp)) whomask = "*"; // allow +c/-c to override. if (!who.Channel && ((whomask[0] == "#") || (whomask[0] == "&"))) who.Channel = whomask; // Strip off any @ or + in front of a channel and set the flags. var sf_op = false; var sf_voice = false; var sf_done = false; var tmp_wc = who.Channel; for (cc in tmp_wc) { switch(tmp_wc[cc]) { case "@": sf_op = true; who.Channel = who.Channel.slice(1); break; case "+": sf_voice = true; who.Channel = who.Channel.slice(1); break; default: // assume we're done sf_done = true; break; } if (sf_done) break; } delete tmp_wc; // don't need this anymore. // Now we traverse everything and apply the criteria the user passed. var who_count = 0; for (who_client in Clients) { if (Clients[who_client] && !Clients[who_client].server && ( (Clients[who_client].conntype > 1) && (Clients[who_client].conntype < 4) ) ) { var wc = Clients[who_client]; var flag_M = this.onchanwith(wc); // Don't even bother if the target is +i and the // user isn't an oper or on a channel with the target. if ( (wc.mode&USERMODE_INVISIBLE) && (!(this.mode&USERMODE_OPER) || !flag_M) ) continue; if ((who.add_flags&WHO_AWAY) && !wc.away) continue; else if ((who.del_flags&WHO_AWAY) && wc.away) continue; if (who.add_flags&WHO_CHANNEL) { if (!wc.onchannel(who.Channel.toUpperCase())) continue; if (sf_op && Channels[who.Channel.toUpperCase()]&& !Channels[who.Channel.toUpperCase()].ismode( wc.id,CHANLIST_OP)) continue; if(sf_voice&&Channels[who.Channel.toUpperCase()]&& !Channels[who.Channel.toUpperCase()].ismode( wc.id,CHANLIST_VOICE)) continue; } else if (who.del_flags&WHO_CHANNEL) { if (wc.onchannel(who.Channel.toUpperCase())) continue; if (sf_op && Channels[who.Channel.toUpperCase()]&& Channels[who.Channel.toUpperCase()].ismode( wc.id,CHANLIST_OP)) continue; if(sf_voice&&Channels[who.Channel.toUpperCase()]&& Channels[who.Channel.toUpperCase()].ismode( wc.id,CHANLIST_VOICE)) continue; } if ((who.add_flags&WHO_REALNAME) && !match_irc_mask(wc.realname,who.RealName)) continue; else if ((who.del_flags&WHO_REALNAME) && match_irc_mask(wc.realname,who.RealName)) continue; if ((who.add_flags&WHO_HOST) && !match_irc_mask(wc.hostname,who.Host)) continue; else if ((who.del_flags&WHO_HOST) && match_irc_mask(wc.hostname,who.Host)) continue; if ((who.add_flags&WHO_IP) && !match_irc_mask(wc.ip,who.IP)) continue; else if ((who.del_flags&WHO_IP) && match_irc_mask(wc.ip,who.IP)) continue; if (who.add_flags&WHO_UMODE) { // no -m var sic = false; var madd = true; for (mm in who.UMode) { switch(who.UMode[mm]) { case "+": if (!madd) madd = true; break; case "-": if (madd) madd = false; break; case "o": if ( (!madd && (wc.mode& USERMODE_OPER)) || (madd && !(wc.mode& USERMODE_OPER)) ) sic = true; break; case "i": if ( (!madd && (wc.mode& USERMODE_INVISIBLE)) || (madd && !(wc.mode& USERMODE_INVISIBLE)) ) sic = true; break; default: break; } if (sic) break; } if (sic) continue; } if ((who.add_flags&WHO_NICK) && !match_irc_mask(wc.nick,who.Nick)) continue; else if ((who.del_flags&WHO_NICK) && match_irc_mask(wc.nick,who.Nick)) continue; if ((who.add_flags&WHO_OPER) && !(wc.mode&USERMODE_OPER)) continue; else if ((who.del_flags&WHO_OPER) && (wc.mode&USERMODE_OPER)) continue; if ((who.add_flags&WHO_SERVER) && !match_irc_mask(wc.servername,who.Server)) continue; else if ((who.del_flags&WHO_SERVER) && match_irc_mask(wc.servername,who.Server)) continue; if ((who.add_flags&WHO_USER) && !match_irc_mask(wc.uprefix,who.User)) continue; else if ((who.del_flags&WHO_USER) && match_irc_mask(wc.uprefix,who.User)) continue; if ((who.add_flags&WHO_MEMBER_CHANNEL) && !flag_M) continue; else if ((who.del_flags&WHO_MEMBER_CHANNEL) && flag_M) continue; if ((who.add_flags&WHO_TIME) && ((time() - wc.connecttime) < who.Time) ) continue; else if ((who.del_flags&WHO_TIME) && ((time() - wc.connecttime) > who.Time) ) continue; if ((who.add_flags&WHO_CLASS) && (wc.ircclass != who.Class)) continue; else if ((who.del_flags&WHO_CLASS) && (wc.ircclass == who.Class)) continue; if (whomask && !wc.match_who_mask(whomask)) continue; chan = ""; if ((who.add_flags&WHO_FIRST_CHANNEL) && !who.Channel) { for (x in wc.channels) { if(wc.channels[x] && (!(Channels[wc.channels[x]].mode& CHANMODE_SECRET || Channels[wc.channels[x]].mode& CHANMODE_PRIVATE ) || this.onchannel(wc.channels[x])|| this.mode&USERMODE_OPER) ) { chan = Channels[wc.channels[x]].nam; break; } } } if (who.Channel) chan = who.Channel; var show_ips_only; if (who.add_flags&WHO_SHOW_IPS_ONLY) show_ips_only = true; else show_ips_only = false; // If we made it this far, we're good. if (chan && Channels[chan.toUpperCase()]) this.numeric352(wc,show_ips_only,Channels[chan.toUpperCase()]); else this.numeric352(wc,show_ips_only); who_count++; } if (!(this.mode&USERMODE_OPER) && (who_count >= max_who)) break; } if (who.Channel) eow = who.Channel; else if (cmd[2]) eow = cmd[2]; this.numeric(315, eow + " :End of /WHO list. (Complex)");}
if (cmd[2] && cmd[2].toLowerCase() == "o") {
if (cmd[2] && ( (cmd[1].match(/[*]/)) || cmd[1].match(/[?]/)) || (cmd[1].match(/[0]/)) && !cmd[3] && (cmd[2].toLowerCase() == "o")) {
function IRCClient_do_complex_who(cmd) { var who = new Who(); var tmp; var eow = "*"; var add = true; // assume the user is doing + by default var arg = 1; var whomask = ""; var chan; if (cmd[2] && cmd[2].toLowerCase() == "o") { // RFC1459 Compatibility. tmp = cmd[1]; cmd[1] = cmd[2]; cmd[2] = tmp; } for (myflag in cmd[1]) { switch (cmd[1][myflag]) { case "+": if (!add) add = true; break; case "-": if (add) add = false; break; case "a": who.tweak_mode(WHO_AWAY,add); break; case "c": arg++; if (cmd[arg]) { who.tweak_mode(WHO_CHANNEL,add); who.Channel = cmd[arg]; } break; case "g": arg++; if (cmd[arg]) { who.tweak_mode(WHO_REALNAME,add); who.RealName = cmd[arg]; } break; case "h": arg++; if (cmd[arg]) { who.tweak_mode(WHO_HOST,add); who.Host = cmd[arg]; } break; case "i": arg++; if (cmd[arg]) { who.tweak_mode(WHO_IP,add); who.IP = cmd[arg]; } break; case "l": arg++; if (cmd[arg]) { who.tweak_mode(WHO_CLASS,add); who.Class = parseInt(cmd[arg]); } case "m": // we never set -m arg++; if (cmd[arg]) { who.tweak_mode(WHO_UMODE,true); if (!add) { var tmp_umode = ""; if ((cmd[arg][0] != "+") || (cmd[arg][0] != "-") ) tmp_umode += "+"; tmp_umode += cmd[arg].replace(/[-]/g," "); tmp_umode = tmp_umode.replace(/[+]/g,"-"); who.UMode = tmp_umode.replace(/[ ]/g,"+"); } else { who.UMode = cmd[arg]; } } break; case "n": arg++; if (cmd[arg]) { who.Nick = cmd[arg]; who.tweak_mode(WHO_NICK,add); } break; case "o": who.tweak_mode(WHO_OPER,add); break; case "s": arg++; if (cmd[arg]) { who.Server = cmd[arg]; who.tweak_mode(WHO_SERVER,add); } break; case "t": arg++; if (cmd[arg]) { who.Time = parseInt(cmd[arg]); who.tweak_mode(WHO_TIME,add); } break; case "u": arg++; if (cmd[arg]) { who.User = cmd[arg]; who.tweak_mode(WHO_USER,add); } break; case "C": who.tweak_mode(WHO_FIRST_CHANNEL,add); break; case "M": who.tweak_mode(WHO_MEMBER_CHANNEL,add); break; case "I": who.tweak_mode(WHO_SHOW_IPS_ONLY,add); break; default: break; } } // Check to see if the user passed a generic mask to us for processing. arg++; if (cmd[arg]) whomask = cmd[arg]; var regexp = "^[0]{1,}$"; if (whomask.match(regexp)) whomask = "*"; // allow +c/-c to override. if (!who.Channel && ((whomask[0] == "#") || (whomask[0] == "&"))) who.Channel = whomask; // Strip off any @ or + in front of a channel and set the flags. var sf_op = false; var sf_voice = false; var sf_done = false; var tmp_wc = who.Channel; for (cc in tmp_wc) { switch(tmp_wc[cc]) { case "@": sf_op = true; who.Channel = who.Channel.slice(1); break; case "+": sf_voice = true; who.Channel = who.Channel.slice(1); break; default: // assume we're done sf_done = true; break; } if (sf_done) break; } delete tmp_wc; // don't need this anymore. // Now we traverse everything and apply the criteria the user passed. var who_count = 0; for (who_client in Clients) { if (Clients[who_client] && !Clients[who_client].server && ( (Clients[who_client].conntype > 1) && (Clients[who_client].conntype < 4) ) ) { var wc = Clients[who_client]; var flag_M = this.onchanwith(wc); // Don't even bother if the target is +i and the // user isn't an oper or on a channel with the target. if ( (wc.mode&USERMODE_INVISIBLE) && (!(this.mode&USERMODE_OPER) || !flag_M) ) continue; if ((who.add_flags&WHO_AWAY) && !wc.away) continue; else if ((who.del_flags&WHO_AWAY) && wc.away) continue; if (who.add_flags&WHO_CHANNEL) { if (!wc.onchannel(who.Channel.toUpperCase())) continue; if (sf_op && Channels[who.Channel.toUpperCase()]&& !Channels[who.Channel.toUpperCase()].ismode( wc.id,CHANMODE_OP)) continue; if(sf_voice&&Channels[who.Channel.toUpperCase()]&& !Channels[who.Channel.toUpperCase()].ismode( wc.id,CHANMODE_VIOCE)) continue; } else if (who.del_flags&WHO_CHANNEL) { if (wc.onchannel(who.Channel.toUpperCase())) continue; if (sf_op && Channels[who.Channel.toUpperCase()]&& Channels[who.Channel.toUpperCase()].ismode( wc.id,CHANMODE_OP)) continue; if(sf_voice&&Channels[who.Channel.toUpperCase()]&& Channels[who.Channel.toUpperCase()].ismode( wc.id,CHANMODE_VOICE)) continue; } if ((who.add_flags&WHO_REALNAME) && !match_irc_mask(wc.realname,who.RealName)) continue; else if ((who.del_flags&WHO_REALNAME) && match_irc_mask(wc.realname,who.RealName)) continue; if ((who.add_flags&WHO_HOST) && !match_irc_mask(wc.hostname,who.Host)) continue; else if ((who.del_flags&WHO_HOST) && match_irc_mask(wc.hostname,who.Host)) continue; if ((who.add_flags&WHO_IP) && !match_irc_mask(wc.ip,who.IP)) continue; else if ((who.del_flags&WHO_IP) && match_irc_mask(wc.ip,who.IP)) continue; if (who.add_flags&WHO_UMODE) { // no -m var sic = false; var madd = true; for (mm in who.UMode) { switch(who.UMode[mm]) { case "+": if (!madd) madd = true; break; case "-": if (madd) madd = false; break; case "o": if ( (!madd && (wc.mode& USERMODE_OPER)) || (madd && !(wc.mode& USERMODE_OPER)) ) sic = true; break; case "i": if ( (!madd && (wc.mode& USERMODE_INVISIBLE)) || (madd && !(wc.mode& USERMODE_INVISIBLE)) ) sic = true; break; default: break; } if (sic) break; } if (sic) continue; } if ((who.add_flags&WHO_NICK) && !match_irc_mask(wc.nick,who.Nick)) continue; else if ((who.del_flags&WHO_NICK) && match_irc_mask(wc.nick,who.Nick)) continue; if ((who.add_flags&WHO_OPER) && !(wc.mode&USERMODE_OPER)) continue; else if ((who.del_flags&WHO_OPER) && (wc.mode&USERMODE_OPER)) continue; if ((who.add_flags&WHO_SERVER) && !match_irc_mask(wc.servername,who.Server)) continue; else if ((who.del_flags&WHO_SERVER) && match_irc_mask(wc.servername,who.Server)) continue; if ((who.add_flags&WHO_USER) && !match_irc_mask(wc.uprefix,who.User)) continue; else if ((who.del_flags&WHO_USER) && match_irc_mask(wc.uprefix,who.User)) continue; if ((who.add_flags&WHO_MEMBER_CHANNEL) && !flag_M) continue; else if ((who.del_flags&WHO_MEMBER_CHANNEL) && flag_M) continue; if ((who.add_flags&WHO_TIME) && ((time() - wc.connecttime) < who.Time) ) continue; else if ((who.del_flags&WHO_TIME) && ((time() - wc.connecttime) > who.Time) ) continue; if ((who.add_flags&WHO_CLASS) && (wc.ircclass != who.Class)) continue; else if ((who.del_flags&WHO_CLASS) && (wc.ircclass == who.Class)) continue; if (whomask && !wc.match_who_mask(whomask)) continue; chan = ""; if ((who.add_flags&WHO_FIRST_CHANNEL) && !who.Channel) { for (x in wc.channels) { if(wc.channels[x] && (!(Channels[wc.channels[x]].mode& CHANMODE_SECRET || Channels[wc.channels[x]].mode& CHANMODE_PRIVATE ) || this.onchannel(wc.channels[x])|| this.mode&USERMODE_OPER) ) { chan = Channels[wc.channels[x]].nam; break; } } } if (who.Channel) chan = who.Channel; var show_ips_only; if (who.add_flags&WHO_SHOW_IPS_ONLY) show_ips_only = true; else show_ips_only = false; // If we made it this far, we're good. if (chan && Channels[chan.toUpperCase()]) this.numeric352(wc,show_ips_only,Channels[chan.toUpperCase()]); else this.numeric352(wc,show_ips_only); who_count++; } if (!(this.mode&USERMODE_OPER) && (who_count >= max_who)) break; } if (who.Channel) eow = who.Channel; else if (cmd[2]) eow = cmd[2]; this.numeric(315, eow + " :End of /WHO list. (Complex)");}
(!(this.mode&USERMODE_OPER) || !flag_M) )
!(this.mode&USERMODE_OPER) && !flag_M)
function IRCClient_do_complex_who(cmd) { var who = new Who(); var tmp; var eow = "*"; var add = true; // assume the user is doing + by default var arg = 1; var whomask = ""; var chan; if (cmd[2] && cmd[2].toLowerCase() == "o") { // RFC1459 Compatibility. tmp = cmd[1]; cmd[1] = cmd[2]; cmd[2] = tmp; } for (myflag in cmd[1]) { switch (cmd[1][myflag]) { case "+": if (!add) add = true; break; case "-": if (add) add = false; break; case "a": who.tweak_mode(WHO_AWAY,add); break; case "c": arg++; if (cmd[arg]) { who.tweak_mode(WHO_CHANNEL,add); who.Channel = cmd[arg]; } break; case "g": arg++; if (cmd[arg]) { who.tweak_mode(WHO_REALNAME,add); who.RealName = cmd[arg]; } break; case "h": arg++; if (cmd[arg]) { who.tweak_mode(WHO_HOST,add); who.Host = cmd[arg]; } break; case "i": arg++; if (cmd[arg]) { who.tweak_mode(WHO_IP,add); who.IP = cmd[arg]; } break; case "l": arg++; if (cmd[arg]) { who.tweak_mode(WHO_CLASS,add); who.Class = parseInt(cmd[arg]); } case "m": // we never set -m arg++; if (cmd[arg]) { who.tweak_mode(WHO_UMODE,true); if (!add) { var tmp_umode = ""; if ((cmd[arg][0] != "+") || (cmd[arg][0] != "-") ) tmp_umode += "+"; tmp_umode += cmd[arg].replace(/[-]/g," "); tmp_umode = tmp_umode.replace(/[+]/g,"-"); who.UMode = tmp_umode.replace(/[ ]/g,"+"); } else { who.UMode = cmd[arg]; } } break; case "n": arg++; if (cmd[arg]) { who.Nick = cmd[arg]; who.tweak_mode(WHO_NICK,add); } break; case "o": who.tweak_mode(WHO_OPER,add); break; case "s": arg++; if (cmd[arg]) { who.Server = cmd[arg]; who.tweak_mode(WHO_SERVER,add); } break; case "t": arg++; if (cmd[arg]) { who.Time = parseInt(cmd[arg]); who.tweak_mode(WHO_TIME,add); } break; case "u": arg++; if (cmd[arg]) { who.User = cmd[arg]; who.tweak_mode(WHO_USER,add); } break; case "C": who.tweak_mode(WHO_FIRST_CHANNEL,add); break; case "M": who.tweak_mode(WHO_MEMBER_CHANNEL,add); break; case "I": who.tweak_mode(WHO_SHOW_IPS_ONLY,add); break; default: break; } } // Check to see if the user passed a generic mask to us for processing. arg++; if (cmd[arg]) whomask = cmd[arg]; var regexp = "^[0]{1,}$"; if (whomask.match(regexp)) whomask = "*"; // allow +c/-c to override. if (!who.Channel && ((whomask[0] == "#") || (whomask[0] == "&"))) who.Channel = whomask; // Strip off any @ or + in front of a channel and set the flags. var sf_op = false; var sf_voice = false; var sf_done = false; var tmp_wc = who.Channel; for (cc in tmp_wc) { switch(tmp_wc[cc]) { case "@": sf_op = true; who.Channel = who.Channel.slice(1); break; case "+": sf_voice = true; who.Channel = who.Channel.slice(1); break; default: // assume we're done sf_done = true; break; } if (sf_done) break; } delete tmp_wc; // don't need this anymore. // Now we traverse everything and apply the criteria the user passed. var who_count = 0; for (who_client in Clients) { if (Clients[who_client] && !Clients[who_client].server && ( (Clients[who_client].conntype > 1) && (Clients[who_client].conntype < 4) ) ) { var wc = Clients[who_client]; var flag_M = this.onchanwith(wc); // Don't even bother if the target is +i and the // user isn't an oper or on a channel with the target. if ( (wc.mode&USERMODE_INVISIBLE) && (!(this.mode&USERMODE_OPER) || !flag_M) ) continue; if ((who.add_flags&WHO_AWAY) && !wc.away) continue; else if ((who.del_flags&WHO_AWAY) && wc.away) continue; if (who.add_flags&WHO_CHANNEL) { if (!wc.onchannel(who.Channel.toUpperCase())) continue; if (sf_op && Channels[who.Channel.toUpperCase()]&& !Channels[who.Channel.toUpperCase()].ismode( wc.id,CHANMODE_OP)) continue; if(sf_voice&&Channels[who.Channel.toUpperCase()]&& !Channels[who.Channel.toUpperCase()].ismode( wc.id,CHANMODE_VIOCE)) continue; } else if (who.del_flags&WHO_CHANNEL) { if (wc.onchannel(who.Channel.toUpperCase())) continue; if (sf_op && Channels[who.Channel.toUpperCase()]&& Channels[who.Channel.toUpperCase()].ismode( wc.id,CHANMODE_OP)) continue; if(sf_voice&&Channels[who.Channel.toUpperCase()]&& Channels[who.Channel.toUpperCase()].ismode( wc.id,CHANMODE_VOICE)) continue; } if ((who.add_flags&WHO_REALNAME) && !match_irc_mask(wc.realname,who.RealName)) continue; else if ((who.del_flags&WHO_REALNAME) && match_irc_mask(wc.realname,who.RealName)) continue; if ((who.add_flags&WHO_HOST) && !match_irc_mask(wc.hostname,who.Host)) continue; else if ((who.del_flags&WHO_HOST) && match_irc_mask(wc.hostname,who.Host)) continue; if ((who.add_flags&WHO_IP) && !match_irc_mask(wc.ip,who.IP)) continue; else if ((who.del_flags&WHO_IP) && match_irc_mask(wc.ip,who.IP)) continue; if (who.add_flags&WHO_UMODE) { // no -m var sic = false; var madd = true; for (mm in who.UMode) { switch(who.UMode[mm]) { case "+": if (!madd) madd = true; break; case "-": if (madd) madd = false; break; case "o": if ( (!madd && (wc.mode& USERMODE_OPER)) || (madd && !(wc.mode& USERMODE_OPER)) ) sic = true; break; case "i": if ( (!madd && (wc.mode& USERMODE_INVISIBLE)) || (madd && !(wc.mode& USERMODE_INVISIBLE)) ) sic = true; break; default: break; } if (sic) break; } if (sic) continue; } if ((who.add_flags&WHO_NICK) && !match_irc_mask(wc.nick,who.Nick)) continue; else if ((who.del_flags&WHO_NICK) && match_irc_mask(wc.nick,who.Nick)) continue; if ((who.add_flags&WHO_OPER) && !(wc.mode&USERMODE_OPER)) continue; else if ((who.del_flags&WHO_OPER) && (wc.mode&USERMODE_OPER)) continue; if ((who.add_flags&WHO_SERVER) && !match_irc_mask(wc.servername,who.Server)) continue; else if ((who.del_flags&WHO_SERVER) && match_irc_mask(wc.servername,who.Server)) continue; if ((who.add_flags&WHO_USER) && !match_irc_mask(wc.uprefix,who.User)) continue; else if ((who.del_flags&WHO_USER) && match_irc_mask(wc.uprefix,who.User)) continue; if ((who.add_flags&WHO_MEMBER_CHANNEL) && !flag_M) continue; else if ((who.del_flags&WHO_MEMBER_CHANNEL) && flag_M) continue; if ((who.add_flags&WHO_TIME) && ((time() - wc.connecttime) < who.Time) ) continue; else if ((who.del_flags&WHO_TIME) && ((time() - wc.connecttime) > who.Time) ) continue; if ((who.add_flags&WHO_CLASS) && (wc.ircclass != who.Class)) continue; else if ((who.del_flags&WHO_CLASS) && (wc.ircclass == who.Class)) continue; if (whomask && !wc.match_who_mask(whomask)) continue; chan = ""; if ((who.add_flags&WHO_FIRST_CHANNEL) && !who.Channel) { for (x in wc.channels) { if(wc.channels[x] && (!(Channels[wc.channels[x]].mode& CHANMODE_SECRET || Channels[wc.channels[x]].mode& CHANMODE_PRIVATE ) || this.onchannel(wc.channels[x])|| this.mode&USERMODE_OPER) ) { chan = Channels[wc.channels[x]].nam; break; } } } if (who.Channel) chan = who.Channel; var show_ips_only; if (who.add_flags&WHO_SHOW_IPS_ONLY) show_ips_only = true; else show_ips_only = false; // If we made it this far, we're good. if (chan && Channels[chan.toUpperCase()]) this.numeric352(wc,show_ips_only,Channels[chan.toUpperCase()]); else this.numeric352(wc,show_ips_only); who_count++; } if (!(this.mode&USERMODE_OPER) && (who_count >= max_who)) break; } if (who.Channel) eow = who.Channel; else if (cmd[2]) eow = cmd[2]; this.numeric(315, eow + " :End of /WHO list. (Complex)");}
wc.id,CHANMODE_VIOCE))
wc.id,CHANMODE_VOICE))
function IRCClient_do_complex_who(cmd) { var who = new Who(); var tmp; var eow = "*"; var add = true; // assume the user is doing + by default var arg = 1; var whomask = ""; var chan; if (cmd[2] && cmd[2].toLowerCase() == "o") { // RFC1459 Compatibility. tmp = cmd[1]; cmd[1] = cmd[2]; cmd[2] = tmp; } for (myflag in cmd[1]) { switch (cmd[1][myflag]) { case "+": if (!add) add = true; break; case "-": if (add) add = false; break; case "a": who.tweak_mode(WHO_AWAY,add); break; case "c": arg++; if (cmd[arg]) { who.tweak_mode(WHO_CHANNEL,add); who.Channel = cmd[arg]; } break; case "g": arg++; if (cmd[arg]) { who.tweak_mode(WHO_REALNAME,add); who.RealName = cmd[arg]; } break; case "h": arg++; if (cmd[arg]) { who.tweak_mode(WHO_HOST,add); who.Host = cmd[arg]; } break; case "i": arg++; if (cmd[arg]) { who.tweak_mode(WHO_IP,add); who.IP = cmd[arg]; } break; case "l": arg++; if (cmd[arg]) { who.tweak_mode(WHO_CLASS,add); who.Class = parseInt(cmd[arg]); } case "m": // we never set -m arg++; if (cmd[arg]) { who.tweak_mode(WHO_UMODE,true); if (!add) { var tmp_umode = ""; if ((cmd[arg][0] != "+") || (cmd[arg][0] != "-") ) tmp_umode += "+"; tmp_umode += cmd[arg].replace(/[-]/g," "); tmp_umode = tmp_umode.replace(/[+]/g,"-"); who.UMode = tmp_umode.replace(/[ ]/g,"+"); } else { who.UMode = cmd[arg]; } } break; case "n": arg++; if (cmd[arg]) { who.Nick = cmd[arg]; who.tweak_mode(WHO_NICK,add); } break; case "o": who.tweak_mode(WHO_OPER,add); break; case "s": arg++; if (cmd[arg]) { who.Server = cmd[arg]; who.tweak_mode(WHO_SERVER,add); } break; case "t": arg++; if (cmd[arg]) { who.Time = parseInt(cmd[arg]); who.tweak_mode(WHO_TIME,add); } break; case "u": arg++; if (cmd[arg]) { who.User = cmd[arg]; who.tweak_mode(WHO_USER,add); } break; case "C": who.tweak_mode(WHO_FIRST_CHANNEL,add); break; case "M": who.tweak_mode(WHO_MEMBER_CHANNEL,add); break; case "I": who.tweak_mode(WHO_SHOW_IPS_ONLY,add); break; default: break; } } // Check to see if the user passed a generic mask to us for processing. arg++; if (cmd[arg]) whomask = cmd[arg]; var regexp = "^[0]{1,}$"; if (whomask.match(regexp)) whomask = "*"; // allow +c/-c to override. if (!who.Channel && ((whomask[0] == "#") || (whomask[0] == "&"))) who.Channel = whomask; // Strip off any @ or + in front of a channel and set the flags. var sf_op = false; var sf_voice = false; var sf_done = false; var tmp_wc = who.Channel; for (cc in tmp_wc) { switch(tmp_wc[cc]) { case "@": sf_op = true; who.Channel = who.Channel.slice(1); break; case "+": sf_voice = true; who.Channel = who.Channel.slice(1); break; default: // assume we're done sf_done = true; break; } if (sf_done) break; } delete tmp_wc; // don't need this anymore. // Now we traverse everything and apply the criteria the user passed. var who_count = 0; for (who_client in Clients) { if (Clients[who_client] && !Clients[who_client].server && ( (Clients[who_client].conntype > 1) && (Clients[who_client].conntype < 4) ) ) { var wc = Clients[who_client]; var flag_M = this.onchanwith(wc); // Don't even bother if the target is +i and the // user isn't an oper or on a channel with the target. if ( (wc.mode&USERMODE_INVISIBLE) && (!(this.mode&USERMODE_OPER) || !flag_M) ) continue; if ((who.add_flags&WHO_AWAY) && !wc.away) continue; else if ((who.del_flags&WHO_AWAY) && wc.away) continue; if (who.add_flags&WHO_CHANNEL) { if (!wc.onchannel(who.Channel.toUpperCase())) continue; if (sf_op && Channels[who.Channel.toUpperCase()]&& !Channels[who.Channel.toUpperCase()].ismode( wc.id,CHANMODE_OP)) continue; if(sf_voice&&Channels[who.Channel.toUpperCase()]&& !Channels[who.Channel.toUpperCase()].ismode( wc.id,CHANMODE_VIOCE)) continue; } else if (who.del_flags&WHO_CHANNEL) { if (wc.onchannel(who.Channel.toUpperCase())) continue; if (sf_op && Channels[who.Channel.toUpperCase()]&& Channels[who.Channel.toUpperCase()].ismode( wc.id,CHANMODE_OP)) continue; if(sf_voice&&Channels[who.Channel.toUpperCase()]&& Channels[who.Channel.toUpperCase()].ismode( wc.id,CHANMODE_VOICE)) continue; } if ((who.add_flags&WHO_REALNAME) && !match_irc_mask(wc.realname,who.RealName)) continue; else if ((who.del_flags&WHO_REALNAME) && match_irc_mask(wc.realname,who.RealName)) continue; if ((who.add_flags&WHO_HOST) && !match_irc_mask(wc.hostname,who.Host)) continue; else if ((who.del_flags&WHO_HOST) && match_irc_mask(wc.hostname,who.Host)) continue; if ((who.add_flags&WHO_IP) && !match_irc_mask(wc.ip,who.IP)) continue; else if ((who.del_flags&WHO_IP) && match_irc_mask(wc.ip,who.IP)) continue; if (who.add_flags&WHO_UMODE) { // no -m var sic = false; var madd = true; for (mm in who.UMode) { switch(who.UMode[mm]) { case "+": if (!madd) madd = true; break; case "-": if (madd) madd = false; break; case "o": if ( (!madd && (wc.mode& USERMODE_OPER)) || (madd && !(wc.mode& USERMODE_OPER)) ) sic = true; break; case "i": if ( (!madd && (wc.mode& USERMODE_INVISIBLE)) || (madd && !(wc.mode& USERMODE_INVISIBLE)) ) sic = true; break; default: break; } if (sic) break; } if (sic) continue; } if ((who.add_flags&WHO_NICK) && !match_irc_mask(wc.nick,who.Nick)) continue; else if ((who.del_flags&WHO_NICK) && match_irc_mask(wc.nick,who.Nick)) continue; if ((who.add_flags&WHO_OPER) && !(wc.mode&USERMODE_OPER)) continue; else if ((who.del_flags&WHO_OPER) && (wc.mode&USERMODE_OPER)) continue; if ((who.add_flags&WHO_SERVER) && !match_irc_mask(wc.servername,who.Server)) continue; else if ((who.del_flags&WHO_SERVER) && match_irc_mask(wc.servername,who.Server)) continue; if ((who.add_flags&WHO_USER) && !match_irc_mask(wc.uprefix,who.User)) continue; else if ((who.del_flags&WHO_USER) && match_irc_mask(wc.uprefix,who.User)) continue; if ((who.add_flags&WHO_MEMBER_CHANNEL) && !flag_M) continue; else if ((who.del_flags&WHO_MEMBER_CHANNEL) && flag_M) continue; if ((who.add_flags&WHO_TIME) && ((time() - wc.connecttime) < who.Time) ) continue; else if ((who.del_flags&WHO_TIME) && ((time() - wc.connecttime) > who.Time) ) continue; if ((who.add_flags&WHO_CLASS) && (wc.ircclass != who.Class)) continue; else if ((who.del_flags&WHO_CLASS) && (wc.ircclass == who.Class)) continue; if (whomask && !wc.match_who_mask(whomask)) continue; chan = ""; if ((who.add_flags&WHO_FIRST_CHANNEL) && !who.Channel) { for (x in wc.channels) { if(wc.channels[x] && (!(Channels[wc.channels[x]].mode& CHANMODE_SECRET || Channels[wc.channels[x]].mode& CHANMODE_PRIVATE ) || this.onchannel(wc.channels[x])|| this.mode&USERMODE_OPER) ) { chan = Channels[wc.channels[x]].nam; break; } } } if (who.Channel) chan = who.Channel; var show_ips_only; if (who.add_flags&WHO_SHOW_IPS_ONLY) show_ips_only = true; else show_ips_only = false; // If we made it this far, we're good. if (chan && Channels[chan.toUpperCase()]) this.numeric352(wc,show_ips_only,Channels[chan.toUpperCase()]); else this.numeric352(wc,show_ips_only); who_count++; } if (!(this.mode&USERMODE_OPER) && (who_count >= max_who)) break; } if (who.Channel) eow = who.Channel; else if (cmd[2]) eow = cmd[2]; this.numeric(315, eow + " :End of /WHO list. (Complex)");}
USERMODE_OPER))
USERMODE_CHAR [who.UMode[mm]]) )
function IRCClient_do_complex_who(cmd) { var who = new Who(); var tmp; var eow = "*"; var add = true; // assume the user is doing + by default var arg = 1; var whomask = ""; var chan; if (cmd[2] && cmd[2].toLowerCase() == "o") { // RFC1459 Compatibility. tmp = cmd[1]; cmd[1] = cmd[2]; cmd[2] = tmp; } for (myflag in cmd[1]) { switch (cmd[1][myflag]) { case "+": if (!add) add = true; break; case "-": if (add) add = false; break; case "a": who.tweak_mode(WHO_AWAY,add); break; case "c": arg++; if (cmd[arg]) { who.tweak_mode(WHO_CHANNEL,add); who.Channel = cmd[arg]; } break; case "g": arg++; if (cmd[arg]) { who.tweak_mode(WHO_REALNAME,add); who.RealName = cmd[arg]; } break; case "h": arg++; if (cmd[arg]) { who.tweak_mode(WHO_HOST,add); who.Host = cmd[arg]; } break; case "i": arg++; if (cmd[arg]) { who.tweak_mode(WHO_IP,add); who.IP = cmd[arg]; } break; case "l": arg++; if (cmd[arg]) { who.tweak_mode(WHO_CLASS,add); who.Class = parseInt(cmd[arg]); } case "m": // we never set -m arg++; if (cmd[arg]) { who.tweak_mode(WHO_UMODE,true); if (!add) { var tmp_umode = ""; if ((cmd[arg][0] != "+") || (cmd[arg][0] != "-") ) tmp_umode += "+"; tmp_umode += cmd[arg].replace(/[-]/g," "); tmp_umode = tmp_umode.replace(/[+]/g,"-"); who.UMode = tmp_umode.replace(/[ ]/g,"+"); } else { who.UMode = cmd[arg]; } } break; case "n": arg++; if (cmd[arg]) { who.Nick = cmd[arg]; who.tweak_mode(WHO_NICK,add); } break; case "o": who.tweak_mode(WHO_OPER,add); break; case "s": arg++; if (cmd[arg]) { who.Server = cmd[arg]; who.tweak_mode(WHO_SERVER,add); } break; case "t": arg++; if (cmd[arg]) { who.Time = parseInt(cmd[arg]); who.tweak_mode(WHO_TIME,add); } break; case "u": arg++; if (cmd[arg]) { who.User = cmd[arg]; who.tweak_mode(WHO_USER,add); } break; case "C": who.tweak_mode(WHO_FIRST_CHANNEL,add); break; case "M": who.tweak_mode(WHO_MEMBER_CHANNEL,add); break; case "I": who.tweak_mode(WHO_SHOW_IPS_ONLY,add); break; default: break; } } // Check to see if the user passed a generic mask to us for processing. arg++; if (cmd[arg]) whomask = cmd[arg]; var regexp = "^[0]{1,}$"; if (whomask.match(regexp)) whomask = "*"; // allow +c/-c to override. if (!who.Channel && ((whomask[0] == "#") || (whomask[0] == "&"))) who.Channel = whomask; // Strip off any @ or + in front of a channel and set the flags. var sf_op = false; var sf_voice = false; var sf_done = false; var tmp_wc = who.Channel; for (cc in tmp_wc) { switch(tmp_wc[cc]) { case "@": sf_op = true; who.Channel = who.Channel.slice(1); break; case "+": sf_voice = true; who.Channel = who.Channel.slice(1); break; default: // assume we're done sf_done = true; break; } if (sf_done) break; } delete tmp_wc; // don't need this anymore. // Now we traverse everything and apply the criteria the user passed. var who_count = 0; for (who_client in Clients) { if (Clients[who_client] && !Clients[who_client].server && ( (Clients[who_client].conntype > 1) && (Clients[who_client].conntype < 4) ) ) { var wc = Clients[who_client]; var flag_M = this.onchanwith(wc); // Don't even bother if the target is +i and the // user isn't an oper or on a channel with the target. if ( (wc.mode&USERMODE_INVISIBLE) && (!(this.mode&USERMODE_OPER) || !flag_M) ) continue; if ((who.add_flags&WHO_AWAY) && !wc.away) continue; else if ((who.del_flags&WHO_AWAY) && wc.away) continue; if (who.add_flags&WHO_CHANNEL) { if (!wc.onchannel(who.Channel.toUpperCase())) continue; if (sf_op && Channels[who.Channel.toUpperCase()]&& !Channels[who.Channel.toUpperCase()].ismode( wc.id,CHANMODE_OP)) continue; if(sf_voice&&Channels[who.Channel.toUpperCase()]&& !Channels[who.Channel.toUpperCase()].ismode( wc.id,CHANMODE_VIOCE)) continue; } else if (who.del_flags&WHO_CHANNEL) { if (wc.onchannel(who.Channel.toUpperCase())) continue; if (sf_op && Channels[who.Channel.toUpperCase()]&& Channels[who.Channel.toUpperCase()].ismode( wc.id,CHANMODE_OP)) continue; if(sf_voice&&Channels[who.Channel.toUpperCase()]&& Channels[who.Channel.toUpperCase()].ismode( wc.id,CHANMODE_VOICE)) continue; } if ((who.add_flags&WHO_REALNAME) && !match_irc_mask(wc.realname,who.RealName)) continue; else if ((who.del_flags&WHO_REALNAME) && match_irc_mask(wc.realname,who.RealName)) continue; if ((who.add_flags&WHO_HOST) && !match_irc_mask(wc.hostname,who.Host)) continue; else if ((who.del_flags&WHO_HOST) && match_irc_mask(wc.hostname,who.Host)) continue; if ((who.add_flags&WHO_IP) && !match_irc_mask(wc.ip,who.IP)) continue; else if ((who.del_flags&WHO_IP) && match_irc_mask(wc.ip,who.IP)) continue; if (who.add_flags&WHO_UMODE) { // no -m var sic = false; var madd = true; for (mm in who.UMode) { switch(who.UMode[mm]) { case "+": if (!madd) madd = true; break; case "-": if (madd) madd = false; break; case "o": if ( (!madd && (wc.mode& USERMODE_OPER)) || (madd && !(wc.mode& USERMODE_OPER)) ) sic = true; break; case "i": if ( (!madd && (wc.mode& USERMODE_INVISIBLE)) || (madd && !(wc.mode& USERMODE_INVISIBLE)) ) sic = true; break; default: break; } if (sic) break; } if (sic) continue; } if ((who.add_flags&WHO_NICK) && !match_irc_mask(wc.nick,who.Nick)) continue; else if ((who.del_flags&WHO_NICK) && match_irc_mask(wc.nick,who.Nick)) continue; if ((who.add_flags&WHO_OPER) && !(wc.mode&USERMODE_OPER)) continue; else if ((who.del_flags&WHO_OPER) && (wc.mode&USERMODE_OPER)) continue; if ((who.add_flags&WHO_SERVER) && !match_irc_mask(wc.servername,who.Server)) continue; else if ((who.del_flags&WHO_SERVER) && match_irc_mask(wc.servername,who.Server)) continue; if ((who.add_flags&WHO_USER) && !match_irc_mask(wc.uprefix,who.User)) continue; else if ((who.del_flags&WHO_USER) && match_irc_mask(wc.uprefix,who.User)) continue; if ((who.add_flags&WHO_MEMBER_CHANNEL) && !flag_M) continue; else if ((who.del_flags&WHO_MEMBER_CHANNEL) && flag_M) continue; if ((who.add_flags&WHO_TIME) && ((time() - wc.connecttime) < who.Time) ) continue; else if ((who.del_flags&WHO_TIME) && ((time() - wc.connecttime) > who.Time) ) continue; if ((who.add_flags&WHO_CLASS) && (wc.ircclass != who.Class)) continue; else if ((who.del_flags&WHO_CLASS) && (wc.ircclass == who.Class)) continue; if (whomask && !wc.match_who_mask(whomask)) continue; chan = ""; if ((who.add_flags&WHO_FIRST_CHANNEL) && !who.Channel) { for (x in wc.channels) { if(wc.channels[x] && (!(Channels[wc.channels[x]].mode& CHANMODE_SECRET || Channels[wc.channels[x]].mode& CHANMODE_PRIVATE ) || this.onchannel(wc.channels[x])|| this.mode&USERMODE_OPER) ) { chan = Channels[wc.channels[x]].nam; break; } } } if (who.Channel) chan = who.Channel; var show_ips_only; if (who.add_flags&WHO_SHOW_IPS_ONLY) show_ips_only = true; else show_ips_only = false; // If we made it this far, we're good. if (chan && Channels[chan.toUpperCase()]) this.numeric352(wc,show_ips_only,Channels[chan.toUpperCase()]); else this.numeric352(wc,show_ips_only); who_count++; } if (!(this.mode&USERMODE_OPER) && (who_count >= max_who)) break; } if (who.Channel) eow = who.Channel; else if (cmd[2]) eow = cmd[2]; this.numeric(315, eow + " :End of /WHO list. (Complex)");}
USERMODE_OPER)) ) sic = true; break; case "i": if ( (!madd && (wc.mode& USERMODE_INVISIBLE)) || (madd && !(wc.mode& USERMODE_INVISIBLE)) )
USERMODE_CHAR [who.UMode[mm]]) ) )
function IRCClient_do_complex_who(cmd) { var who = new Who(); var tmp; var eow = "*"; var add = true; // assume the user is doing + by default var arg = 1; var whomask = ""; var chan; if (cmd[2] && cmd[2].toLowerCase() == "o") { // RFC1459 Compatibility. tmp = cmd[1]; cmd[1] = cmd[2]; cmd[2] = tmp; } for (myflag in cmd[1]) { switch (cmd[1][myflag]) { case "+": if (!add) add = true; break; case "-": if (add) add = false; break; case "a": who.tweak_mode(WHO_AWAY,add); break; case "c": arg++; if (cmd[arg]) { who.tweak_mode(WHO_CHANNEL,add); who.Channel = cmd[arg]; } break; case "g": arg++; if (cmd[arg]) { who.tweak_mode(WHO_REALNAME,add); who.RealName = cmd[arg]; } break; case "h": arg++; if (cmd[arg]) { who.tweak_mode(WHO_HOST,add); who.Host = cmd[arg]; } break; case "i": arg++; if (cmd[arg]) { who.tweak_mode(WHO_IP,add); who.IP = cmd[arg]; } break; case "l": arg++; if (cmd[arg]) { who.tweak_mode(WHO_CLASS,add); who.Class = parseInt(cmd[arg]); } case "m": // we never set -m arg++; if (cmd[arg]) { who.tweak_mode(WHO_UMODE,true); if (!add) { var tmp_umode = ""; if ((cmd[arg][0] != "+") || (cmd[arg][0] != "-") ) tmp_umode += "+"; tmp_umode += cmd[arg].replace(/[-]/g," "); tmp_umode = tmp_umode.replace(/[+]/g,"-"); who.UMode = tmp_umode.replace(/[ ]/g,"+"); } else { who.UMode = cmd[arg]; } } break; case "n": arg++; if (cmd[arg]) { who.Nick = cmd[arg]; who.tweak_mode(WHO_NICK,add); } break; case "o": who.tweak_mode(WHO_OPER,add); break; case "s": arg++; if (cmd[arg]) { who.Server = cmd[arg]; who.tweak_mode(WHO_SERVER,add); } break; case "t": arg++; if (cmd[arg]) { who.Time = parseInt(cmd[arg]); who.tweak_mode(WHO_TIME,add); } break; case "u": arg++; if (cmd[arg]) { who.User = cmd[arg]; who.tweak_mode(WHO_USER,add); } break; case "C": who.tweak_mode(WHO_FIRST_CHANNEL,add); break; case "M": who.tweak_mode(WHO_MEMBER_CHANNEL,add); break; case "I": who.tweak_mode(WHO_SHOW_IPS_ONLY,add); break; default: break; } } // Check to see if the user passed a generic mask to us for processing. arg++; if (cmd[arg]) whomask = cmd[arg]; var regexp = "^[0]{1,}$"; if (whomask.match(regexp)) whomask = "*"; // allow +c/-c to override. if (!who.Channel && ((whomask[0] == "#") || (whomask[0] == "&"))) who.Channel = whomask; // Strip off any @ or + in front of a channel and set the flags. var sf_op = false; var sf_voice = false; var sf_done = false; var tmp_wc = who.Channel; for (cc in tmp_wc) { switch(tmp_wc[cc]) { case "@": sf_op = true; who.Channel = who.Channel.slice(1); break; case "+": sf_voice = true; who.Channel = who.Channel.slice(1); break; default: // assume we're done sf_done = true; break; } if (sf_done) break; } delete tmp_wc; // don't need this anymore. // Now we traverse everything and apply the criteria the user passed. var who_count = 0; for (who_client in Clients) { if (Clients[who_client] && !Clients[who_client].server && ( (Clients[who_client].conntype > 1) && (Clients[who_client].conntype < 4) ) ) { var wc = Clients[who_client]; var flag_M = this.onchanwith(wc); // Don't even bother if the target is +i and the // user isn't an oper or on a channel with the target. if ( (wc.mode&USERMODE_INVISIBLE) && (!(this.mode&USERMODE_OPER) || !flag_M) ) continue; if ((who.add_flags&WHO_AWAY) && !wc.away) continue; else if ((who.del_flags&WHO_AWAY) && wc.away) continue; if (who.add_flags&WHO_CHANNEL) { if (!wc.onchannel(who.Channel.toUpperCase())) continue; if (sf_op && Channels[who.Channel.toUpperCase()]&& !Channels[who.Channel.toUpperCase()].ismode( wc.id,CHANMODE_OP)) continue; if(sf_voice&&Channels[who.Channel.toUpperCase()]&& !Channels[who.Channel.toUpperCase()].ismode( wc.id,CHANMODE_VIOCE)) continue; } else if (who.del_flags&WHO_CHANNEL) { if (wc.onchannel(who.Channel.toUpperCase())) continue; if (sf_op && Channels[who.Channel.toUpperCase()]&& Channels[who.Channel.toUpperCase()].ismode( wc.id,CHANMODE_OP)) continue; if(sf_voice&&Channels[who.Channel.toUpperCase()]&& Channels[who.Channel.toUpperCase()].ismode( wc.id,CHANMODE_VOICE)) continue; } if ((who.add_flags&WHO_REALNAME) && !match_irc_mask(wc.realname,who.RealName)) continue; else if ((who.del_flags&WHO_REALNAME) && match_irc_mask(wc.realname,who.RealName)) continue; if ((who.add_flags&WHO_HOST) && !match_irc_mask(wc.hostname,who.Host)) continue; else if ((who.del_flags&WHO_HOST) && match_irc_mask(wc.hostname,who.Host)) continue; if ((who.add_flags&WHO_IP) && !match_irc_mask(wc.ip,who.IP)) continue; else if ((who.del_flags&WHO_IP) && match_irc_mask(wc.ip,who.IP)) continue; if (who.add_flags&WHO_UMODE) { // no -m var sic = false; var madd = true; for (mm in who.UMode) { switch(who.UMode[mm]) { case "+": if (!madd) madd = true; break; case "-": if (madd) madd = false; break; case "o": if ( (!madd && (wc.mode& USERMODE_OPER)) || (madd && !(wc.mode& USERMODE_OPER)) ) sic = true; break; case "i": if ( (!madd && (wc.mode& USERMODE_INVISIBLE)) || (madd && !(wc.mode& USERMODE_INVISIBLE)) ) sic = true; break; default: break; } if (sic) break; } if (sic) continue; } if ((who.add_flags&WHO_NICK) && !match_irc_mask(wc.nick,who.Nick)) continue; else if ((who.del_flags&WHO_NICK) && match_irc_mask(wc.nick,who.Nick)) continue; if ((who.add_flags&WHO_OPER) && !(wc.mode&USERMODE_OPER)) continue; else if ((who.del_flags&WHO_OPER) && (wc.mode&USERMODE_OPER)) continue; if ((who.add_flags&WHO_SERVER) && !match_irc_mask(wc.servername,who.Server)) continue; else if ((who.del_flags&WHO_SERVER) && match_irc_mask(wc.servername,who.Server)) continue; if ((who.add_flags&WHO_USER) && !match_irc_mask(wc.uprefix,who.User)) continue; else if ((who.del_flags&WHO_USER) && match_irc_mask(wc.uprefix,who.User)) continue; if ((who.add_flags&WHO_MEMBER_CHANNEL) && !flag_M) continue; else if ((who.del_flags&WHO_MEMBER_CHANNEL) && flag_M) continue; if ((who.add_flags&WHO_TIME) && ((time() - wc.connecttime) < who.Time) ) continue; else if ((who.del_flags&WHO_TIME) && ((time() - wc.connecttime) > who.Time) ) continue; if ((who.add_flags&WHO_CLASS) && (wc.ircclass != who.Class)) continue; else if ((who.del_flags&WHO_CLASS) && (wc.ircclass == who.Class)) continue; if (whomask && !wc.match_who_mask(whomask)) continue; chan = ""; if ((who.add_flags&WHO_FIRST_CHANNEL) && !who.Channel) { for (x in wc.channels) { if(wc.channels[x] && (!(Channels[wc.channels[x]].mode& CHANMODE_SECRET || Channels[wc.channels[x]].mode& CHANMODE_PRIVATE ) || this.onchannel(wc.channels[x])|| this.mode&USERMODE_OPER) ) { chan = Channels[wc.channels[x]].nam; break; } } } if (who.Channel) chan = who.Channel; var show_ips_only; if (who.add_flags&WHO_SHOW_IPS_ONLY) show_ips_only = true; else show_ips_only = false; // If we made it this far, we're good. if (chan && Channels[chan.toUpperCase()]) this.numeric352(wc,show_ips_only,Channels[chan.toUpperCase()]); else this.numeric352(wc,show_ips_only); who_count++; } if (!(this.mode&USERMODE_OPER) && (who_count >= max_who)) break; } if (who.Channel) eow = who.Channel; else if (cmd[2]) eow = cmd[2]; this.numeric(315, eow + " :End of /WHO list. (Complex)");}
log("--mark: " + wc.nick);
function IRCClient_do_complex_who(cmd) { var who = new Who(); var tmp; var eow = "*"; var add = true; // assume the user is doing + by default var arg = 1; var whomask = ""; var chan; if (cmd[2] && cmd[2].toLowerCase() == "o") { // RFC1459 Compatibility. tmp = cmd[1]; cmd[1] = cmd[2]; cmd[2] = tmp; } for (myflag in cmd[1]) { switch (cmd[1][myflag]) { case "+": if (!add) add = true; break; case "-": if (add) add = false; break; case "a": who.tweak_mode(WHO_AWAY,add); break; case "c": arg++; if (cmd[arg]) { who.tweak_mode(WHO_CHANNEL,add); who.Channel = cmd[arg]; } break; case "g": arg++; if (cmd[arg]) { who.tweak_mode(WHO_REALNAME,add); who.RealName = cmd[arg]; } break; case "h": arg++; if (cmd[arg]) { who.tweak_mode(WHO_HOST,add); who.Host = cmd[arg]; } break; case "i": arg++; if (cmd[arg]) { who.tweak_mode(WHO_IP,add); who.IP = cmd[arg]; } break; case "l": arg++; if (cmd[arg]) { who.tweak_mode(WHO_CLASS,add); who.Class = parseInt(cmd[arg]); } case "m": // we never set -m arg++; if (cmd[arg]) { who.tweak_mode(WHO_UMODE,true); if (!add) { var tmp_umode = ""; if ((cmd[arg][0] != "+") || (cmd[arg][0] != "-") ) tmp_umode += "+"; tmp_umode += cmd[arg].replace(/[-]/g," "); tmp_umode = tmp_umode.replace(/[+]/g,"-"); who.UMode = tmp_umode.replace(/[ ]/g,"+"); } else { who.UMode = cmd[arg]; } } break; case "n": arg++; if (cmd[arg]) { who.Nick = cmd[arg]; who.tweak_mode(WHO_NICK,add); } break; case "o": who.tweak_mode(WHO_OPER,add); break; case "s": arg++; if (cmd[arg]) { who.Server = cmd[arg]; who.tweak_mode(WHO_SERVER,add); } break; case "t": arg++; if (cmd[arg]) { who.Time = parseInt(cmd[arg]); who.tweak_mode(WHO_TIME,add); } break; case "u": arg++; if (cmd[arg]) { who.User = cmd[arg]; who.tweak_mode(WHO_USER,add); } break; case "C": who.tweak_mode(WHO_FIRST_CHANNEL,add); break; case "M": who.tweak_mode(WHO_MEMBER_CHANNEL,add); break; case "I": who.tweak_mode(WHO_SHOW_IPS_ONLY,add); break; default: break; } } // Check to see if the user passed a generic mask to us for processing. arg++; if (cmd[arg]) whomask = cmd[arg]; var regexp = "^[0]{1,}$"; if (whomask.match(regexp)) whomask = "*"; // allow +c/-c to override. if (!who.Channel && ((whomask[0] == "#") || (whomask[0] == "&"))) who.Channel = whomask; // Strip off any @ or + in front of a channel and set the flags. var sf_op = false; var sf_voice = false; var sf_done = false; var tmp_wc = who.Channel; for (cc in tmp_wc) { switch(tmp_wc[cc]) { case "@": sf_op = true; who.Channel = who.Channel.slice(1); break; case "+": sf_voice = true; who.Channel = who.Channel.slice(1); break; default: // assume we're done sf_done = true; break; } if (sf_done) break; } delete tmp_wc; // don't need this anymore. // Now we traverse everything and apply the criteria the user passed. var who_count = 0; for (who_client in Clients) { if (Clients[who_client] && !Clients[who_client].server && ( (Clients[who_client].conntype > 1) && (Clients[who_client].conntype < 4) ) ) { var wc = Clients[who_client]; var flag_M = this.onchanwith(wc); // Don't even bother if the target is +i and the // user isn't an oper or on a channel with the target. if ( (wc.mode&USERMODE_INVISIBLE) && (!(this.mode&USERMODE_OPER) || !flag_M) ) continue; if ((who.add_flags&WHO_AWAY) && !wc.away) continue; else if ((who.del_flags&WHO_AWAY) && wc.away) continue; if (who.add_flags&WHO_CHANNEL) { if (!wc.onchannel(who.Channel.toUpperCase())) continue; if (sf_op && Channels[who.Channel.toUpperCase()]&& !Channels[who.Channel.toUpperCase()].ismode( wc.id,CHANMODE_OP)) continue; if(sf_voice&&Channels[who.Channel.toUpperCase()]&& !Channels[who.Channel.toUpperCase()].ismode( wc.id,CHANMODE_VIOCE)) continue; } else if (who.del_flags&WHO_CHANNEL) { if (wc.onchannel(who.Channel.toUpperCase())) continue; if (sf_op && Channels[who.Channel.toUpperCase()]&& Channels[who.Channel.toUpperCase()].ismode( wc.id,CHANMODE_OP)) continue; if(sf_voice&&Channels[who.Channel.toUpperCase()]&& Channels[who.Channel.toUpperCase()].ismode( wc.id,CHANMODE_VOICE)) continue; } if ((who.add_flags&WHO_REALNAME) && !match_irc_mask(wc.realname,who.RealName)) continue; else if ((who.del_flags&WHO_REALNAME) && match_irc_mask(wc.realname,who.RealName)) continue; if ((who.add_flags&WHO_HOST) && !match_irc_mask(wc.hostname,who.Host)) continue; else if ((who.del_flags&WHO_HOST) && match_irc_mask(wc.hostname,who.Host)) continue; if ((who.add_flags&WHO_IP) && !match_irc_mask(wc.ip,who.IP)) continue; else if ((who.del_flags&WHO_IP) && match_irc_mask(wc.ip,who.IP)) continue; if (who.add_flags&WHO_UMODE) { // no -m var sic = false; var madd = true; for (mm in who.UMode) { switch(who.UMode[mm]) { case "+": if (!madd) madd = true; break; case "-": if (madd) madd = false; break; case "o": if ( (!madd && (wc.mode& USERMODE_OPER)) || (madd && !(wc.mode& USERMODE_OPER)) ) sic = true; break; case "i": if ( (!madd && (wc.mode& USERMODE_INVISIBLE)) || (madd && !(wc.mode& USERMODE_INVISIBLE)) ) sic = true; break; default: break; } if (sic) break; } if (sic) continue; } if ((who.add_flags&WHO_NICK) && !match_irc_mask(wc.nick,who.Nick)) continue; else if ((who.del_flags&WHO_NICK) && match_irc_mask(wc.nick,who.Nick)) continue; if ((who.add_flags&WHO_OPER) && !(wc.mode&USERMODE_OPER)) continue; else if ((who.del_flags&WHO_OPER) && (wc.mode&USERMODE_OPER)) continue; if ((who.add_flags&WHO_SERVER) && !match_irc_mask(wc.servername,who.Server)) continue; else if ((who.del_flags&WHO_SERVER) && match_irc_mask(wc.servername,who.Server)) continue; if ((who.add_flags&WHO_USER) && !match_irc_mask(wc.uprefix,who.User)) continue; else if ((who.del_flags&WHO_USER) && match_irc_mask(wc.uprefix,who.User)) continue; if ((who.add_flags&WHO_MEMBER_CHANNEL) && !flag_M) continue; else if ((who.del_flags&WHO_MEMBER_CHANNEL) && flag_M) continue; if ((who.add_flags&WHO_TIME) && ((time() - wc.connecttime) < who.Time) ) continue; else if ((who.del_flags&WHO_TIME) && ((time() - wc.connecttime) > who.Time) ) continue; if ((who.add_flags&WHO_CLASS) && (wc.ircclass != who.Class)) continue; else if ((who.del_flags&WHO_CLASS) && (wc.ircclass == who.Class)) continue; if (whomask && !wc.match_who_mask(whomask)) continue; chan = ""; if ((who.add_flags&WHO_FIRST_CHANNEL) && !who.Channel) { for (x in wc.channels) { if(wc.channels[x] && (!(Channels[wc.channels[x]].mode& CHANMODE_SECRET || Channels[wc.channels[x]].mode& CHANMODE_PRIVATE ) || this.onchannel(wc.channels[x])|| this.mode&USERMODE_OPER) ) { chan = Channels[wc.channels[x]].nam; break; } } } if (who.Channel) chan = who.Channel; var show_ips_only; if (who.add_flags&WHO_SHOW_IPS_ONLY) show_ips_only = true; else show_ips_only = false; // If we made it this far, we're good. if (chan && Channels[chan.toUpperCase()]) this.numeric352(wc,show_ips_only,Channels[chan.toUpperCase()]); else this.numeric352(wc,show_ips_only); who_count++; } if (!(this.mode&USERMODE_OPER) && (who_count >= max_who)) break; } if (who.Channel) eow = who.Channel; else if (cmd[2]) eow = cmd[2]; this.numeric(315, eow + " :End of /WHO list. (Complex)");}
var add;
var add = true;
function IRCClient_do_complex_who(cmd) { var who = new Who(); var tmp; var eow = "*"; var add; var arg = 1; var whomask = ""; var chan; if (cmd[2].toLowerCase() == "o") { // Compatibility with RFC1459. tmp = cmd[1]; cmd[1] = cmd[2]; cmd[2] = tmp; } for (myflag in cmd[1]) { switch (cmd[1][myflag]) { case "+": if (!add) add = true; break; case "-": if (add) add = false; break; case "a": who.tweak_mode(WHO_AWAY,add); break; case "c": arg++; if (cmd[arg]) { who.tweak_mode(WHO_CHANNEL,add); who.Channel = cmd[arg]; } break; case "g": arg++; if (cmd[arg]) { who.tweak_mode(WHO_REALNAME,add); who.RealName = cmd[arg]; } break; case "h": arg++; if (cmd[arg]) { who.tweak_mode(WHO_HOST,add); who.Host = cmd[arg]; } break; case "i": arg++; if (cmd[arg]) { who.tweak_mode(WHO_IP,add); who.IP = cmd[arg]; } break; case "m": // we never set -m arg++; if (cmd[arg]) { who.tweak_mode(WHO_UMODE,true); if (!add) { var tmp_umode = ""; if ((cmd[arg][0] != "+") || (cmd[arg][0] != "-") ) tmp_umode += "+"; tmp_umode += cmd[arg].replace(/[-]/g," "); tmp_umode = tmp_umode.replace(/[+]/g,"-"); who.UMode = tmp_umode.replace(/[ ]/g,"+"); } else { who.UMode = cmd[arg]; } } break; case "n": arg++; if (cmd[arg]) { who.Nick = cmd[arg]; who.tweak_mode(WHO_NICK,add); } break; case "o": who.tweak_mode(WHO_OPER,add); break; case "s": arg++; if (cmd[arg]) { who.Server = cmd[arg]; who.tweak_mode(WHO_SERVER,add); } break; case "u": arg++; if (cmd[arg]) { who.User = cmd[arg]; who.tweak_mode(WHO_USER,add); } break; case "C": who.tweak_mode(WHO_FIRST_CHANNEL,add); break; case "M": who.tweak_mode(WHO_MEMBER_CHANNEL,add); break; default: break; } } // Check to see if the user passed a generic mask to us for processing. arg++; if (cmd[arg]) whomask = cmd[arg]; // allow +c/-c to override. if (!who.Channel && ((whomask[0] == "#") || (whomask[0] == "&"))) who.Channel = whomask; // Now we traverse everything and apply the criteria the user passed. var who_count = 0; for (who_client in Clients) { if (Clients[who_client] && !Clients[who_client].server && ( (Clients[who_client].conntype > 1) && (Clients[who_client].conntype < 4) ) ) { var wc = Clients[who_client]; var flag_M = this.onchanwith(wc); // Don't even bother if the target is +i and the // user isn't an oper or on a channel with the target. if ( (wc.mode&USERMODE_INVISIBLE) && (!(this.mode&USERMODE_OPER) || !flag_M) ) continue; if ((who.add_flags&WHO_AWAY) && !wc.away) continue; else if ((who.del_flags&WHO_AWAY) && wc.away) continue; if ((who.add_flags&WHO_CHANNEL) && !wc.onchannel(who.Channel.toUpperCase())) continue; else if ((who.del_flags&WHO_CHANNEL) && wc.onchannel(who.Channel.toUpperCase())) continue; if ((who.add_flags&WHO_REALNAME) && !match_irc_mask(wc.realname,who.RealName)) continue; else if ((who.del_flags&WHO_REALNAME) && match_irc_mask(wc.realname,who.RealName)) continue; if ((who.add_flags&WHO_HOST) && !match_irc_mask(wc.hostname,who.Host)) continue; else if ((who.del_flags&WHO_HOST) && match_irc_mask(wc.hostname,who.Host)) continue; if ((who.add_flags&WHO_IP) && !match_irc_mask(wc.ip,who.IP)) continue; else if ((who.del_flags&WHO_IP) && match_irc_mask(wc.ip,who.IP)) continue; if (who.add_flags&WHO_UMODE) { // no -m var sic = false; var madd = true; for (mm in who.UMode) { switch(who.UMode[mm]) { case "+": if (!madd) madd = true; break; case "-": if (madd) madd = false; break; case "o": if ( (!madd && (wc.mode& USERMODE_OPER)) || (madd && !(wc.mode& USERMODE_OPER)) ) sic = true; break; case "i": if ( (!madd && (wc.mode& USERMODE_INVISIBLE)) || (madd && !(wc.mode& USERMODE_INVISIBLE)) ) sic = true; break; default: break; } } if (sic) continue; } if ((who.add_flags&WHO_NICK) && !match_irc_mask(wc.nick,who.Nick)) continue; else if ((who.del_flags&WHO_NICK) && match_irc_mask(wc.nick,who.Nick)) continue; if ((who.add_flags&WHO_OPER) && !(wc.mode&USERMODE_OPER)) continue; else if ((who.del_flags&WHO_OPER) && (wc.mode&USERMODE_OPER)) continue; if ((who.add_flags&WHO_SERVER) && !match_irc_mask(wc.servername,who.Server)) continue; else if ((who.del_flags&WHO_SERVER) && match_irc_mask(wc.servername,who.Server)) continue; if ((who.add_flags&WHO_USER) && !match_irc_mask(wc.uprefix,who.User)) continue; else if ((who.del_flags&WHO_USER) && match_irc_mask(wc.uprefix,who.User)) continue; if ((who.add_flags&WHO_MEMBER_CHANNEL) && !flag_M) continue; else if ((who.del_flags&WHO_MEMBER_CHANNEL) && flag_M) continue; if (whomask && !wc.match_who_mask(whomask)) continue; chan = ""; if ((who.add_flags&WHO_FIRST_CHANNEL) && !who.Channel) { for (x in wc.channels) { if(wc.channels[x] && (!(Channels[wc.channels[x]].mode& CHANMODE_SECRET || Channels[wc.channels[x]].mode& CHANMODE_PRIVATE ) || this.onchannel(wc.channels[x])|| this.mode&USERMODE_OPER) ) { chan = Channels[wc.channels[x]].nam; break; } } } if (who.Channel) chan = who.Channel; // If we made it this far, we're good. if (chan && Channels[chan.toUpperCase()]) this.numeric352(wc,Channels[chan.toUpperCase()]); else this.numeric352(wc); who_count++; } if (!(this.mode&USERMODE_OPER) && (who_count >= max_who)) break; } if (who.Channel) eow = who.Channel; else if (cmd[2]) eow = cmd[2]; this.numeric(315, eow + " :End of /WHO list. (Complex)");}
if (cmd[2].toLowerCase() == "o") {
if (cmd[2] && cmd[2].toLowerCase() == "o") {
function IRCClient_do_complex_who(cmd) { var who = new Who(); var tmp; var eow = "*"; var add; var arg = 1; var whomask = ""; var chan; if (cmd[2].toLowerCase() == "o") { // Compatibility with RFC1459. tmp = cmd[1]; cmd[1] = cmd[2]; cmd[2] = tmp; } for (myflag in cmd[1]) { switch (cmd[1][myflag]) { case "+": if (!add) add = true; break; case "-": if (add) add = false; break; case "a": who.tweak_mode(WHO_AWAY,add); break; case "c": arg++; if (cmd[arg]) { who.tweak_mode(WHO_CHANNEL,add); who.Channel = cmd[arg]; } break; case "g": arg++; if (cmd[arg]) { who.tweak_mode(WHO_REALNAME,add); who.RealName = cmd[arg]; } break; case "h": arg++; if (cmd[arg]) { who.tweak_mode(WHO_HOST,add); who.Host = cmd[arg]; } break; case "i": arg++; if (cmd[arg]) { who.tweak_mode(WHO_IP,add); who.IP = cmd[arg]; } break; case "m": // we never set -m arg++; if (cmd[arg]) { who.tweak_mode(WHO_UMODE,true); if (!add) { var tmp_umode = ""; if ((cmd[arg][0] != "+") || (cmd[arg][0] != "-") ) tmp_umode += "+"; tmp_umode += cmd[arg].replace(/[-]/g," "); tmp_umode = tmp_umode.replace(/[+]/g,"-"); who.UMode = tmp_umode.replace(/[ ]/g,"+"); } else { who.UMode = cmd[arg]; } } break; case "n": arg++; if (cmd[arg]) { who.Nick = cmd[arg]; who.tweak_mode(WHO_NICK,add); } break; case "o": who.tweak_mode(WHO_OPER,add); break; case "s": arg++; if (cmd[arg]) { who.Server = cmd[arg]; who.tweak_mode(WHO_SERVER,add); } break; case "u": arg++; if (cmd[arg]) { who.User = cmd[arg]; who.tweak_mode(WHO_USER,add); } break; case "C": who.tweak_mode(WHO_FIRST_CHANNEL,add); break; case "M": who.tweak_mode(WHO_MEMBER_CHANNEL,add); break; default: break; } } // Check to see if the user passed a generic mask to us for processing. arg++; if (cmd[arg]) whomask = cmd[arg]; // allow +c/-c to override. if (!who.Channel && ((whomask[0] == "#") || (whomask[0] == "&"))) who.Channel = whomask; // Now we traverse everything and apply the criteria the user passed. var who_count = 0; for (who_client in Clients) { if (Clients[who_client] && !Clients[who_client].server && ( (Clients[who_client].conntype > 1) && (Clients[who_client].conntype < 4) ) ) { var wc = Clients[who_client]; var flag_M = this.onchanwith(wc); // Don't even bother if the target is +i and the // user isn't an oper or on a channel with the target. if ( (wc.mode&USERMODE_INVISIBLE) && (!(this.mode&USERMODE_OPER) || !flag_M) ) continue; if ((who.add_flags&WHO_AWAY) && !wc.away) continue; else if ((who.del_flags&WHO_AWAY) && wc.away) continue; if ((who.add_flags&WHO_CHANNEL) && !wc.onchannel(who.Channel.toUpperCase())) continue; else if ((who.del_flags&WHO_CHANNEL) && wc.onchannel(who.Channel.toUpperCase())) continue; if ((who.add_flags&WHO_REALNAME) && !match_irc_mask(wc.realname,who.RealName)) continue; else if ((who.del_flags&WHO_REALNAME) && match_irc_mask(wc.realname,who.RealName)) continue; if ((who.add_flags&WHO_HOST) && !match_irc_mask(wc.hostname,who.Host)) continue; else if ((who.del_flags&WHO_HOST) && match_irc_mask(wc.hostname,who.Host)) continue; if ((who.add_flags&WHO_IP) && !match_irc_mask(wc.ip,who.IP)) continue; else if ((who.del_flags&WHO_IP) && match_irc_mask(wc.ip,who.IP)) continue; if (who.add_flags&WHO_UMODE) { // no -m var sic = false; var madd = true; for (mm in who.UMode) { switch(who.UMode[mm]) { case "+": if (!madd) madd = true; break; case "-": if (madd) madd = false; break; case "o": if ( (!madd && (wc.mode& USERMODE_OPER)) || (madd && !(wc.mode& USERMODE_OPER)) ) sic = true; break; case "i": if ( (!madd && (wc.mode& USERMODE_INVISIBLE)) || (madd && !(wc.mode& USERMODE_INVISIBLE)) ) sic = true; break; default: break; } } if (sic) continue; } if ((who.add_flags&WHO_NICK) && !match_irc_mask(wc.nick,who.Nick)) continue; else if ((who.del_flags&WHO_NICK) && match_irc_mask(wc.nick,who.Nick)) continue; if ((who.add_flags&WHO_OPER) && !(wc.mode&USERMODE_OPER)) continue; else if ((who.del_flags&WHO_OPER) && (wc.mode&USERMODE_OPER)) continue; if ((who.add_flags&WHO_SERVER) && !match_irc_mask(wc.servername,who.Server)) continue; else if ((who.del_flags&WHO_SERVER) && match_irc_mask(wc.servername,who.Server)) continue; if ((who.add_flags&WHO_USER) && !match_irc_mask(wc.uprefix,who.User)) continue; else if ((who.del_flags&WHO_USER) && match_irc_mask(wc.uprefix,who.User)) continue; if ((who.add_flags&WHO_MEMBER_CHANNEL) && !flag_M) continue; else if ((who.del_flags&WHO_MEMBER_CHANNEL) && flag_M) continue; if (whomask && !wc.match_who_mask(whomask)) continue; chan = ""; if ((who.add_flags&WHO_FIRST_CHANNEL) && !who.Channel) { for (x in wc.channels) { if(wc.channels[x] && (!(Channels[wc.channels[x]].mode& CHANMODE_SECRET || Channels[wc.channels[x]].mode& CHANMODE_PRIVATE ) || this.onchannel(wc.channels[x])|| this.mode&USERMODE_OPER) ) { chan = Channels[wc.channels[x]].nam; break; } } } if (who.Channel) chan = who.Channel; // If we made it this far, we're good. if (chan && Channels[chan.toUpperCase()]) this.numeric352(wc,Channels[chan.toUpperCase()]); else this.numeric352(wc); who_count++; } if (!(this.mode&USERMODE_OPER) && (who_count >= max_who)) break; } if (who.Channel) eow = who.Channel; else if (cmd[2]) eow = cmd[2]; this.numeric(315, eow + " :End of /WHO list. (Complex)");}
if (who_count >= max_who)
if (!(this.mode&USERMODE_OPER) && (who_count >= max_who))
function IRCClient_do_complex_who(cmd) { var who = new Who(); var tmp; var eow = "*"; var add; var arg = 1; var whomask = ""; var chan; if (cmd[2].toLowerCase() == "o") { // Compatibility with RFC1459. tmp = cmd[1]; cmd[1] = cmd[2]; cmd[2] = tmp; } for (myflag in cmd[1]) { switch (cmd[1][myflag]) { case "+": if (!add) add = true; break; case "-": if (add) add = false; break; case "a": who.tweak_mode(WHO_AWAY,add); break; case "c": arg++; if (cmd[arg]) { who.tweak_mode(WHO_CHANNEL,add); who.Channel = cmd[arg]; } break; case "g": arg++; if (cmd[arg]) { who.tweak_mode(WHO_REALNAME,add); who.RealName = cmd[arg]; } break; case "h": arg++; if (cmd[arg]) { who.tweak_mode(WHO_HOST,add); who.Host = cmd[arg]; } break; case "i": arg++; if (cmd[arg]) { who.tweak_mode(WHO_IP,add); who.IP = cmd[arg]; } break; case "m": // we never set -m arg++; if (cmd[arg]) { who.tweak_mode(WHO_UMODE,true); if (!add) { var tmp_umode = ""; if ((cmd[arg][0] != "+") || (cmd[arg][0] != "-") ) tmp_umode += "+"; tmp_umode += cmd[arg].replace(/[-]/g," "); tmp_umode = tmp_umode.replace(/[+]/g,"-"); who.UMode = tmp_umode.replace(/[ ]/g,"+"); } else { who.UMode = cmd[arg]; } } break; case "n": arg++; if (cmd[arg]) { who.Nick = cmd[arg]; who.tweak_mode(WHO_NICK,add); } break; case "o": who.tweak_mode(WHO_OPER,add); break; case "s": arg++; if (cmd[arg]) { who.Server = cmd[arg]; who.tweak_mode(WHO_SERVER,add); } break; case "u": arg++; if (cmd[arg]) { who.User = cmd[arg]; who.tweak_mode(WHO_USER,add); } break; case "C": who.tweak_mode(WHO_FIRST_CHANNEL,add); break; case "M": who.tweak_mode(WHO_MEMBER_CHANNEL,add); break; default: break; } } // Check to see if the user passed a generic mask to us for processing. arg++; if (cmd[arg]) whomask = cmd[arg]; // allow +c/-c to override. if (!who.Channel && ((whomask[0] == "#") || (whomask[0] == "&"))) who.Channel = whomask; // Now we traverse everything and apply the criteria the user passed. var who_count = 0; for (who_client in Clients) { if (Clients[who_client] && !Clients[who_client].server && ( (Clients[who_client].conntype > 1) && (Clients[who_client].conntype < 4) ) ) { var wc = Clients[who_client]; var flag_M = this.onchanwith(wc); // Don't even bother if the target is +i and the // user isn't an oper or on a channel with the target. if ( (wc.mode&USERMODE_INVISIBLE) && (!(this.mode&USERMODE_OPER) || !flag_M) ) continue; if ((who.add_flags&WHO_AWAY) && !wc.away) continue; else if ((who.del_flags&WHO_AWAY) && wc.away) continue; if ((who.add_flags&WHO_CHANNEL) && !wc.onchannel(who.Channel.toUpperCase())) continue; else if ((who.del_flags&WHO_CHANNEL) && wc.onchannel(who.Channel.toUpperCase())) continue; if ((who.add_flags&WHO_REALNAME) && !match_irc_mask(wc.realname,who.RealName)) continue; else if ((who.del_flags&WHO_REALNAME) && match_irc_mask(wc.realname,who.RealName)) continue; if ((who.add_flags&WHO_HOST) && !match_irc_mask(wc.hostname,who.Host)) continue; else if ((who.del_flags&WHO_HOST) && match_irc_mask(wc.hostname,who.Host)) continue; if ((who.add_flags&WHO_IP) && !match_irc_mask(wc.ip,who.IP)) continue; else if ((who.del_flags&WHO_IP) && match_irc_mask(wc.ip,who.IP)) continue; if (who.add_flags&WHO_UMODE) { // no -m var sic = false; var madd = true; for (mm in who.UMode) { switch(who.UMode[mm]) { case "+": if (!madd) madd = true; break; case "-": if (madd) madd = false; break; case "o": if ( (!madd && (wc.mode& USERMODE_OPER)) || (madd && !(wc.mode& USERMODE_OPER)) ) sic = true; break; case "i": if ( (!madd && (wc.mode& USERMODE_INVISIBLE)) || (madd && !(wc.mode& USERMODE_INVISIBLE)) ) sic = true; break; default: break; } } if (sic) continue; } if ((who.add_flags&WHO_NICK) && !match_irc_mask(wc.nick,who.Nick)) continue; else if ((who.del_flags&WHO_NICK) && match_irc_mask(wc.nick,who.Nick)) continue; if ((who.add_flags&WHO_OPER) && !(wc.mode&USERMODE_OPER)) continue; else if ((who.del_flags&WHO_OPER) && (wc.mode&USERMODE_OPER)) continue; if ((who.add_flags&WHO_SERVER) && !match_irc_mask(wc.servername,who.Server)) continue; else if ((who.del_flags&WHO_SERVER) && match_irc_mask(wc.servername,who.Server)) continue; if ((who.add_flags&WHO_USER) && !match_irc_mask(wc.uprefix,who.User)) continue; else if ((who.del_flags&WHO_USER) && match_irc_mask(wc.uprefix,who.User)) continue; if ((who.add_flags&WHO_MEMBER_CHANNEL) && !flag_M) continue; else if ((who.del_flags&WHO_MEMBER_CHANNEL) && flag_M) continue; if (whomask && !wc.match_who_mask(whomask)) continue; chan = ""; if ((who.add_flags&WHO_FIRST_CHANNEL) && !who.Channel) { for (x in wc.channels) { if(wc.channels[x] && (!(Channels[wc.channels[x]].mode& CHANMODE_SECRET || Channels[wc.channels[x]].mode& CHANMODE_PRIVATE ) || this.onchannel(wc.channels[x])|| this.mode&USERMODE_OPER) ) { chan = Channels[wc.channels[x]].nam; break; } } } if (who.Channel) chan = who.Channel; // If we made it this far, we're good. if (chan && Channels[chan.toUpperCase()]) this.numeric352(wc,Channels[chan.toUpperCase()]); else this.numeric352(wc); who_count++; } if (who_count >= max_who) break; } if (who.Channel) eow = who.Channel; else if (cmd[2]) eow = cmd[2]; this.numeric(315, eow + " :End of /WHO list. (Complex)");}
if (this.parent)
if (this.parent) {
function IRCClient_do_connect(con_server,con_port) { var con_cline = ""; for (ccl in CLines) { if (match_irc_mask(CLines[ccl].servername,con_server) || match_irc_mask(CLines[ccl].host,con_server) ) { con_cline = CLines[ccl]; break; } } if (!con_cline) { this.numeric402(con_server); return 0; } if (!con_port && con_cline.port) con_port = con_cline.port; if (!con_port && !con_cline.port) con_port = String(default_port); if (!con_port.match(/^[0-9]+$/)) { this.server_notice("Invalid port: " + con_port); return 0; } var con_type = "Local"; if (this.parent) con_type = "Remote"; oper_notice("Routing","from " + servername + ": " + con_type + " CONNECT " + con_cline.servername + " " + con_port + " from " + this.nick + "[" + this.uprefix + "@" + this.hostname + "]"); connect_to_server(con_cline,con_port); return 1;}
oper_notice("Routing","from " + servername + ": " + con_type + " CONNECT " + con_cline.servername + " " + con_port + " from " + this.nick + "[" + this.uprefix + "@" + this.hostname + "]");
server_bcast_to_servers("GNOTICE :Remote" + msg); } umode_notice(USERMODE_ROUTING,"Routing","from "+servername+": " + con_type + msg);
function IRCClient_do_connect(con_server,con_port) { var con_cline = ""; for (ccl in CLines) { if (match_irc_mask(CLines[ccl].servername,con_server) || match_irc_mask(CLines[ccl].host,con_server) ) { con_cline = CLines[ccl]; break; } } if (!con_cline) { this.numeric402(con_server); return 0; } if (!con_port && con_cline.port) con_port = con_cline.port; if (!con_port && !con_cline.port) con_port = String(default_port); if (!con_port.match(/^[0-9]+$/)) { this.server_notice("Invalid port: " + con_port); return 0; } var con_type = "Local"; if (this.parent) con_type = "Remote"; oper_notice("Routing","from " + servername + ": " + con_type + " CONNECT " + con_cline.servername + " " + con_port + " from " + this.nick + "[" + this.uprefix + "@" + this.hostname + "]"); connect_to_server(con_cline,con_port); return 1;}
this.numeric(371, ": IRCd Copyright 2003 by Randolph E. Sommerfeld <[email protected]>");
this.numeric(371, ": IRCd Copyright 2003-2004 by Randolph E. Sommerfeld <[email protected]>");
function IRCClient_do_info() { umode_notice(USERMODE_SPY,"Spy","INFO requested by " + this.nick + " (" + this.uprefix + "@" + this.hostname + ") [" + this.servername + "]"); this.numeric(371, ":--=-=-=-=-=-=-=-=-=*[ The Synchronet IRCd v1.1b ]*=-=-=-=-=-=-=-=-=--"); this.numeric(371, ": IRCd Copyright 2003 by Randolph E. Sommerfeld <[email protected]>"); this.numeric(371, ":" + system.version_notice + " " + system.copyright + "."); this.numeric(371, ":--=-=-=-=-=-=-=-=-( A big thanks to the following )-=-=-=-=-=-=-=-=--"); this.numeric(371, ":DigitalMan (Rob Swindell): Resident coder god, various hacking all"); this.numeric(371, ": around the IRCd, countless helpful suggestions and tips, and"); this.numeric(371, ": tons of additions to the Synchronet JS API that made this possible."); this.numeric(371, ":Deuce (Stephen Hurd): Resident Perl guru and Saskatchewan zealot."); this.numeric(371, ": Originally converted the IRCd to be object-oriented, various small"); this.numeric(371, ": hacks, and lots of guidance."); this.numeric(371, ":Greets to: Arrak, DWC, Foobar, Grey Fox/Zero/Unpaid, Grimp, Kufat,"); this.numeric(371, ": Palom, Psyko, Torke, and all the #square oldbies."); this.numeric(371, ":--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--"); this.numeric(371, ":Synchronet " + system.full_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)); this.numeric(371, ": - - - - - - - - - - - - - - - - - - - - - - -"); if (server.version_detail!=undefined) { this.numeric(371, ":This IRCd was executed via:"); 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, ":IRClib Version: " + IRCLIB_VERSION); this.numeric(371, ":--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--"); this.numeric(371, ":This program is distributed under the terms of the GNU General Public"); this.numeric(371, ":License, version 2. http://www.gnu.org/licenses/gpl.txt"); this.numeric(371, ":--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--"); this.numeric(374, ":End of /INFO list.");}
this.numeric(371, ":Greets to: Arrak, DWC, Foobar, Grey Fox/Zero/Unpaid, Grimp, Kufat,"); this.numeric(371, ": Palom, Psyko, Torke, and all the #square oldbies.");
this.numeric(371, ":Greets to: Arrak, Elayne, Elvish Merchant, Foobar, Grimp, Kufat,"); this.numeric(371, ": Nex, Palom, Psyko, Shaun, Torke, and all the #square oldbies.");
function IRCClient_do_info() { umode_notice(USERMODE_SPY,"Spy","INFO requested by " + this.nick + " (" + this.uprefix + "@" + this.hostname + ") [" + this.servername + "]"); this.numeric(371, ":--=-=-=-=-=-=-=-=-=*[ The Synchronet IRCd v1.1b ]*=-=-=-=-=-=-=-=-=--"); this.numeric(371, ": IRCd Copyright 2003-2005 by Randolph E. Sommerfeld <[email protected]>"); this.numeric(371, ":" + system.version_notice + " " + system.copyright + "."); this.numeric(371, ":--=-=-=-=-=-=-=-=-( A big thanks to the following )-=-=-=-=-=-=-=-=--"); this.numeric(371, ":DigitalMan (Rob Swindell): Resident coder god, various hacking all"); this.numeric(371, ": around the IRCd, countless helpful suggestions and tips, and"); this.numeric(371, ": tons of additions to the Synchronet JS API that made this possible."); this.numeric(371, ":Deuce (Stephen Hurd): Resident Perl guru and Saskatchewan zealot."); this.numeric(371, ": Originally converted the IRCd to be object-oriented, various small"); this.numeric(371, ": hacks, and lots of guidance."); this.numeric(371, ":Greets to: Arrak, DWC, Foobar, Grey Fox/Zero/Unpaid, Grimp, Kufat,"); this.numeric(371, ": Palom, Psyko, Torke, and all the #square oldbies."); this.numeric(371, ":--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--"); this.numeric(371, ":Synchronet " + system.full_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)); this.numeric(371, ": - - - - - - - - - - - - - - - - - - - - - - -"); if (server.version_detail!=undefined) { this.numeric(371, ":This IRCd was executed via:"); 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, ":IRClib Version: " + IRCLIB_VERSION); this.numeric(371, ":--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--"); this.numeric(371, ":This program is distributed under the terms of the GNU General Public"); this.numeric(371, ":License, version 2. http://www.gnu.org/licenses/gpl.txt"); this.numeric(371, ":--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--"); this.numeric(374, ":End of /INFO list.");}
this.numeric(371, ":Synchronet " + system.full_version);
function IRCClient_do_info() { this.numeric(371, ":" + VERSION + " Copyright 2003 Randy Sommerfeld."); this.numeric(371, ":" + system.version_notice + " " + system.copyright + "."); this.numeric(371, ": "); this.numeric(371, ":--- A big thanks to the following for their assistance: ---"); this.numeric(371, ": Deuce: Hacking and OOP conversions."); this.numeric(371, ":DigitalMan: Additional hacking and API stuff."); this.numeric(371, ": "); this.numeric(371, ":Running on " + system.os_version); this.numeric(371, ":Compiled with " + system.compiled_with + " at " + system.compiled_when); this.numeric(371, ":Socket Library: " + system.socket_lib); this.numeric(371, ":Message Base Library: " + system.msgbase_lib); this.numeric(371, ":JavaScript Library: " + system.js_version); this.numeric(371, ":This BBS has been up since " + system.timestr(system.uptime)); this.numeric(371, ": "); this.numeric(371, ":This program is free software; you can redistribute it and/or modify"); this.numeric(371, ":it under the terms of the GNU General Public License as published by"); this.numeric(371, ":the Free Software Foundation; either version 2 of the License, or"); this.numeric(371, ":(at your option) any later version."); this.numeric(371, ": "); this.numeric(371, ":This program is distributed in the hope that it will be useful,"); this.numeric(371, ":but WITHOUT ANY WARRANTY; without even the implied warranty of"); this.numeric(371, ":MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the"); this.numeric(371, ":GNU General Public License for more details:"); this.numeric(371, ":http://www.gnu.org/licenses/gpl.txt"); this.numeric(374, ":End of /INFO list.");}
this.numeric(371, ":Compiled with " + system.compiled_with + " at " + system.compiled_when);
function IRCClient_do_info() { umode_notice(USERMODE_SPY,"Spy","INFO requested by " + this.nick + " (" + this.uprefix + "@" + this.hostname + ") [" + this.servername + "]"); this.numeric(371, ":--=-=-=-=-=-=-=-=-=*[ The Synchronet IRCd v1.1b ]*=-=-=-=-=-=-=-=-=--"); this.numeric(371, ": IRCd Copyright 2003 by Randolph E. Sommerfeld <[email protected]>"); this.numeric(371, ":" + system.version_notice + " " + system.copyright + "."); this.numeric(371, ":--=-=-=-=-=-=-=-=-( A big thanks to the following )-=-=-=-=-=-=-=-=--"); this.numeric(371, ":DigitalMan (Rob Swindell): Resident coder god, various hacking all"); this.numeric(371, ": around the IRCd, countless helpful suggestions and tips, and"); this.numeric(371, ": tons of additions to the Synchronet JS API that made this possible."); this.numeric(371, ":Deuce (Stephen Hurd): Resident Perl guru and Saskatchewan zealot."); this.numeric(371, ": Originally converted the IRCd to be object-oriented, various small"); this.numeric(371, ": hacks, and lots of guidance."); this.numeric(371, ":Greets to: Arrak, DWC, Foobar, Grey Fox/Zero/Unpaid, Grimp, Kufat,"); 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, ":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)); this.numeric(371, ": - - - - - - - - - - - - - - - - - - - - - - -"); if (server.version_detail!=undefined) { this.numeric(371, ":This IRCd was executed via:"); 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, ":IRClib Version: " + IRCLIB_VERSION); this.numeric(371, ":--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--"); this.numeric(371, ":This program is distributed under the terms of the GNU General Public"); this.numeric(371, ":License, version 2. http://www.gnu.org/licenses/gpl.txt"); this.numeric(371, ":--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--"); this.numeric(374, ":End of /INFO list.");}
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 + ")");
function IRCClient_do_info() { umode_notice(USERMODE_SPY,"Spy","INFO requested by " + this.nick + " (" + this.uprefix + "@" + this.hostname + ") [" + this.servername + "]"); this.numeric(371, ":--=-=-=-=-=-=-=-=-=*[ The Synchronet IRCd v1.1b ]*=-=-=-=-=-=-=-=-=--"); this.numeric(371, ": IRCd Copyright 2003 by Randolph E. Sommerfeld <[email protected]>"); this.numeric(371, ":" + system.version_notice + " " + system.copyright + "."); this.numeric(371, ":--=-=-=-=-=-=-=-=-( A big thanks to the following )-=-=-=-=-=-=-=-=--"); this.numeric(371, ":DigitalMan (Rob Swindell): Resident coder god, various hacking all"); this.numeric(371, ": around the IRCd, countless helpful suggestions and tips, and"); this.numeric(371, ": tons of additions to the Synchronet JS API that made this possible."); this.numeric(371, ":Deuce (Stephen Hurd): Resident Perl guru and Saskatchewan zealot."); this.numeric(371, ": Originally converted the IRCd to be object-oriented, various small"); this.numeric(371, ": hacks, and lots of guidance."); this.numeric(371, ":Greets to: Arrak, DWC, Foobar, Grey Fox/Zero/Unpaid, Grimp, Kufat,"); 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, ":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)); this.numeric(371, ": - - - - - - - - - - - - - - - - - - - - - - -"); if (server.version_detail!=undefined) { this.numeric(371, ":This IRCd was executed via:"); 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, ":IRClib Version: " + IRCLIB_VERSION); this.numeric(371, ":--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--"); this.numeric(371, ":This program is distributed under the terms of the GNU General Public"); this.numeric(371, ":License, version 2. http://www.gnu.org/licenses/gpl.txt"); this.numeric(371, ":--=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--"); this.numeric(374, ":End of /INFO list.");}
umode_notice(USERMODE_SPY,"Spy","INFO requested by " + this.nick + " (" + this.uprefix + "@" + this.hostname + ") [" + this.servername + "]");
function IRCClient_do_info() { this.numeric(371, ":" + VERSION + " Copyright 2003 Randy Sommerfeld."); this.numeric(371, ":" + system.version_notice + " " + system.copyright + "."); this.numeric(371, ": "); this.numeric(371, ":--- A big thanks to the following for their assistance: ---"); this.numeric(371, ": Deuce: Hacking and OOP conversions."); this.numeric(371, ":DigitalMan: Additional hacking and API stuff."); 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, ":Socket Library: " + system.socket_lib); this.numeric(371, ":Message Base Library: " + system.msgbase_lib); this.numeric(371, ":JavaScript Library: " + system.js_version); this.numeric(371, ":This BBS has been up since " + system.timestr(system.uptime)); this.numeric(371, ": "); this.numeric(371, ":This program is free software; you can redistribute it and/or modify"); this.numeric(371, ":it under the terms of the GNU General Public License as published by"); this.numeric(371, ":the Free Software Foundation; either version 2 of the License, or"); this.numeric(371, ":(at your option) any later version."); this.numeric(371, ": "); this.numeric(371, ":This program is distributed in the hope that it will be useful,"); this.numeric(371, ":but WITHOUT ANY WARRANTY; without even the implied warranty of"); this.numeric(371, ":MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the"); this.numeric(371, ":GNU General Public License for more details:"); this.numeric(371, ":http://www.gnu.org/licenses/gpl.txt"); this.numeric(374, ":End of /INFO list.");}
if (this.invited == Channels[chan].nam)
if (this.invited.toUpperCase() == Channels[chan].nam.toUpperCase())
function IRCClient_do_join(chan_name,join_key) { if((chan_name[0] != "#") && (chan_name[0] != "&") && !this.parent) { this.numeric403(chan_name); return 0; } for (theChar in chan_name) { theChar_code = chan_name[theChar].charCodeAt(0); if ((theChar_code <= 32) || (theChar_code == 44) || (chan_name[theChar].charCodeAt(0) == 160)) { if (!this.parent) this.numeric(479, chan_name + " :Channel name contains illegal characters."); return 0; } } if (this.onchannel(chan_name.toUpperCase())) return 0; if ((this.num_channels_on() >= max_user_chans) && !this.parent) { this.numeric("405", chan_name + " :You have joined too many channels."); return 0; } chan = chan_name.toUpperCase().slice(0,max_chanlen); if (Channels[chan] != undefined) { if (!this.parent) { if ((Channels[chan].mode&CHANMODE_INVITE) && (chan != this.invited)) { this.numeric("473", Channels[chan].nam + " :Cannot join channel (+i: invite only)"); return 0; } if ((Channels[chan].mode&CHANMODE_LIMIT) && (Channels[chan].count_users() >= Channels[chan].limit)) { this.numeric("471", Channels[chan].nam + " :Cannot join channel (+l: channel is full)"); return 0; } if ((Channels[chan].mode&CHANMODE_KEY) && (Channels[chan].key != join_key)) { this.numeric("475", Channels[chan].nam + " :Cannot join channel (+k: key required)"); return 0; } if (Channels[chan].isbanned(this.ircnuh) && (chan != this.invited) ) { this.numeric("474", Channels[chan].nam + " :Cannot join channel (+b: you're banned!)"); return 0; } } // add to existing channel Channels[chan].users.push(this.id); str="JOIN :" + Channels[chan].nam; if (this.parent) this.bcast_to_channel(Channels[chan].nam, str, false); else this.bcast_to_channel(Channels[chan].nam, str, true); if (chan_name[0] != "&") server_bcast_to_servers(":" + servername + " SJOIN " + Channels[chan].created + " " + Channels[chan].nam + " " + Channels[chan].chanmode() + " :" + this.nick); } else { // create a new channel Channels[chan]=new Channel(chan); Channels[chan].nam=chan_name.slice(0,max_chanlen); Channels[chan].mode=CHANMODE_NONE;// Channels[chan].mode|=CHANMODE_TOPIC;// Channels[chan].mode|=CHANMODE_NOOUTSIDE; Channels[chan].topic=""; Channels[chan].created=time(); Channels[chan].users = new Array(); Channels[chan].users[0] = this.id; Channels[chan].modelist[CHANLIST_BAN] = new Array(); Channels[chan].modelist[CHANLIST_VOICE] = new Array(); Channels[chan].modelist[CHANLIST_OP] = new Array(); Channels[chan].modelist[CHANLIST_OP].push(this.id); str="JOIN :" + chan_name; this.originatorout(str,this);// this.ircout("MODE " + chan_name + " " + Channels[chan].chanmode()); if (chan_name[0] != "&") server_bcast_to_servers(":" + servername + " SJOIN " + Channels[chan].created + " " + Channels[chan].nam + " " + Channels[chan].chanmode() + " :@" + this.nick); } if (this.invited == Channels[chan].nam) this.invited = ""; this.channels.push(chan); if (!this.parent) { this.names(chan); this.numeric(366, Channels[chan].nam + " :End of /NAMES list."); } return 1; // success}
chan = chan_name.toUpperCase().slice(0,max_chanlen);
var chan = chan_name.toUpperCase().slice(0,max_chanlen);
function IRCClient_do_join(chan_name,join_key) { if((chan_name[0] != "#") && (chan_name[0] != "&") && !this.parent) { this.numeric403(chan_name); return 0; } for (theChar in chan_name) { theChar_code = chan_name[theChar].charCodeAt(0); if ((theChar_code <= 32) || (theChar_code == 44) || (chan_name[theChar].charCodeAt(0) == 160)) { if (!this.parent) this.numeric(479, chan_name + " :Channel name contains illegal characters."); return 0; } } if (this.onchannel(chan_name.toUpperCase())) return 0; if ((this.num_channels_on() >= max_user_chans) && !this.parent) { this.numeric("405", chan_name + " :You have joined too many channels."); return 0; } chan = chan_name.toUpperCase().slice(0,max_chanlen); if (Channels[chan] != undefined) { if (!this.parent) { if ((Channels[chan].mode&CHANMODE_INVITE) && (chan != this.invited)) { this.numeric("473", Channels[chan].nam + " :Cannot join channel (+i: invite only)"); return 0; } if ((Channels[chan].mode&CHANMODE_LIMIT) && (Channels[chan].count_users() >= Channels[chan].arg[CHANMODE_LIMIT])) { this.numeric("471", Channels[chan].nam + " :Cannot join channel (+l: channel is full)"); return 0; } if ((Channels[chan].mode&CHANMODE_KEY) && (Channels[chan].arg[CHANMODE_KEY] != join_key)) { this.numeric("475", Channels[chan].nam + " :Cannot join channel (+k: key required)"); return 0; } if (Channels[chan].isbanned(this.ircnuh) && (chan != this.invited) ) { this.numeric("474", Channels[chan].nam + " :Cannot join channel (+b: you're banned!)"); return 0; } } // add to existing channel Channels[chan].users.push(this.id); str="JOIN :" + Channels[chan].nam; if (this.parent) this.bcast_to_channel(Channels[chan].nam, str, false); else this.bcast_to_channel(Channels[chan].nam, str, true); if (chan_name[0] != "&") server_bcast_to_servers(":" + servername + " SJOIN " + Channels[chan].created + " " + Channels[chan].nam + " " + Channels[chan].chanmode() + " :" + this.nick); } else { // create a new channel Channels[chan]=new Channel(chan); Channels[chan].nam=chan_name.slice(0,max_chanlen); Channels[chan].mode=CHANMODE_NONE;// Channels[chan].mode|=CHANMODE_TOPIC;// Channels[chan].mode|=CHANMODE_NOOUTSIDE; Channels[chan].topic=""; Channels[chan].created=time(); Channels[chan].users = new Array(); Channels[chan].users[0] = this.id; Channels[chan].modelist[CHANLIST_BAN] = new Array(); Channels[chan].modelist[CHANLIST_VOICE] = new Array(); Channels[chan].modelist[CHANLIST_OP] = new Array(); Channels[chan].modelist[CHANLIST_OP].push(this.id); str="JOIN :" + chan_name; this.originatorout(str,this);// this.ircout("MODE " + chan_name + " " + Channels[chan].chanmode()); if (chan_name[0] != "&") server_bcast_to_servers(":" + servername + " SJOIN " + Channels[chan].created + " " + Channels[chan].nam + " " + Channels[chan].chanmode() + " :@" + this.nick); } if (this.invited.toUpperCase() == Channels[chan].nam.toUpperCase()) this.invited = ""; this.channels.push(chan); if (!this.parent) { this.names(chan); this.numeric(366, Channels[chan].nam + " :End of /NAMES list."); } return 1; // success}
str="JOIN :" + Channels[chan].nam;
var str="JOIN :" + Channels[chan].nam;
function IRCClient_do_join(chan_name,join_key) { if((chan_name[0] != "#") && (chan_name[0] != "&") && !this.parent) { this.numeric403(chan_name); return 0; } for (theChar in chan_name) { theChar_code = chan_name[theChar].charCodeAt(0); if ((theChar_code <= 32) || (theChar_code == 44) || (chan_name[theChar].charCodeAt(0) == 160)) { if (!this.parent) this.numeric(479, chan_name + " :Channel name contains illegal characters."); return 0; } } if (this.onchannel(chan_name.toUpperCase())) return 0; if ((this.num_channels_on() >= max_user_chans) && !this.parent) { this.numeric("405", chan_name + " :You have joined too many channels."); return 0; } chan = chan_name.toUpperCase().slice(0,max_chanlen); if (Channels[chan] != undefined) { if (!this.parent) { if ((Channels[chan].mode&CHANMODE_INVITE) && (chan != this.invited)) { this.numeric("473", Channels[chan].nam + " :Cannot join channel (+i: invite only)"); return 0; } if ((Channels[chan].mode&CHANMODE_LIMIT) && (Channels[chan].count_users() >= Channels[chan].arg[CHANMODE_LIMIT])) { this.numeric("471", Channels[chan].nam + " :Cannot join channel (+l: channel is full)"); return 0; } if ((Channels[chan].mode&CHANMODE_KEY) && (Channels[chan].arg[CHANMODE_KEY] != join_key)) { this.numeric("475", Channels[chan].nam + " :Cannot join channel (+k: key required)"); return 0; } if (Channels[chan].isbanned(this.ircnuh) && (chan != this.invited) ) { this.numeric("474", Channels[chan].nam + " :Cannot join channel (+b: you're banned!)"); return 0; } } // add to existing channel Channels[chan].users.push(this.id); str="JOIN :" + Channels[chan].nam; if (this.parent) this.bcast_to_channel(Channels[chan].nam, str, false); else this.bcast_to_channel(Channels[chan].nam, str, true); if (chan_name[0] != "&") server_bcast_to_servers(":" + servername + " SJOIN " + Channels[chan].created + " " + Channels[chan].nam + " " + Channels[chan].chanmode() + " :" + this.nick); } else { // create a new channel Channels[chan]=new Channel(chan); Channels[chan].nam=chan_name.slice(0,max_chanlen); Channels[chan].mode=CHANMODE_NONE;// Channels[chan].mode|=CHANMODE_TOPIC;// Channels[chan].mode|=CHANMODE_NOOUTSIDE; Channels[chan].topic=""; Channels[chan].created=time(); Channels[chan].users = new Array(); Channels[chan].users[0] = this.id; Channels[chan].modelist[CHANLIST_BAN] = new Array(); Channels[chan].modelist[CHANLIST_VOICE] = new Array(); Channels[chan].modelist[CHANLIST_OP] = new Array(); Channels[chan].modelist[CHANLIST_OP].push(this.id); str="JOIN :" + chan_name; this.originatorout(str,this);// this.ircout("MODE " + chan_name + " " + Channels[chan].chanmode()); if (chan_name[0] != "&") server_bcast_to_servers(":" + servername + " SJOIN " + Channels[chan].created + " " + Channels[chan].nam + " " + Channels[chan].chanmode() + " :@" + this.nick); } if (this.invited.toUpperCase() == Channels[chan].nam.toUpperCase()) this.invited = ""; this.channels.push(chan); if (!this.parent) { this.names(chan); this.numeric(366, Channels[chan].nam + " :End of /NAMES list."); } return 1; // success}
server_bcast_to_servers(":" + servername + " SJOIN " + Channels[chan].created + " " + Channels[chan].nam + " " + Channels[chan].chanmode() + " :" + this.nick);
server_bcast_to_servers(":" + this.nick + " SJOIN " + Channels[chan].created + " " + Channels[chan].nam);
function IRCClient_do_join(chan_name,join_key) { if((chan_name[0] != "#") && (chan_name[0] != "&") && !this.parent) { this.numeric403(chan_name); return 0; } for (theChar in chan_name) { theChar_code = chan_name[theChar].charCodeAt(0); if ((theChar_code <= 32) || (theChar_code == 44) || (chan_name[theChar].charCodeAt(0) == 160)) { if (!this.parent) this.numeric(479, chan_name + " :Channel name contains illegal characters."); return 0; } } if (this.onchannel(chan_name.toUpperCase())) return 0; if ((this.num_channels_on() >= max_user_chans) && !this.parent) { this.numeric("405", chan_name + " :You have joined too many channels."); return 0; } chan = chan_name.toUpperCase().slice(0,max_chanlen); if (Channels[chan] != undefined) { if (!this.parent) { if ((Channels[chan].mode&CHANMODE_INVITE) && (chan != this.invited)) { this.numeric("473", Channels[chan].nam + " :Cannot join channel (+i: invite only)"); return 0; } if ((Channels[chan].mode&CHANMODE_LIMIT) && (Channels[chan].count_users() >= Channels[chan].arg[CHANMODE_LIMIT])) { this.numeric("471", Channels[chan].nam + " :Cannot join channel (+l: channel is full)"); return 0; } if ((Channels[chan].mode&CHANMODE_KEY) && (Channels[chan].arg[CHANMODE_KEY] != join_key)) { this.numeric("475", Channels[chan].nam + " :Cannot join channel (+k: key required)"); return 0; } if (Channels[chan].isbanned(this.ircnuh) && (chan != this.invited) ) { this.numeric("474", Channels[chan].nam + " :Cannot join channel (+b: you're banned!)"); return 0; } } // add to existing channel Channels[chan].users.push(this.id); str="JOIN :" + Channels[chan].nam; if (this.parent) this.bcast_to_channel(Channels[chan].nam, str, false); else this.bcast_to_channel(Channels[chan].nam, str, true); if (chan_name[0] != "&") server_bcast_to_servers(":" + servername + " SJOIN " + Channels[chan].created + " " + Channels[chan].nam + " " + Channels[chan].chanmode() + " :" + this.nick); } else { // create a new channel Channels[chan]=new Channel(chan); Channels[chan].nam=chan_name.slice(0,max_chanlen); Channels[chan].mode=CHANMODE_NONE;// Channels[chan].mode|=CHANMODE_TOPIC;// Channels[chan].mode|=CHANMODE_NOOUTSIDE; Channels[chan].topic=""; Channels[chan].created=time(); Channels[chan].users = new Array(); Channels[chan].users[0] = this.id; Channels[chan].modelist[CHANLIST_BAN] = new Array(); Channels[chan].modelist[CHANLIST_VOICE] = new Array(); Channels[chan].modelist[CHANLIST_OP] = new Array(); Channels[chan].modelist[CHANLIST_OP].push(this.id); str="JOIN :" + chan_name; this.originatorout(str,this);// this.ircout("MODE " + chan_name + " " + Channels[chan].chanmode()); if (chan_name[0] != "&") server_bcast_to_servers(":" + servername + " SJOIN " + Channels[chan].created + " " + Channels[chan].nam + " " + Channels[chan].chanmode() + " :@" + this.nick); } if (this.invited.toUpperCase() == Channels[chan].nam.toUpperCase()) this.invited = ""; this.channels.push(chan); if (!this.parent) { this.names(chan); this.numeric(366, Channels[chan].nam + " :End of /NAMES list."); } return 1; // success}
if(chan_name.search(/[\x00-\x20\x2c\xa0]/)!=-1) { if (this.local) { this.numeric(479, chan_name + " :Channel name contains illegal characters.");
for (theChar in chan_name) { var theChar_code = chan_name[theChar].charCodeAt(0); if ((theChar_code <= 32) || (theChar_code == 44) || (chan_name[theChar].charCodeAt(0) == 160)) { if (this.local) this.numeric(479, chan_name + " :Channel name contains illegal characters."); return 0;
function IRCClient_do_join(chan_name,join_key) { chan_name = chan_name.slice(0,max_chanlen) var uc_chan_name = chan_name.toUpperCase(); if((chan_name[0] != "#") && (chan_name[0] != "&") && !this.parent) { this.numeric403(chan_name); return 0; } if(chan_name.search(/[\x00-\x20\x2c\xa0]/)!=-1) { if (this.local) { this.numeric(479, chan_name + " :Channel name contains illegal characters."); } return 0; } if (this.channels[uc_chan_name]) return 0; if ((true_array_len(this.channels) >= max_user_chans) && this.local) { this.numeric("405", chan_name + " :You have joined too many channels."); return 0; } if (Channels[uc_chan_name]) { var chan = Channels[uc_chan_name]; if (this.local) { if ((chan.mode&CHANMODE_INVITE) && (uc_chan_name != this.invited)) { this.numeric("473", chan.nam + " :Cannot join channel (+i: invite only)"); return 0; } if ((chan.mode&CHANMODE_LIMIT) && (true_array_len(chan.users) >= chan.arg[CHANMODE_LIMIT]) ) { this.numeric("471", chan.nam + " :Cannot join channel (+l: channel is full)"); return 0; } if ((chan.mode&CHANMODE_KEY) && (chan.arg[CHANMODE_KEY] != join_key)) { this.numeric("475", chan.nam + " :Cannot join channel (+k: key required)"); return 0; } if (chan.isbanned(this.nuh) && (uc_chan_name != this.invited) ) { this.numeric("474", Channels[chan].nam + " :Cannot join channel (+b: you're banned!)"); return 0; } } // add to existing channel chan.users[this.id] = this; var str="JOIN :" + chan.nam; if (!this.local) { this.bcast_to_channel(chan, str, false); } else { this.bcast_to_channel(chan, str, true); if (chan.topic) { this.numeric332(chan); this.numeric333(chan); } else { this.numeric331(chan); } } if (chan_name[0] != "&") server_bcast_to_servers(":" + this.nick + " SJOIN " + chan.created + " " + chan.nam,BAHAMUT); server_bcast_to_servers(":" + this.nick + " JOIN " + chan.nam + " " + chan.created,DREAMFORGE); } else { // create a new channel Channels[uc_chan_name] = new Channel(chan_name); chan=Channels[uc_chan_name]; chan.users[this.id] = this; chan.modelist[CHANMODE_OP][this.id] = this; var str="JOIN :" + chan.nam; var create_op = ""; if (this.local) { this.originatorout(str,this); create_op = "@"; } if (chan_name[0] != "&") { server_bcast_to_servers(":" + servername + " SJOIN " + chan.created + " " + chan.nam + " " + chan.chanmode() + " :" + create_op + this.nick,BAHAMUT); server_bcast_to_servers(":" + this.nick + " JOIN " + chan.nam,DREAMFORGE); if (create_op) { server_bcast_to_servers(":" + servername + " MODE " + chan.nam + " +o " + this.nick + " " + chan.created,DREAMFORGE); } } } if (this.invited.toUpperCase() == chan.nam.toUpperCase()) this.invited = ""; this.channels[uc_chan_name] = chan; if (!this.parent) { this.names(chan); this.numeric(366, chan.nam + " :End of /NAMES list."); } return 1; // success}
return 0;
function IRCClient_do_join(chan_name,join_key) { chan_name = chan_name.slice(0,max_chanlen) var uc_chan_name = chan_name.toUpperCase(); if((chan_name[0] != "#") && (chan_name[0] != "&") && !this.parent) { this.numeric403(chan_name); return 0; } if(chan_name.search(/[\x00-\x20\x2c\xa0]/)!=-1) { if (this.local) { this.numeric(479, chan_name + " :Channel name contains illegal characters."); } return 0; } if (this.channels[uc_chan_name]) return 0; if ((true_array_len(this.channels) >= max_user_chans) && this.local) { this.numeric("405", chan_name + " :You have joined too many channels."); return 0; } if (Channels[uc_chan_name]) { var chan = Channels[uc_chan_name]; if (this.local) { if ((chan.mode&CHANMODE_INVITE) && (uc_chan_name != this.invited)) { this.numeric("473", chan.nam + " :Cannot join channel (+i: invite only)"); return 0; } if ((chan.mode&CHANMODE_LIMIT) && (true_array_len(chan.users) >= chan.arg[CHANMODE_LIMIT]) ) { this.numeric("471", chan.nam + " :Cannot join channel (+l: channel is full)"); return 0; } if ((chan.mode&CHANMODE_KEY) && (chan.arg[CHANMODE_KEY] != join_key)) { this.numeric("475", chan.nam + " :Cannot join channel (+k: key required)"); return 0; } if (chan.isbanned(this.nuh) && (uc_chan_name != this.invited) ) { this.numeric("474", Channels[chan].nam + " :Cannot join channel (+b: you're banned!)"); return 0; } } // add to existing channel chan.users[this.id] = this; var str="JOIN :" + chan.nam; if (!this.local) { this.bcast_to_channel(chan, str, false); } else { this.bcast_to_channel(chan, str, true); if (chan.topic) { this.numeric332(chan); this.numeric333(chan); } else { this.numeric331(chan); } } if (chan_name[0] != "&") server_bcast_to_servers(":" + this.nick + " SJOIN " + chan.created + " " + chan.nam,BAHAMUT); server_bcast_to_servers(":" + this.nick + " JOIN " + chan.nam + " " + chan.created,DREAMFORGE); } else { // create a new channel Channels[uc_chan_name] = new Channel(chan_name); chan=Channels[uc_chan_name]; chan.users[this.id] = this; chan.modelist[CHANMODE_OP][this.id] = this; var str="JOIN :" + chan.nam; var create_op = ""; if (this.local) { this.originatorout(str,this); create_op = "@"; } if (chan_name[0] != "&") { server_bcast_to_servers(":" + servername + " SJOIN " + chan.created + " " + chan.nam + " " + chan.chanmode() + " :" + create_op + this.nick,BAHAMUT); server_bcast_to_servers(":" + this.nick + " JOIN " + chan.nam,DREAMFORGE); if (create_op) { server_bcast_to_servers(":" + servername + " MODE " + chan.nam + " +o " + this.nick + " " + chan.created,DREAMFORGE); } } } if (this.invited.toUpperCase() == chan.nam.toUpperCase()) this.invited = ""; this.channels[uc_chan_name] = chan; if (!this.parent) { this.names(chan); this.numeric(366, chan.nam + " :End of /NAMES list."); } return 1; // success}
for (theChar in chan_name) { if(chan_name.search(/[\x00-\x20\x2c\xa0]/)!=-1) { if (this.local) this.numeric(479, chan_name + " :Channel name contains illegal characters."); return 0;
if(chan_name.search(/[\x00-\x20\x2c\xa0]/)!=-1) { if (this.local) { this.numeric(479, chan_name + " :Channel name contains illegal characters.");
function IRCClient_do_join(chan_name,join_key) { chan_name = chan_name.slice(0,max_chanlen) var uc_chan_name = chan_name.toUpperCase(); if((chan_name[0] != "#") && (chan_name[0] != "&") && !this.parent) { this.numeric403(chan_name); return 0; } for (theChar in chan_name) { if(chan_name.search(/[\x00-\x20\x2c\xa0]/)!=-1) { if (this.local) this.numeric(479, chan_name + " :Channel name contains illegal characters."); return 0; } } if (this.channels[uc_chan_name]) return 0; if ((true_array_len(this.channels) >= max_user_chans) && this.local) { this.numeric("405", chan_name + " :You have joined too many channels."); return 0; } if (Channels[uc_chan_name]) { var chan = Channels[uc_chan_name]; if (this.local) { if ((chan.mode&CHANMODE_INVITE) && (uc_chan_name != this.invited)) { this.numeric("473", chan.nam + " :Cannot join channel (+i: invite only)"); return 0; } if ((chan.mode&CHANMODE_LIMIT) && (true_array_len(chan.users) >= chan.arg[CHANMODE_LIMIT]) ) { this.numeric("471", chan.nam + " :Cannot join channel (+l: channel is full)"); return 0; } if ((chan.mode&CHANMODE_KEY) && (chan.arg[CHANMODE_KEY] != join_key)) { this.numeric("475", chan.nam + " :Cannot join channel (+k: key required)"); return 0; } if (chan.isbanned(this.nuh) && (uc_chan_name != this.invited) ) { this.numeric("474", Channels[chan].nam + " :Cannot join channel (+b: you're banned!)"); return 0; } } // add to existing channel chan.users[this.id] = this; var str="JOIN :" + chan.nam; if (!this.local) { this.bcast_to_channel(chan, str, false); } else { this.bcast_to_channel(chan, str, true); if (chan.topic) { this.numeric332(chan); this.numeric333(chan); } else { this.numeric331(chan); } } if (chan_name[0] != "&") server_bcast_to_servers(":" + this.nick + " SJOIN " + chan.created + " " + chan.nam,BAHAMUT); server_bcast_to_servers(":" + this.nick + " JOIN " + chan.nam + " " + chan.created,DREAMFORGE); } else { // create a new channel Channels[uc_chan_name] = new Channel(chan_name); chan=Channels[uc_chan_name]; chan.users[this.id] = this; chan.modelist[CHANMODE_OP][this.id] = this; var str="JOIN :" + chan.nam; var create_op = ""; if (this.local) { this.originatorout(str,this); create_op = "@"; } if (chan_name[0] != "&") { server_bcast_to_servers(":" + servername + " SJOIN " + chan.created + " " + chan.nam + " " + chan.chanmode() + " :" + create_op + this.nick,BAHAMUT); server_bcast_to_servers(":" + this.nick + " JOIN " + chan.nam,DREAMFORGE); if (create_op) { server_bcast_to_servers(":" + servername + " MODE " + chan.nam + " +o " + this.nick + " " + chan.created,DREAMFORGE); } } } if (this.invited.toUpperCase() == chan.nam.toUpperCase()) this.invited = ""; this.channels[uc_chan_name] = chan; if (!this.parent) { this.names(chan); this.numeric(366, chan.nam + " :End of /NAMES list."); } return 1; // success}
return 0;
function IRCClient_do_join(chan_name,join_key) { chan_name = chan_name.slice(0,max_chanlen) var uc_chan_name = chan_name.toUpperCase(); if((chan_name[0] != "#") && (chan_name[0] != "&") && !this.parent) { this.numeric403(chan_name); return 0; } for (theChar in chan_name) { if(chan_name.search(/[\x00-\x20\x2c\xa0]/)!=-1) { if (this.local) this.numeric(479, chan_name + " :Channel name contains illegal characters."); return 0; } } if (this.channels[uc_chan_name]) return 0; if ((true_array_len(this.channels) >= max_user_chans) && this.local) { this.numeric("405", chan_name + " :You have joined too many channels."); return 0; } if (Channels[uc_chan_name]) { var chan = Channels[uc_chan_name]; if (this.local) { if ((chan.mode&CHANMODE_INVITE) && (uc_chan_name != this.invited)) { this.numeric("473", chan.nam + " :Cannot join channel (+i: invite only)"); return 0; } if ((chan.mode&CHANMODE_LIMIT) && (true_array_len(chan.users) >= chan.arg[CHANMODE_LIMIT]) ) { this.numeric("471", chan.nam + " :Cannot join channel (+l: channel is full)"); return 0; } if ((chan.mode&CHANMODE_KEY) && (chan.arg[CHANMODE_KEY] != join_key)) { this.numeric("475", chan.nam + " :Cannot join channel (+k: key required)"); return 0; } if (chan.isbanned(this.nuh) && (uc_chan_name != this.invited) ) { this.numeric("474", Channels[chan].nam + " :Cannot join channel (+b: you're banned!)"); return 0; } } // add to existing channel chan.users[this.id] = this; var str="JOIN :" + chan.nam; if (!this.local) { this.bcast_to_channel(chan, str, false); } else { this.bcast_to_channel(chan, str, true); if (chan.topic) { this.numeric332(chan); this.numeric333(chan); } else { this.numeric331(chan); } } if (chan_name[0] != "&") server_bcast_to_servers(":" + this.nick + " SJOIN " + chan.created + " " + chan.nam,BAHAMUT); server_bcast_to_servers(":" + this.nick + " JOIN " + chan.nam + " " + chan.created,DREAMFORGE); } else { // create a new channel Channels[uc_chan_name] = new Channel(chan_name); chan=Channels[uc_chan_name]; chan.users[this.id] = this; chan.modelist[CHANMODE_OP][this.id] = this; var str="JOIN :" + chan.nam; var create_op = ""; if (this.local) { this.originatorout(str,this); create_op = "@"; } if (chan_name[0] != "&") { server_bcast_to_servers(":" + servername + " SJOIN " + chan.created + " " + chan.nam + " " + chan.chanmode() + " :" + create_op + this.nick,BAHAMUT); server_bcast_to_servers(":" + this.nick + " JOIN " + chan.nam,DREAMFORGE); if (create_op) { server_bcast_to_servers(":" + servername + " MODE " + chan.nam + " +o " + this.nick + " " + chan.created,DREAMFORGE); } } } if (this.invited.toUpperCase() == chan.nam.toUpperCase()) this.invited = ""; this.channels[uc_chan_name] = chan; if (!this.parent) { this.names(chan); this.numeric(366, chan.nam + " :End of /NAMES list."); } return 1; // success}
var create_op;
var create_op = "";
function IRCClient_do_join(chan_name,join_key) { chan_name = chan_name.slice(0,max_chanlen) var uc_chan_name = chan_name.toUpperCase(); if((chan_name[0] != "#") && (chan_name[0] != "&") && !this.parent) { this.numeric403(chan_name); return 0; } if(chan_name.search(/[\x00-\x20\x2c\xa0]/)!=-1) { if (this.local) this.numeric(479, chan_name + " :Channel name contains illegal characters."); return 0; } if (this.channels[uc_chan_name]) return 0; if ((true_array_len(this.channels) >= max_user_chans) && this.local) { this.numeric("405", chan_name + " :You have joined too many channels."); return 0; } if (Channels[uc_chan_name]) { var chan = Channels[uc_chan_name]; if (this.local) { if ((chan.mode&CHANMODE_INVITE) && (uc_chan_name != this.invited)) { this.numeric("473", chan.nam + " :Cannot join channel (+i: invite only)"); return 0; } if ((chan.mode&CHANMODE_LIMIT) && (true_array_len(chan.users) >= chan.arg[CHANMODE_LIMIT]) ) { this.numeric("471", chan.nam + " :Cannot join channel (+l: channel is full)"); return 0; } if ((chan.mode&CHANMODE_KEY) && (chan.arg[CHANMODE_KEY] != join_key)) { this.numeric("475", chan.nam + " :Cannot join channel (+k: key required)"); return 0; } if (chan.isbanned(this.nuh) && (uc_chan_name != this.invited) ) { this.numeric("474", Channels[chan].nam + " :Cannot join channel (+b: you're banned!)"); return 0; } } // add to existing channel chan.users[this.id] = this; var str="JOIN :" + chan.nam; if (!this.local) { this.bcast_to_channel(chan, str, false); } else { this.bcast_to_channel(chan, str, true); if (chan.topic) { this.numeric332(chan); this.numeric333(chan); } else { this.numeric331(chan); } } if (chan_name[0] != "&") { this.bcast_to_servers_raw(":" + this.nick + " SJOIN " + chan.created + " " + chan.nam,BAHAMUT); this.bcast_to_servers_raw(":" + this.nick + " JOIN " + chan.nam + " " + chan.created,DREAMFORGE); } } else { // create a new channel Channels[uc_chan_name] = new Channel(chan_name); chan=Channels[uc_chan_name]; chan.users[this.id] = this; chan.modelist[CHANMODE_OP][this.id] = this; var str="JOIN :" + chan.nam; var create_op; if (this.local) { this.originatorout(str,this); create_op = "@"; } if (chan_name[0] != "&") { this.bcast_to_servers_raw(":" + servername + " SJOIN " + chan.created + " " + chan.nam + " " + chan.chanmode() + " :" + create_op + this.nick,BAHAMUT); this.bcast_to_servers_raw(":" + this.nick + " JOIN " + chan.nam,DREAMFORGE); if (create_op) { server_bcast_to_servers(":" + servername + " MODE " + chan.nam + " +o " + this.nick + " " + chan.created,DREAMFORGE); } } } if (this.invited.toUpperCase() == chan.nam.toUpperCase()) this.invited = ""; this.channels[uc_chan_name] = chan; if (!this.parent) { this.names(chan); this.numeric(366, chan.nam + " :End of /NAMES list."); } return 1; // success}
(Channels[chan].count_users() >= Channels[chan].limit)) {
(Channels[chan].count_users() >= Channels[chan].arg[CHANMODE_LIMIT])) {
function IRCClient_do_join(chan_name,join_key) { if((chan_name[0] != "#") && (chan_name[0] != "&") && !this.parent) { this.numeric403(chan_name); return 0; } for (theChar in chan_name) { theChar_code = chan_name[theChar].charCodeAt(0); if ((theChar_code <= 32) || (theChar_code == 44) || (chan_name[theChar].charCodeAt(0) == 160)) { if (!this.parent) this.numeric(479, chan_name + " :Channel name contains illegal characters."); return 0; } } if (this.onchannel(chan_name.toUpperCase())) return 0; if ((this.num_channels_on() >= max_user_chans) && !this.parent) { this.numeric("405", chan_name + " :You have joined too many channels."); return 0; } chan = chan_name.toUpperCase().slice(0,max_chanlen); if (Channels[chan] != undefined) { if (!this.parent) { if ((Channels[chan].mode&CHANMODE_INVITE) && (chan != this.invited)) { this.numeric("473", Channels[chan].nam + " :Cannot join channel (+i: invite only)"); return 0; } if ((Channels[chan].mode&CHANMODE_LIMIT) && (Channels[chan].count_users() >= Channels[chan].limit)) { this.numeric("471", Channels[chan].nam + " :Cannot join channel (+l: channel is full)"); return 0; } if ((Channels[chan].mode&CHANMODE_KEY) && (Channels[chan].key != join_key)) { this.numeric("475", Channels[chan].nam + " :Cannot join channel (+k: key required)"); return 0; } if (Channels[chan].isbanned(this.ircnuh) && (chan != this.invited) ) { this.numeric("474", Channels[chan].nam + " :Cannot join channel (+b: you're banned!)"); return 0; } } // add to existing channel Channels[chan].users.push(this.id); str="JOIN :" + Channels[chan].nam; if (this.parent) this.bcast_to_channel(Channels[chan].nam, str, false); else this.bcast_to_channel(Channels[chan].nam, str, true); if (chan_name[0] != "&") server_bcast_to_servers(":" + servername + " SJOIN " + Channels[chan].created + " " + Channels[chan].nam + " " + Channels[chan].chanmode() + " :" + this.nick); } else { // create a new channel Channels[chan]=new Channel(chan); Channels[chan].nam=chan_name.slice(0,max_chanlen); Channels[chan].mode=CHANMODE_NONE;// Channels[chan].mode|=CHANMODE_TOPIC;// Channels[chan].mode|=CHANMODE_NOOUTSIDE; Channels[chan].topic=""; Channels[chan].created=time(); Channels[chan].users = new Array(); Channels[chan].users[0] = this.id; Channels[chan].modelist[CHANLIST_BAN] = new Array(); Channels[chan].modelist[CHANLIST_VOICE] = new Array(); Channels[chan].modelist[CHANLIST_OP] = new Array(); Channels[chan].modelist[CHANLIST_OP].push(this.id); str="JOIN :" + chan_name; this.originatorout(str,this);// this.ircout("MODE " + chan_name + " " + Channels[chan].chanmode()); if (chan_name[0] != "&") server_bcast_to_servers(":" + servername + " SJOIN " + Channels[chan].created + " " + Channels[chan].nam + " " + Channels[chan].chanmode() + " :@" + this.nick); } if (this.invited.toUpperCase() == Channels[chan].nam.toUpperCase()) this.invited = ""; this.channels.push(chan); if (!this.parent) { this.names(chan); this.numeric(366, Channels[chan].nam + " :End of /NAMES list."); } return 1; // success}
(Channels[chan].key != join_key)) {
(Channels[chan].arg[CHANMODE_KEY] != join_key)) {
function IRCClient_do_join(chan_name,join_key) { if((chan_name[0] != "#") && (chan_name[0] != "&") && !this.parent) { this.numeric403(chan_name); return 0; } for (theChar in chan_name) { theChar_code = chan_name[theChar].charCodeAt(0); if ((theChar_code <= 32) || (theChar_code == 44) || (chan_name[theChar].charCodeAt(0) == 160)) { if (!this.parent) this.numeric(479, chan_name + " :Channel name contains illegal characters."); return 0; } } if (this.onchannel(chan_name.toUpperCase())) return 0; if ((this.num_channels_on() >= max_user_chans) && !this.parent) { this.numeric("405", chan_name + " :You have joined too many channels."); return 0; } chan = chan_name.toUpperCase().slice(0,max_chanlen); if (Channels[chan] != undefined) { if (!this.parent) { if ((Channels[chan].mode&CHANMODE_INVITE) && (chan != this.invited)) { this.numeric("473", Channels[chan].nam + " :Cannot join channel (+i: invite only)"); return 0; } if ((Channels[chan].mode&CHANMODE_LIMIT) && (Channels[chan].count_users() >= Channels[chan].limit)) { this.numeric("471", Channels[chan].nam + " :Cannot join channel (+l: channel is full)"); return 0; } if ((Channels[chan].mode&CHANMODE_KEY) && (Channels[chan].key != join_key)) { this.numeric("475", Channels[chan].nam + " :Cannot join channel (+k: key required)"); return 0; } if (Channels[chan].isbanned(this.ircnuh) && (chan != this.invited) ) { this.numeric("474", Channels[chan].nam + " :Cannot join channel (+b: you're banned!)"); return 0; } } // add to existing channel Channels[chan].users.push(this.id); str="JOIN :" + Channels[chan].nam; if (this.parent) this.bcast_to_channel(Channels[chan].nam, str, false); else this.bcast_to_channel(Channels[chan].nam, str, true); if (chan_name[0] != "&") server_bcast_to_servers(":" + servername + " SJOIN " + Channels[chan].created + " " + Channels[chan].nam + " " + Channels[chan].chanmode() + " :" + this.nick); } else { // create a new channel Channels[chan]=new Channel(chan); Channels[chan].nam=chan_name.slice(0,max_chanlen); Channels[chan].mode=CHANMODE_NONE;// Channels[chan].mode|=CHANMODE_TOPIC;// Channels[chan].mode|=CHANMODE_NOOUTSIDE; Channels[chan].topic=""; Channels[chan].created=time(); Channels[chan].users = new Array(); Channels[chan].users[0] = this.id; Channels[chan].modelist[CHANLIST_BAN] = new Array(); Channels[chan].modelist[CHANLIST_VOICE] = new Array(); Channels[chan].modelist[CHANLIST_OP] = new Array(); Channels[chan].modelist[CHANLIST_OP].push(this.id); str="JOIN :" + chan_name; this.originatorout(str,this);// this.ircout("MODE " + chan_name + " " + Channels[chan].chanmode()); if (chan_name[0] != "&") server_bcast_to_servers(":" + servername + " SJOIN " + Channels[chan].created + " " + Channels[chan].nam + " " + Channels[chan].chanmode() + " :@" + this.nick); } if (this.invited.toUpperCase() == Channels[chan].nam.toUpperCase()) this.invited = ""; this.channels.push(chan); if (!this.parent) { this.names(chan); this.numeric(366, Channels[chan].nam + " :End of /NAMES list."); } return 1; // success}
Channels[chan].modelist[CHANLIST_BAN] = new Array(); Channels[chan].modelist[CHANLIST_VOICE] = new Array(); Channels[chan].modelist[CHANLIST_OP] = new Array(); Channels[chan].modelist[CHANLIST_OP].push(this.id); str="JOIN :" + chan_name;
Channels[chan].modelist[CHANMODE_BAN] = new Array(); Channels[chan].modelist[CHANMODE_VOICE] = new Array(); Channels[chan].modelist[CHANMODE_OP] = new Array(); Channels[chan].modelist[CHANMODE_OP].push(this.id); var str="JOIN :" + chan_name;
function IRCClient_do_join(chan_name,join_key) { if((chan_name[0] != "#") && (chan_name[0] != "&") && !this.parent) { this.numeric403(chan_name); return 0; } for (theChar in chan_name) { var theChar_code = chan_name[theChar].charCodeAt(0); if ((theChar_code <= 32) || (theChar_code == 44) || (chan_name[theChar].charCodeAt(0) == 160)) { if (!this.parent) this.numeric(479, chan_name + " :Channel name contains illegal characters."); return 0; } } if (this.onchannel(chan_name.toUpperCase())) return 0; if ((this.num_channels_on() >= max_user_chans) && !this.parent) { this.numeric("405", chan_name + " :You have joined too many channels."); return 0; } var chan = chan_name.toUpperCase().slice(0,max_chanlen); if (Channels[chan] != undefined) { if (!this.parent) { if ((Channels[chan].mode&CHANMODE_INVITE) && (chan != this.invited)) { this.numeric("473", Channels[chan].nam + " :Cannot join channel (+i: invite only)"); return 0; } if ((Channels[chan].mode&CHANMODE_LIMIT) && (Channels[chan].count_users() >= Channels[chan].arg[CHANMODE_LIMIT])) { this.numeric("471", Channels[chan].nam + " :Cannot join channel (+l: channel is full)"); return 0; } if ((Channels[chan].mode&CHANMODE_KEY) && (Channels[chan].arg[CHANMODE_KEY] != join_key)) { this.numeric("475", Channels[chan].nam + " :Cannot join channel (+k: key required)"); return 0; } if (Channels[chan].isbanned(this.ircnuh) && (chan != this.invited) ) { this.numeric("474", Channels[chan].nam + " :Cannot join channel (+b: you're banned!)"); return 0; } } // add to existing channel Channels[chan].users.push(this.id); var str="JOIN :" + Channels[chan].nam; if (this.parent) { this.bcast_to_channel(Channels[chan].nam, str, false); } else { this.bcast_to_channel(Channels[chan].nam, str, true); if (Channels[chan].topic) { this.numeric332(Channels[chan]); this.numeric333(Channels[chan]); } else { this.numeric331(Channels[chan]); } } if (chan_name[0] != "&") server_bcast_to_servers(":" + this.nick + " SJOIN " + Channels[chan].created + " " + Channels[chan].nam); } else { // create a new channel Channels[chan]=new Channel(chan); Channels[chan].nam=chan_name.slice(0,max_chanlen); Channels[chan].mode=CHANMODE_NONE; Channels[chan].topic=""; Channels[chan].created=time(); Channels[chan].users = new Array(); Channels[chan].users[0] = this.id; Channels[chan].modelist[CHANLIST_BAN] = new Array(); Channels[chan].modelist[CHANLIST_VOICE] = new Array(); Channels[chan].modelist[CHANLIST_OP] = new Array(); Channels[chan].modelist[CHANLIST_OP].push(this.id); str="JOIN :" + chan_name; this.originatorout(str,this); if (chan_name[0] != "&") server_bcast_to_servers(":" + servername + " SJOIN " + Channels[chan].created + " " + Channels[chan].nam + " " + Channels[chan].chanmode() + " :@" + this.nick); } if (this.invited.toUpperCase() == Channels[chan].nam.toUpperCase()) this.invited = ""; this.channels.push(chan); if (!this.parent) { this.names(chan); this.numeric(366, Channels[chan].nam + " :End of /NAMES list."); } return 1; // success}
}
function IRCClient_do_join(chan_name,join_key) { if((chan_name[0] != "#") && (chan_name[0] != "&") && !this.parent) { this.numeric403(chan_name); return 0; } for (theChar in chan_name) { var theChar_code = chan_name[theChar].charCodeAt(0); if ((theChar_code <= 32) || (theChar_code == 44) || (chan_name[theChar].charCodeAt(0) == 160)) { if (!this.parent) this.numeric(479, chan_name + " :Channel name contains illegal characters."); return 0; } } if (this.onchannel(chan_name.toUpperCase())) return 0; if ((this.num_channels_on() >= max_user_chans) && !this.parent) { this.numeric("405", chan_name + " :You have joined too many channels."); return 0; } var chan = chan_name.toUpperCase().slice(0,max_chanlen); if (Channels[chan] != undefined) { if (!this.parent) { if ((Channels[chan].mode&CHANMODE_INVITE) && (chan != this.invited)) { this.numeric("473", Channels[chan].nam + " :Cannot join channel (+i: invite only)"); return 0; } if ((Channels[chan].mode&CHANMODE_LIMIT) && (Channels[chan].count_users() >= Channels[chan].arg[CHANMODE_LIMIT])) { this.numeric("471", Channels[chan].nam + " :Cannot join channel (+l: channel is full)"); return 0; } if ((Channels[chan].mode&CHANMODE_KEY) && (Channels[chan].arg[CHANMODE_KEY] != join_key)) { this.numeric("475", Channels[chan].nam + " :Cannot join channel (+k: key required)"); return 0; } if (Channels[chan].isbanned(this.ircnuh) && (chan != this.invited) ) { this.numeric("474", Channels[chan].nam + " :Cannot join channel (+b: you're banned!)"); return 0; } } // add to existing channel Channels[chan].users.push(this.id); var str="JOIN :" + Channels[chan].nam; if (this.parent) { this.bcast_to_channel(Channels[chan].nam, str, false); } else { this.bcast_to_channel(Channels[chan].nam, str, true); if (Channels[chan].topic) { this.numeric332(Channels[chan]); this.numeric333(Channels[chan]); } else { this.numeric331(Channels[chan]); } if (chan_name[0] != "&") server_bcast_to_servers(":" + this.nick + " SJOIN " + Channels[chan].created + " " + Channels[chan].nam); } else { // create a new channel Channels[chan]=new Channel(chan); Channels[chan].nam=chan_name.slice(0,max_chanlen); Channels[chan].mode=CHANMODE_NONE; Channels[chan].topic=""; Channels[chan].created=time(); Channels[chan].users = new Array(); Channels[chan].users[0] = this.id; Channels[chan].modelist[CHANLIST_BAN] = new Array(); Channels[chan].modelist[CHANLIST_VOICE] = new Array(); Channels[chan].modelist[CHANLIST_OP] = new Array(); Channels[chan].modelist[CHANLIST_OP].push(this.id); str="JOIN :" + chan_name; this.originatorout(str,this); if (chan_name[0] != "&") server_bcast_to_servers(":" + servername + " SJOIN " + Channels[chan].created + " " + Channels[chan].nam + " " + Channels[chan].chanmode() + " :@" + this.nick); } if (this.invited.toUpperCase() == Channels[chan].nam.toUpperCase()) this.invited = ""; this.channels.push(chan); if (!this.parent) { this.names(chan); this.numeric(366, Channels[chan].nam + " :End of /NAMES list."); } return 1; // success}
if (this.parent)
if (this.parent) {
function IRCClient_do_join(chan_name,join_key) { if((chan_name[0] != "#") && (chan_name[0] != "&") && !this.parent) { this.numeric403(chan_name); return 0; } for (theChar in chan_name) { var theChar_code = chan_name[theChar].charCodeAt(0); if ((theChar_code <= 32) || (theChar_code == 44) || (chan_name[theChar].charCodeAt(0) == 160)) { if (!this.parent) this.numeric(479, chan_name + " :Channel name contains illegal characters."); return 0; } } if (this.onchannel(chan_name.toUpperCase())) return 0; if ((this.num_channels_on() >= max_user_chans) && !this.parent) { this.numeric("405", chan_name + " :You have joined too many channels."); return 0; } var chan = chan_name.toUpperCase().slice(0,max_chanlen); if (Channels[chan] != undefined) { if (!this.parent) { if ((Channels[chan].mode&CHANMODE_INVITE) && (chan != this.invited)) { this.numeric("473", Channels[chan].nam + " :Cannot join channel (+i: invite only)"); return 0; } if ((Channels[chan].mode&CHANMODE_LIMIT) && (Channels[chan].count_users() >= Channels[chan].arg[CHANMODE_LIMIT])) { this.numeric("471", Channels[chan].nam + " :Cannot join channel (+l: channel is full)"); return 0; } if ((Channels[chan].mode&CHANMODE_KEY) && (Channels[chan].arg[CHANMODE_KEY] != join_key)) { this.numeric("475", Channels[chan].nam + " :Cannot join channel (+k: key required)"); return 0; } if (Channels[chan].isbanned(this.ircnuh) && (chan != this.invited) ) { this.numeric("474", Channels[chan].nam + " :Cannot join channel (+b: you're banned!)"); return 0; } } // add to existing channel Channels[chan].users.push(this.id); var str="JOIN :" + Channels[chan].nam; if (this.parent) this.bcast_to_channel(Channels[chan].nam, str, false); else this.bcast_to_channel(Channels[chan].nam, str, true); if (chan_name[0] != "&") server_bcast_to_servers(":" + this.nick + " SJOIN " + Channels[chan].created + " " + Channels[chan].nam); } else { // create a new channel Channels[chan]=new Channel(chan); Channels[chan].nam=chan_name.slice(0,max_chanlen); Channels[chan].mode=CHANMODE_NONE; Channels[chan].topic=""; Channels[chan].created=time(); Channels[chan].users = new Array(); Channels[chan].users[0] = this.id; Channels[chan].modelist[CHANLIST_BAN] = new Array(); Channels[chan].modelist[CHANLIST_VOICE] = new Array(); Channels[chan].modelist[CHANLIST_OP] = new Array(); Channels[chan].modelist[CHANLIST_OP].push(this.id); str="JOIN :" + chan_name; this.originatorout(str,this); if (chan_name[0] != "&") server_bcast_to_servers(":" + servername + " SJOIN " + Channels[chan].created + " " + Channels[chan].nam + " " + Channels[chan].chanmode() + " :@" + this.nick); } if (this.invited.toUpperCase() == Channels[chan].nam.toUpperCase()) this.invited = ""; this.channels.push(chan); if (!this.parent) { this.names(chan); this.numeric(366, Channels[chan].nam + " :End of /NAMES list."); } return 1; // success}
else
} else {
function IRCClient_do_join(chan_name,join_key) { if((chan_name[0] != "#") && (chan_name[0] != "&") && !this.parent) { this.numeric403(chan_name); return 0; } for (theChar in chan_name) { var theChar_code = chan_name[theChar].charCodeAt(0); if ((theChar_code <= 32) || (theChar_code == 44) || (chan_name[theChar].charCodeAt(0) == 160)) { if (!this.parent) this.numeric(479, chan_name + " :Channel name contains illegal characters."); return 0; } } if (this.onchannel(chan_name.toUpperCase())) return 0; if ((this.num_channels_on() >= max_user_chans) && !this.parent) { this.numeric("405", chan_name + " :You have joined too many channels."); return 0; } var chan = chan_name.toUpperCase().slice(0,max_chanlen); if (Channels[chan] != undefined) { if (!this.parent) { if ((Channels[chan].mode&CHANMODE_INVITE) && (chan != this.invited)) { this.numeric("473", Channels[chan].nam + " :Cannot join channel (+i: invite only)"); return 0; } if ((Channels[chan].mode&CHANMODE_LIMIT) && (Channels[chan].count_users() >= Channels[chan].arg[CHANMODE_LIMIT])) { this.numeric("471", Channels[chan].nam + " :Cannot join channel (+l: channel is full)"); return 0; } if ((Channels[chan].mode&CHANMODE_KEY) && (Channels[chan].arg[CHANMODE_KEY] != join_key)) { this.numeric("475", Channels[chan].nam + " :Cannot join channel (+k: key required)"); return 0; } if (Channels[chan].isbanned(this.ircnuh) && (chan != this.invited) ) { this.numeric("474", Channels[chan].nam + " :Cannot join channel (+b: you're banned!)"); return 0; } } // add to existing channel Channels[chan].users.push(this.id); var str="JOIN :" + Channels[chan].nam; if (this.parent) this.bcast_to_channel(Channels[chan].nam, str, false); else this.bcast_to_channel(Channels[chan].nam, str, true); if (chan_name[0] != "&") server_bcast_to_servers(":" + this.nick + " SJOIN " + Channels[chan].created + " " + Channels[chan].nam); } else { // create a new channel Channels[chan]=new Channel(chan); Channels[chan].nam=chan_name.slice(0,max_chanlen); Channels[chan].mode=CHANMODE_NONE; Channels[chan].topic=""; Channels[chan].created=time(); Channels[chan].users = new Array(); Channels[chan].users[0] = this.id; Channels[chan].modelist[CHANLIST_BAN] = new Array(); Channels[chan].modelist[CHANLIST_VOICE] = new Array(); Channels[chan].modelist[CHANLIST_OP] = new Array(); Channels[chan].modelist[CHANLIST_OP].push(this.id); str="JOIN :" + chan_name; this.originatorout(str,this); if (chan_name[0] != "&") server_bcast_to_servers(":" + servername + " SJOIN " + Channels[chan].created + " " + Channels[chan].nam + " " + Channels[chan].chanmode() + " :@" + this.nick); } if (this.invited.toUpperCase() == Channels[chan].nam.toUpperCase()) this.invited = ""; this.channels.push(chan); if (!this.parent) { this.names(chan); this.numeric(366, Channels[chan].nam + " :End of /NAMES list."); } return 1; // success}
if (Channels[chan].topic) { this.numeric332(Channels[chan]); this.numeric333(Channels[chan]); } else { this.numeric331(Channels[chan]); }
function IRCClient_do_join(chan_name,join_key) { if((chan_name[0] != "#") && (chan_name[0] != "&") && !this.parent) { this.numeric403(chan_name); return 0; } for (theChar in chan_name) { var theChar_code = chan_name[theChar].charCodeAt(0); if ((theChar_code <= 32) || (theChar_code == 44) || (chan_name[theChar].charCodeAt(0) == 160)) { if (!this.parent) this.numeric(479, chan_name + " :Channel name contains illegal characters."); return 0; } } if (this.onchannel(chan_name.toUpperCase())) return 0; if ((this.num_channels_on() >= max_user_chans) && !this.parent) { this.numeric("405", chan_name + " :You have joined too many channels."); return 0; } var chan = chan_name.toUpperCase().slice(0,max_chanlen); if (Channels[chan] != undefined) { if (!this.parent) { if ((Channels[chan].mode&CHANMODE_INVITE) && (chan != this.invited)) { this.numeric("473", Channels[chan].nam + " :Cannot join channel (+i: invite only)"); return 0; } if ((Channels[chan].mode&CHANMODE_LIMIT) && (Channels[chan].count_users() >= Channels[chan].arg[CHANMODE_LIMIT])) { this.numeric("471", Channels[chan].nam + " :Cannot join channel (+l: channel is full)"); return 0; } if ((Channels[chan].mode&CHANMODE_KEY) && (Channels[chan].arg[CHANMODE_KEY] != join_key)) { this.numeric("475", Channels[chan].nam + " :Cannot join channel (+k: key required)"); return 0; } if (Channels[chan].isbanned(this.ircnuh) && (chan != this.invited) ) { this.numeric("474", Channels[chan].nam + " :Cannot join channel (+b: you're banned!)"); return 0; } } // add to existing channel Channels[chan].users.push(this.id); var str="JOIN :" + Channels[chan].nam; if (this.parent) this.bcast_to_channel(Channels[chan].nam, str, false); else this.bcast_to_channel(Channels[chan].nam, str, true); if (chan_name[0] != "&") server_bcast_to_servers(":" + this.nick + " SJOIN " + Channels[chan].created + " " + Channels[chan].nam); } else { // create a new channel Channels[chan]=new Channel(chan); Channels[chan].nam=chan_name.slice(0,max_chanlen); Channels[chan].mode=CHANMODE_NONE; Channels[chan].topic=""; Channels[chan].created=time(); Channels[chan].users = new Array(); Channels[chan].users[0] = this.id; Channels[chan].modelist[CHANLIST_BAN] = new Array(); Channels[chan].modelist[CHANLIST_VOICE] = new Array(); Channels[chan].modelist[CHANLIST_OP] = new Array(); Channels[chan].modelist[CHANLIST_OP].push(this.id); str="JOIN :" + chan_name; this.originatorout(str,this); if (chan_name[0] != "&") server_bcast_to_servers(":" + servername + " SJOIN " + Channels[chan].created + " " + Channels[chan].nam + " " + Channels[chan].chanmode() + " :@" + this.nick); } if (this.invited.toUpperCase() == Channels[chan].nam.toUpperCase()) this.invited = ""; this.channels.push(chan); if (!this.parent) { this.names(chan); this.numeric(366, Channels[chan].nam + " :End of /NAMES list."); } return 1; // success}
server_bcast_to_servers(":" + this.nick + " SJOIN " + Channels[chan].created + " " + Channels[chan].nam);
server_bcast_to_servers(":" + this.nick + " SJOIN " + Channels[chan].created + " " + Channels[chan].nam,BAHAMUT); server_bcast_to_servers(":" + this.nick + " JOIN " + Channels[chan].created,DREAMFORGE);
function IRCClient_do_join(chan_name,join_key) { if((chan_name[0] != "#") && (chan_name[0] != "&") && !this.parent) { this.numeric403(chan_name); return 0; } for (theChar in chan_name) { var theChar_code = chan_name[theChar].charCodeAt(0); if ((theChar_code <= 32) || (theChar_code == 44) || (chan_name[theChar].charCodeAt(0) == 160)) { if (this.local) this.numeric(479, chan_name + " :Channel name contains illegal characters."); return 0; } } if (this.channels[chan_name.toUpperCase()]) return 0; if ((true_array_len(this.channels) >= max_user_chans) && this.local) { this.numeric("405", chan_name + " :You have joined too many channels."); return 0; } var chan = chan_name.toUpperCase().slice(0,max_chanlen); if (Channels[chan] != undefined) { if (this.local) { if ((Channels[chan].mode&CHANMODE_INVITE) && (chan != this.invited)) { this.numeric("473", Channels[chan].nam + " :Cannot join channel (+i: invite only)"); return 0; } if ((Channels[chan].mode&CHANMODE_LIMIT) && (true_array_len(Channels[chan].users) >= Channels[chan].arg[CHANMODE_LIMIT])) { this.numeric("471", Channels[chan].nam + " :Cannot join channel (+l: channel is full)"); return 0; } if ((Channels[chan].mode&CHANMODE_KEY) && (Channels[chan].arg[CHANMODE_KEY] != join_key)) { this.numeric("475", Channels[chan].nam + " :Cannot join channel (+k: key required)"); return 0; } if (Channels[chan].isbanned(this.nuh) && (chan != this.invited) ) { this.numeric("474", Channels[chan].nam + " :Cannot join channel (+b: you're banned!)"); return 0; } } // add to existing channel Channels[chan].users[this.id] = this; var str="JOIN :" + Channels[chan].nam; if (!this.local) { this.bcast_to_channel(Channels[chan], str, false); } else { this.bcast_to_channel(Channels[chan], str, true); if (Channels[chan].topic) { this.numeric332(Channels[chan]); this.numeric333(Channels[chan]); } else { this.numeric331(Channels[chan]); } } if (chan_name[0] != "&") server_bcast_to_servers(":" + this.nick + " SJOIN " + Channels[chan].created + " " + Channels[chan].nam); } else { // create a new channel Channels[chan]=new Channel(chan); Channels[chan].nam=chan_name.slice(0,max_chanlen); Channels[chan].mode=CHANMODE_NONE; Channels[chan].topic=""; Channels[chan].created=time(); Channels[chan].users = new Array(); Channels[chan].users[this.id] = this; Channels[chan].modelist[CHANMODE_BAN] = new Array; Channels[chan].modelist[CHANMODE_VOICE] = new Array; Channels[chan].modelist[CHANMODE_OP] = new Array; Channels[chan].modelist[CHANMODE_OP][this.id] = this; var str="JOIN :" + chan_name; this.originatorout(str,this); if (chan_name[0] != "&") server_bcast_to_servers(":" + servername + " SJOIN " + Channels[chan].created + " " + Channels[chan].nam + " " + Channels[chan].chanmode() + " :@" + this.nick); } if (this.invited.toUpperCase() == Channels[chan].nam.toUpperCase()) this.invited = ""; this.channels[chan] = Channels[chan]; if (!this.parent) { this.names(Channels[chan]); this.numeric(366, Channels[chan].nam + " :End of /NAMES list."); } return 1; // success}
this.originatorout(str,this); if (chan_name[0] != "&") server_bcast_to_servers(":" + servername + " SJOIN " + Channels[chan].created + " " + Channels[chan].nam + " " + Channels[chan].chanmode() + " :@" + this.nick);
var create_op = ""; if (this.local) { this.originatorout(str,this); create_op = "@"; } if (chan_name[0] != "&") { server_bcast_to_servers(":" + servername + " SJOIN " + Channels[chan].created + " " + Channels[chan].nam + " " + Channels[chan].chanmode() + " :" + create_op + this.nick,BAHAMUT); server_bcast_to_servers(":" + this.nick + " JOIN " + Channels[chan].nam,DREAMFORGE); if (create_op) server_bcast_to_servers(":" + servername + " MODE " + Channels[chan].nam + " +o " + this.nick + " " + Channels[chan].created,DREAMFORGE); }
function IRCClient_do_join(chan_name,join_key) { if((chan_name[0] != "#") && (chan_name[0] != "&") && !this.parent) { this.numeric403(chan_name); return 0; } for (theChar in chan_name) { var theChar_code = chan_name[theChar].charCodeAt(0); if ((theChar_code <= 32) || (theChar_code == 44) || (chan_name[theChar].charCodeAt(0) == 160)) { if (this.local) this.numeric(479, chan_name + " :Channel name contains illegal characters."); return 0; } } if (this.channels[chan_name.toUpperCase()]) return 0; if ((true_array_len(this.channels) >= max_user_chans) && this.local) { this.numeric("405", chan_name + " :You have joined too many channels."); return 0; } var chan = chan_name.toUpperCase().slice(0,max_chanlen); if (Channels[chan] != undefined) { if (this.local) { if ((Channels[chan].mode&CHANMODE_INVITE) && (chan != this.invited)) { this.numeric("473", Channels[chan].nam + " :Cannot join channel (+i: invite only)"); return 0; } if ((Channels[chan].mode&CHANMODE_LIMIT) && (true_array_len(Channels[chan].users) >= Channels[chan].arg[CHANMODE_LIMIT])) { this.numeric("471", Channels[chan].nam + " :Cannot join channel (+l: channel is full)"); return 0; } if ((Channels[chan].mode&CHANMODE_KEY) && (Channels[chan].arg[CHANMODE_KEY] != join_key)) { this.numeric("475", Channels[chan].nam + " :Cannot join channel (+k: key required)"); return 0; } if (Channels[chan].isbanned(this.nuh) && (chan != this.invited) ) { this.numeric("474", Channels[chan].nam + " :Cannot join channel (+b: you're banned!)"); return 0; } } // add to existing channel Channels[chan].users[this.id] = this; var str="JOIN :" + Channels[chan].nam; if (!this.local) { this.bcast_to_channel(Channels[chan], str, false); } else { this.bcast_to_channel(Channels[chan], str, true); if (Channels[chan].topic) { this.numeric332(Channels[chan]); this.numeric333(Channels[chan]); } else { this.numeric331(Channels[chan]); } } if (chan_name[0] != "&") server_bcast_to_servers(":" + this.nick + " SJOIN " + Channels[chan].created + " " + Channels[chan].nam); } else { // create a new channel Channels[chan]=new Channel(chan); Channels[chan].nam=chan_name.slice(0,max_chanlen); Channels[chan].mode=CHANMODE_NONE; Channels[chan].topic=""; Channels[chan].created=time(); Channels[chan].users = new Array(); Channels[chan].users[this.id] = this; Channels[chan].modelist[CHANMODE_BAN] = new Array; Channels[chan].modelist[CHANMODE_VOICE] = new Array; Channels[chan].modelist[CHANMODE_OP] = new Array; Channels[chan].modelist[CHANMODE_OP][this.id] = this; var str="JOIN :" + chan_name; this.originatorout(str,this); if (chan_name[0] != "&") server_bcast_to_servers(":" + servername + " SJOIN " + Channels[chan].created + " " + Channels[chan].nam + " " + Channels[chan].chanmode() + " :@" + this.nick); } if (this.invited.toUpperCase() == Channels[chan].nam.toUpperCase()) this.invited = ""; this.channels[chan] = Channels[chan]; if (!this.parent) { this.names(Channels[chan]); this.numeric(366, Channels[chan].nam + " :End of /NAMES list."); } return 1; // success}
if (chan_name[0] != "&") server_bcast_to_servers(":" + this.nick + " SJOIN "
if (chan_name[0] != "&") { this.bcast_to_servers_raw(":" + this.nick + " SJOIN "
function IRCClient_do_join(chan_name,join_key) { chan_name = chan_name.slice(0,max_chanlen) var uc_chan_name = chan_name.toUpperCase(); if((chan_name[0] != "#") && (chan_name[0] != "&") && !this.parent) { this.numeric403(chan_name); return 0; } if(chan_name.search(/[\x00-\x20\x2c\xa0]/)!=-1) { if (this.local) this.numeric(479, chan_name + " :Channel name contains illegal characters."); return 0; } if (this.channels[uc_chan_name]) return 0; if ((true_array_len(this.channels) >= max_user_chans) && this.local) { this.numeric("405", chan_name + " :You have joined too many channels."); return 0; } if (Channels[uc_chan_name]) { var chan = Channels[uc_chan_name]; if (this.local) { if ((chan.mode&CHANMODE_INVITE) && (uc_chan_name != this.invited)) { this.numeric("473", chan.nam + " :Cannot join channel (+i: invite only)"); return 0; } if ((chan.mode&CHANMODE_LIMIT) && (true_array_len(chan.users) >= chan.arg[CHANMODE_LIMIT]) ) { this.numeric("471", chan.nam + " :Cannot join channel (+l: channel is full)"); return 0; } if ((chan.mode&CHANMODE_KEY) && (chan.arg[CHANMODE_KEY] != join_key)) { this.numeric("475", chan.nam + " :Cannot join channel (+k: key required)"); return 0; } if (chan.isbanned(this.nuh) && (uc_chan_name != this.invited) ) { this.numeric("474", Channels[chan].nam + " :Cannot join channel (+b: you're banned!)"); return 0; } } // add to existing channel chan.users[this.id] = this; var str="JOIN :" + chan.nam; if (!this.local) { this.bcast_to_channel(chan, str, false); } else { this.bcast_to_channel(chan, str, true); if (chan.topic) { this.numeric332(chan); this.numeric333(chan); } else { this.numeric331(chan); } } if (chan_name[0] != "&") server_bcast_to_servers(":" + this.nick + " SJOIN " + chan.created + " " + chan.nam,BAHAMUT); server_bcast_to_servers(":" + this.nick + " JOIN " + chan.nam + " " + chan.created,DREAMFORGE); } else { // create a new channel Channels[uc_chan_name] = new Channel(chan_name); chan=Channels[uc_chan_name]; chan.users[this.id] = this; chan.modelist[CHANMODE_OP][this.id] = this; var str="JOIN :" + chan.nam; var create_op = ""; if (this.local) { this.originatorout(str,this); create_op = "@"; } if (chan_name[0] != "&") { server_bcast_to_servers(":" + servername + " SJOIN " + chan.created + " " + chan.nam + " " + chan.chanmode() + " :" + create_op + this.nick,BAHAMUT); server_bcast_to_servers(":" + this.nick + " JOIN " + chan.nam,DREAMFORGE); if (create_op) { server_bcast_to_servers(":" + servername + " MODE " + chan.nam + " +o " + this.nick + " " + chan.created,DREAMFORGE); } } } if (this.invited.toUpperCase() == chan.nam.toUpperCase()) this.invited = ""; this.channels[uc_chan_name] = chan; if (!this.parent) { this.names(chan); this.numeric(366, chan.nam + " :End of /NAMES list."); } return 1; // success}
server_bcast_to_servers(":" + this.nick + " JOIN "
this.bcast_to_servers_raw(":" + this.nick + " JOIN "
function IRCClient_do_join(chan_name,join_key) { chan_name = chan_name.slice(0,max_chanlen) var uc_chan_name = chan_name.toUpperCase(); if((chan_name[0] != "#") && (chan_name[0] != "&") && !this.parent) { this.numeric403(chan_name); return 0; } if(chan_name.search(/[\x00-\x20\x2c\xa0]/)!=-1) { if (this.local) this.numeric(479, chan_name + " :Channel name contains illegal characters."); return 0; } if (this.channels[uc_chan_name]) return 0; if ((true_array_len(this.channels) >= max_user_chans) && this.local) { this.numeric("405", chan_name + " :You have joined too many channels."); return 0; } if (Channels[uc_chan_name]) { var chan = Channels[uc_chan_name]; if (this.local) { if ((chan.mode&CHANMODE_INVITE) && (uc_chan_name != this.invited)) { this.numeric("473", chan.nam + " :Cannot join channel (+i: invite only)"); return 0; } if ((chan.mode&CHANMODE_LIMIT) && (true_array_len(chan.users) >= chan.arg[CHANMODE_LIMIT]) ) { this.numeric("471", chan.nam + " :Cannot join channel (+l: channel is full)"); return 0; } if ((chan.mode&CHANMODE_KEY) && (chan.arg[CHANMODE_KEY] != join_key)) { this.numeric("475", chan.nam + " :Cannot join channel (+k: key required)"); return 0; } if (chan.isbanned(this.nuh) && (uc_chan_name != this.invited) ) { this.numeric("474", Channels[chan].nam + " :Cannot join channel (+b: you're banned!)"); return 0; } } // add to existing channel chan.users[this.id] = this; var str="JOIN :" + chan.nam; if (!this.local) { this.bcast_to_channel(chan, str, false); } else { this.bcast_to_channel(chan, str, true); if (chan.topic) { this.numeric332(chan); this.numeric333(chan); } else { this.numeric331(chan); } } if (chan_name[0] != "&") server_bcast_to_servers(":" + this.nick + " SJOIN " + chan.created + " " + chan.nam,BAHAMUT); server_bcast_to_servers(":" + this.nick + " JOIN " + chan.nam + " " + chan.created,DREAMFORGE); } else { // create a new channel Channels[uc_chan_name] = new Channel(chan_name); chan=Channels[uc_chan_name]; chan.users[this.id] = this; chan.modelist[CHANMODE_OP][this.id] = this; var str="JOIN :" + chan.nam; var create_op = ""; if (this.local) { this.originatorout(str,this); create_op = "@"; } if (chan_name[0] != "&") { server_bcast_to_servers(":" + servername + " SJOIN " + chan.created + " " + chan.nam + " " + chan.chanmode() + " :" + create_op + this.nick,BAHAMUT); server_bcast_to_servers(":" + this.nick + " JOIN " + chan.nam,DREAMFORGE); if (create_op) { server_bcast_to_servers(":" + servername + " MODE " + chan.nam + " +o " + this.nick + " " + chan.created,DREAMFORGE); } } } if (this.invited.toUpperCase() == chan.nam.toUpperCase()) this.invited = ""; this.channels[uc_chan_name] = chan; if (!this.parent) { this.names(chan); this.numeric(366, chan.nam + " :End of /NAMES list."); } return 1; // success}
var create_op = "";
var create_op;
function IRCClient_do_join(chan_name,join_key) { chan_name = chan_name.slice(0,max_chanlen) var uc_chan_name = chan_name.toUpperCase(); if((chan_name[0] != "#") && (chan_name[0] != "&") && !this.parent) { this.numeric403(chan_name); return 0; } if(chan_name.search(/[\x00-\x20\x2c\xa0]/)!=-1) { if (this.local) this.numeric(479, chan_name + " :Channel name contains illegal characters."); return 0; } if (this.channels[uc_chan_name]) return 0; if ((true_array_len(this.channels) >= max_user_chans) && this.local) { this.numeric("405", chan_name + " :You have joined too many channels."); return 0; } if (Channels[uc_chan_name]) { var chan = Channels[uc_chan_name]; if (this.local) { if ((chan.mode&CHANMODE_INVITE) && (uc_chan_name != this.invited)) { this.numeric("473", chan.nam + " :Cannot join channel (+i: invite only)"); return 0; } if ((chan.mode&CHANMODE_LIMIT) && (true_array_len(chan.users) >= chan.arg[CHANMODE_LIMIT]) ) { this.numeric("471", chan.nam + " :Cannot join channel (+l: channel is full)"); return 0; } if ((chan.mode&CHANMODE_KEY) && (chan.arg[CHANMODE_KEY] != join_key)) { this.numeric("475", chan.nam + " :Cannot join channel (+k: key required)"); return 0; } if (chan.isbanned(this.nuh) && (uc_chan_name != this.invited) ) { this.numeric("474", Channels[chan].nam + " :Cannot join channel (+b: you're banned!)"); return 0; } } // add to existing channel chan.users[this.id] = this; var str="JOIN :" + chan.nam; if (!this.local) { this.bcast_to_channel(chan, str, false); } else { this.bcast_to_channel(chan, str, true); if (chan.topic) { this.numeric332(chan); this.numeric333(chan); } else { this.numeric331(chan); } } if (chan_name[0] != "&") server_bcast_to_servers(":" + this.nick + " SJOIN " + chan.created + " " + chan.nam,BAHAMUT); server_bcast_to_servers(":" + this.nick + " JOIN " + chan.nam + " " + chan.created,DREAMFORGE); } else { // create a new channel Channels[uc_chan_name] = new Channel(chan_name); chan=Channels[uc_chan_name]; chan.users[this.id] = this; chan.modelist[CHANMODE_OP][this.id] = this; var str="JOIN :" + chan.nam; var create_op = ""; if (this.local) { this.originatorout(str,this); create_op = "@"; } if (chan_name[0] != "&") { server_bcast_to_servers(":" + servername + " SJOIN " + chan.created + " " + chan.nam + " " + chan.chanmode() + " :" + create_op + this.nick,BAHAMUT); server_bcast_to_servers(":" + this.nick + " JOIN " + chan.nam,DREAMFORGE); if (create_op) { server_bcast_to_servers(":" + servername + " MODE " + chan.nam + " +o " + this.nick + " " + chan.created,DREAMFORGE); } } } if (this.invited.toUpperCase() == chan.nam.toUpperCase()) this.invited = ""; this.channels[uc_chan_name] = chan; if (!this.parent) { this.names(chan); this.numeric(366, chan.nam + " :End of /NAMES list."); } return 1; // success}
server_bcast_to_servers(":" + servername + " SJOIN "
this.bcast_to_servers_raw(":" + servername + " SJOIN "
function IRCClient_do_join(chan_name,join_key) { chan_name = chan_name.slice(0,max_chanlen) var uc_chan_name = chan_name.toUpperCase(); if((chan_name[0] != "#") && (chan_name[0] != "&") && !this.parent) { this.numeric403(chan_name); return 0; } if(chan_name.search(/[\x00-\x20\x2c\xa0]/)!=-1) { if (this.local) this.numeric(479, chan_name + " :Channel name contains illegal characters."); return 0; } if (this.channels[uc_chan_name]) return 0; if ((true_array_len(this.channels) >= max_user_chans) && this.local) { this.numeric("405", chan_name + " :You have joined too many channels."); return 0; } if (Channels[uc_chan_name]) { var chan = Channels[uc_chan_name]; if (this.local) { if ((chan.mode&CHANMODE_INVITE) && (uc_chan_name != this.invited)) { this.numeric("473", chan.nam + " :Cannot join channel (+i: invite only)"); return 0; } if ((chan.mode&CHANMODE_LIMIT) && (true_array_len(chan.users) >= chan.arg[CHANMODE_LIMIT]) ) { this.numeric("471", chan.nam + " :Cannot join channel (+l: channel is full)"); return 0; } if ((chan.mode&CHANMODE_KEY) && (chan.arg[CHANMODE_KEY] != join_key)) { this.numeric("475", chan.nam + " :Cannot join channel (+k: key required)"); return 0; } if (chan.isbanned(this.nuh) && (uc_chan_name != this.invited) ) { this.numeric("474", Channels[chan].nam + " :Cannot join channel (+b: you're banned!)"); return 0; } } // add to existing channel chan.users[this.id] = this; var str="JOIN :" + chan.nam; if (!this.local) { this.bcast_to_channel(chan, str, false); } else { this.bcast_to_channel(chan, str, true); if (chan.topic) { this.numeric332(chan); this.numeric333(chan); } else { this.numeric331(chan); } } if (chan_name[0] != "&") server_bcast_to_servers(":" + this.nick + " SJOIN " + chan.created + " " + chan.nam,BAHAMUT); server_bcast_to_servers(":" + this.nick + " JOIN " + chan.nam + " " + chan.created,DREAMFORGE); } else { // create a new channel Channels[uc_chan_name] = new Channel(chan_name); chan=Channels[uc_chan_name]; chan.users[this.id] = this; chan.modelist[CHANMODE_OP][this.id] = this; var str="JOIN :" + chan.nam; var create_op = ""; if (this.local) { this.originatorout(str,this); create_op = "@"; } if (chan_name[0] != "&") { server_bcast_to_servers(":" + servername + " SJOIN " + chan.created + " " + chan.nam + " " + chan.chanmode() + " :" + create_op + this.nick,BAHAMUT); server_bcast_to_servers(":" + this.nick + " JOIN " + chan.nam,DREAMFORGE); if (create_op) { server_bcast_to_servers(":" + servername + " MODE " + chan.nam + " +o " + this.nick + " " + chan.created,DREAMFORGE); } } } if (this.invited.toUpperCase() == chan.nam.toUpperCase()) this.invited = ""; this.channels[uc_chan_name] = chan; if (!this.parent) { this.names(chan); this.numeric(366, chan.nam + " :End of /NAMES list."); } return 1; // success}
(Channels[chan].count_users() >= Channels[chan].arg[CHANMODE_LIMIT])) {
(true_array_len(Channels[chan].users) >= Channels[chan].arg[CHANMODE_LIMIT])) {
function IRCClient_do_join(chan_name,join_key) { if((chan_name[0] != "#") && (chan_name[0] != "&") && !this.parent) { this.numeric403(chan_name); return 0; } for (theChar in chan_name) { var theChar_code = chan_name[theChar].charCodeAt(0); if ((theChar_code <= 32) || (theChar_code == 44) || (chan_name[theChar].charCodeAt(0) == 160)) { if (this.local) this.numeric(479, chan_name + " :Channel name contains illegal characters."); return 0; } } if (this.channels[chan_name.toUpperCase()]) return 0; if ((true_array_len(this.channels) >= max_user_chans) && this.local) { this.numeric("405", chan_name + " :You have joined too many channels."); return 0; } var chan = chan_name.toUpperCase().slice(0,max_chanlen); if (Channels[chan] != undefined) { if (this.local) { if ((Channels[chan].mode&CHANMODE_INVITE) && (chan != this.invited)) { this.numeric("473", Channels[chan].nam + " :Cannot join channel (+i: invite only)"); return 0; } if ((Channels[chan].mode&CHANMODE_LIMIT) && (Channels[chan].count_users() >= Channels[chan].arg[CHANMODE_LIMIT])) { this.numeric("471", Channels[chan].nam + " :Cannot join channel (+l: channel is full)"); return 0; } if ((Channels[chan].mode&CHANMODE_KEY) && (Channels[chan].arg[CHANMODE_KEY] != join_key)) { this.numeric("475", Channels[chan].nam + " :Cannot join channel (+k: key required)"); return 0; } if (Channels[chan].isbanned(this.nuh) && (chan != this.invited) ) { this.numeric("474", Channels[chan].nam + " :Cannot join channel (+b: you're banned!)"); return 0; } } // add to existing channel Channels[chan].users[this.id] = this; var str="JOIN :" + Channels[chan].nam; if (!this.local) { this.bcast_to_channel(Channels[chan], str, false); } else { this.bcast_to_channel(Channels[chan], str, true); if (Channels[chan].topic) { this.numeric332(Channels[chan]); this.numeric333(Channels[chan]); } else { this.numeric331(Channels[chan]); } } if (chan_name[0] != "&") server_bcast_to_servers(":" + this.nick + " SJOIN " + Channels[chan].created + " " + Channels[chan].nam); } else { // create a new channel Channels[chan]=new Channel(chan); Channels[chan].nam=chan_name.slice(0,max_chanlen); Channels[chan].mode=CHANMODE_NONE; Channels[chan].topic=""; Channels[chan].created=time(); Channels[chan].users = new Array(); Channels[chan].users[this.id] = this; Channels[chan].modelist[CHANMODE_BAN] = new Array; Channels[chan].modelist[CHANMODE_VOICE] = new Array; Channels[chan].modelist[CHANMODE_OP] = new Array; Channels[chan].modelist[CHANMODE_OP][this.id] = this; var str="JOIN :" + chan_name; this.originatorout(str,this); if (chan_name[0] != "&") server_bcast_to_servers(":" + servername + " SJOIN " + Channels[chan].created + " " + Channels[chan].nam + " " + Channels[chan].chanmode() + " :@" + this.nick); } if (this.invited.toUpperCase() == Channels[chan].nam.toUpperCase()) this.invited = ""; this.channels[chan] = Channels[chan]; if (!this.parent) { this.names(Channels[chan]); this.numeric(366, Channels[chan].nam + " :End of /NAMES list."); } return 1; // success}
if (wildmatch(Server.nick,mask)) this.numeric(364, Server.nick + " " + Server.linkparent + " :" + Server.hops + " " + Server.info);
if (wildmatch(Server.nick,mask)) { this.numeric(364, Server.nick + " " + Server.linkparent + " :" + Server.hops + " " + Server.info); }
function IRCClient_do_links(mask) { if (!mask) mask = "*"; umode_notice(USERMODE_SPY,"Spy","LINKS " + mask + " requested by " + this.nick + " (" + this.uprefix + "@" + this.hostname + ") [" + this.servername + "]"); for(thisServer in Servers) { var Server=Servers[thisServer]; if (wildmatch(Server.nick,mask)) this.numeric(364, Server.nick + " " + Server.linkparent + " :" + Server.hops + " " + Server.info); } if (wildmatch(servername,mask)) this.numeric(364, servername + " " + servername + " :0 " + serverdesc); this.numeric(365, mask + " :End of /LINKS list.");}
var mask = "*";
mask = "*";
function IRCClient_do_links(mask) { if (!mask) var mask = "*"; for(thisServer in Clients) { var Server=Clients[thisServer]; if (Server && (Server.conntype == TYPE_SERVER) && match_irc_mask(Server.nick,mask) ) this.numeric(364, Server.nick + " " + Server.linkparent + " :" + Server.hops + " " + Server.realname); } if (match_irc_mask(servername,mask)) this.numeric(364, servername + " " + servername + " :0 " + serverdesc); this.numeric(365, mask + " :End of /LINKS list.");}
umode_notice(USERMODE_SPY,"Spy","LINKS " + mask + " requested from " + this.nick + " (" + this.uprefix + "@" + this.hostname + ") [" + this.servername + "]");
function IRCClient_do_links(mask) { if (!mask) mask = "*"; for(thisServer in Clients) { var Server=Clients[thisServer]; if (Server && (Server.conntype == TYPE_SERVER) && match_irc_mask(Server.nick,mask) ) this.numeric(364, Server.nick + " " + Server.linkparent + " :" + Server.hops + " " + Server.realname); } if (match_irc_mask(servername,mask)) this.numeric(364, servername + " " + servername + " :0 " + serverdesc); this.numeric(365, mask + " :End of /LINKS list.");}
if ((chan.mode&CHANMODE_NOOUTSIDE) && !this.channels[chan.nam.toUpperCase()]) { this.numeric(404, chan.nam + " :Cannot send to channel (+n: no outside messages)");
if ((chan.mode&CHANMODE_NOOUTSIDE) && !this.channels[chan.nam.toUpperCase()]) { this.numeric(404, chan.nam + " :Cannot send to channel " + "(+n: no outside messages)");
function IRCClient_do_msg(target,type_str,send_str) { if ( (target[0] == "$") && (this.mode&USERMODE_OPER) && ( (this.flags&OLINE_CAN_LGNOTICE) || !this.local) ) return this.global(target,type_str,send_str); var send_to_list = -1; if (target[0] == "@" && ( (target[1] == "#") || target[1] == "&") ) { send_to_list = CHANMODE_OP; target = target.slice(1); } else if (target[0]=="+" && ((target[1] == "#")|| target[1] == "&")) { send_to_list = CHANMODE_VOICE; target = target.slice(1); } if ((target[0] == "#") || (target[0] == "&")) { var chan = Channels[target.toUpperCase()]; if (!chan) { // check to see if it's a #*hostmask* oper message if ( (target[0] == "#") && (this.mode&USERMODE_OPER) && ( (this.flags&OLINE_CAN_LGNOTICE) || !this.local ) ) { return this.global(target,type_str,send_str); } else { this.numeric401(target); return 0; } } if ((chan.mode&CHANMODE_NOOUTSIDE) && !this.channels[chan.nam.toUpperCase()]) { this.numeric(404, chan.nam + " :Cannot send to channel (+n: no outside messages)"); return 0; } if ( (chan.mode&CHANMODE_MODERATED) && !chan.modelist[CHANMODE_VOICE][this.id] && !chan.modelist[CHANMODE_OP][this.id] ) { this.numeric(404, chan.nam + " :Cannot send to channel (+m: moderated)"); return 0; } if (chan.isbanned(this.nuh) && !chan.modelist[CHANMODE_VOICE][this.id] && !chan.modelist[CHANMODE_OP][this.id] ) { this.numeric(404, chan.nam + " :Cannot send to channel (+b: you're banned!)"); return 0; } if(send_to_list == -1) { var str = type_str +" "+ chan.nam +" :"+ send_str; this.bcast_to_channel(chan, str, false); this.bcast_to_channel_servers(chan, str); } else { var prefix_chr; if (send_to_list == CHANMODE_OP) prefix_chr="@"; else if (send_to_list == CHANMODE_VOICE) prefix_chr="+"; var str = type_str +" " + prefix_chr + chan.nam + " :"+ send_str; this.bcast_to_list(chan, str, false, send_to_list); this.bcast_to_channel_servers(chan, str); } } else { if (target.match("[@]")) { var msg_arg = target.split('@'); var real_target = msg_arg[0]; var target_server = searchbyserver(msg_arg[1]); if (!target_server) { this.numeric401(target); return 0; } if (target_server == -1) { this.numeric(407, target + " :Duplicate recipients, no message delivered."); return 0; } target = msg_arg[0] + "@" + msg_arg[1]; } else { var real_target = target; } var target_socket = Users[real_target.toUpperCase()]; if (target_socket) { if (target_server && (target_server.parent != target_socket.parent)) { this.numeric401(target); return 0; } if (target_server && (target_server.id == target_socket.parent) ) target = real_target; var str = type_str + " " + target + " :" + send_str; target_socket.originatorout(str,this); if (target_socket.away && (type_str == "PRIVMSG") && !this.server && target_socket.local) this.numeric(301, target_socket.nick + " :" + target_socket.away); } else { this.numeric401(target); return 0; } } return 1;}
this.numeric(404, chan.nam + " :Cannot send to channel (+m: moderated)");
this.numeric(404, chan.nam + " :Cannot send to channel " + "(+m: moderated)");
function IRCClient_do_msg(target,type_str,send_str) { if ( (target[0] == "$") && (this.mode&USERMODE_OPER) && ( (this.flags&OLINE_CAN_LGNOTICE) || !this.local) ) return this.global(target,type_str,send_str); var send_to_list = -1; if (target[0] == "@" && ( (target[1] == "#") || target[1] == "&") ) { send_to_list = CHANMODE_OP; target = target.slice(1); } else if (target[0]=="+" && ((target[1] == "#")|| target[1] == "&")) { send_to_list = CHANMODE_VOICE; target = target.slice(1); } if ((target[0] == "#") || (target[0] == "&")) { var chan = Channels[target.toUpperCase()]; if (!chan) { // check to see if it's a #*hostmask* oper message if ( (target[0] == "#") && (this.mode&USERMODE_OPER) && ( (this.flags&OLINE_CAN_LGNOTICE) || !this.local ) ) { return this.global(target,type_str,send_str); } else { this.numeric401(target); return 0; } } if ((chan.mode&CHANMODE_NOOUTSIDE) && !this.channels[chan.nam.toUpperCase()]) { this.numeric(404, chan.nam + " :Cannot send to channel (+n: no outside messages)"); return 0; } if ( (chan.mode&CHANMODE_MODERATED) && !chan.modelist[CHANMODE_VOICE][this.id] && !chan.modelist[CHANMODE_OP][this.id] ) { this.numeric(404, chan.nam + " :Cannot send to channel (+m: moderated)"); return 0; } if (chan.isbanned(this.nuh) && !chan.modelist[CHANMODE_VOICE][this.id] && !chan.modelist[CHANMODE_OP][this.id] ) { this.numeric(404, chan.nam + " :Cannot send to channel (+b: you're banned!)"); return 0; } if(send_to_list == -1) { var str = type_str +" "+ chan.nam +" :"+ send_str; this.bcast_to_channel(chan, str, false); this.bcast_to_channel_servers(chan, str); } else { var prefix_chr; if (send_to_list == CHANMODE_OP) prefix_chr="@"; else if (send_to_list == CHANMODE_VOICE) prefix_chr="+"; var str = type_str +" " + prefix_chr + chan.nam + " :"+ send_str; this.bcast_to_list(chan, str, false, send_to_list); this.bcast_to_channel_servers(chan, str); } } else { if (target.match("[@]")) { var msg_arg = target.split('@'); var real_target = msg_arg[0]; var target_server = searchbyserver(msg_arg[1]); if (!target_server) { this.numeric401(target); return 0; } if (target_server == -1) { this.numeric(407, target + " :Duplicate recipients, no message delivered."); return 0; } target = msg_arg[0] + "@" + msg_arg[1]; } else { var real_target = target; } var target_socket = Users[real_target.toUpperCase()]; if (target_socket) { if (target_server && (target_server.parent != target_socket.parent)) { this.numeric401(target); return 0; } if (target_server && (target_server.id == target_socket.parent) ) target = real_target; var str = type_str + " " + target + " :" + send_str; target_socket.originatorout(str,this); if (target_socket.away && (type_str == "PRIVMSG") && !this.server && target_socket.local) this.numeric(301, target_socket.nick + " :" + target_socket.away); } else { this.numeric401(target); return 0; } } return 1;}
this.numeric(404, chan.nam + " :Cannot send to channel (+b: you're banned!)");
this.numeric(404, chan.nam + " :Cannot send to channel " + "(+b: you're banned!)");
function IRCClient_do_msg(target,type_str,send_str) { if ( (target[0] == "$") && (this.mode&USERMODE_OPER) && ( (this.flags&OLINE_CAN_LGNOTICE) || !this.local) ) return this.global(target,type_str,send_str); var send_to_list = -1; if (target[0] == "@" && ( (target[1] == "#") || target[1] == "&") ) { send_to_list = CHANMODE_OP; target = target.slice(1); } else if (target[0]=="+" && ((target[1] == "#")|| target[1] == "&")) { send_to_list = CHANMODE_VOICE; target = target.slice(1); } if ((target[0] == "#") || (target[0] == "&")) { var chan = Channels[target.toUpperCase()]; if (!chan) { // check to see if it's a #*hostmask* oper message if ( (target[0] == "#") && (this.mode&USERMODE_OPER) && ( (this.flags&OLINE_CAN_LGNOTICE) || !this.local ) ) { return this.global(target,type_str,send_str); } else { this.numeric401(target); return 0; } } if ((chan.mode&CHANMODE_NOOUTSIDE) && !this.channels[chan.nam.toUpperCase()]) { this.numeric(404, chan.nam + " :Cannot send to channel (+n: no outside messages)"); return 0; } if ( (chan.mode&CHANMODE_MODERATED) && !chan.modelist[CHANMODE_VOICE][this.id] && !chan.modelist[CHANMODE_OP][this.id] ) { this.numeric(404, chan.nam + " :Cannot send to channel (+m: moderated)"); return 0; } if (chan.isbanned(this.nuh) && !chan.modelist[CHANMODE_VOICE][this.id] && !chan.modelist[CHANMODE_OP][this.id] ) { this.numeric(404, chan.nam + " :Cannot send to channel (+b: you're banned!)"); return 0; } if(send_to_list == -1) { var str = type_str +" "+ chan.nam +" :"+ send_str; this.bcast_to_channel(chan, str, false); this.bcast_to_channel_servers(chan, str); } else { var prefix_chr; if (send_to_list == CHANMODE_OP) prefix_chr="@"; else if (send_to_list == CHANMODE_VOICE) prefix_chr="+"; var str = type_str +" " + prefix_chr + chan.nam + " :"+ send_str; this.bcast_to_list(chan, str, false, send_to_list); this.bcast_to_channel_servers(chan, str); } } else { if (target.match("[@]")) { var msg_arg = target.split('@'); var real_target = msg_arg[0]; var target_server = searchbyserver(msg_arg[1]); if (!target_server) { this.numeric401(target); return 0; } if (target_server == -1) { this.numeric(407, target + " :Duplicate recipients, no message delivered."); return 0; } target = msg_arg[0] + "@" + msg_arg[1]; } else { var real_target = target; } var target_socket = Users[real_target.toUpperCase()]; if (target_socket) { if (target_server && (target_server.parent != target_socket.parent)) { this.numeric401(target); return 0; } if (target_server && (target_server.id == target_socket.parent) ) target = real_target; var str = type_str + " " + target + " :" + send_str; target_socket.originatorout(str,this); if (target_socket.away && (type_str == "PRIVMSG") && !this.server && target_socket.local) this.numeric(301, target_socket.nick + " :" + target_socket.away); } else { this.numeric401(target); return 0; } } return 1;}
if ((target[0] == "$") && (this.mode&USERMODE_OPER) && (this.flags&OLINE_CAN_LGNOTICE))
if ( (target[0] == "$") && (this.mode&USERMODE_OPER) && ( (this.flags&OLINE_CAN_LGNOTICE) || !this.local) )
function IRCClient_do_msg(target,type_str,send_str) { if ((target[0] == "$") && (this.mode&USERMODE_OPER) && (this.flags&OLINE_CAN_LGNOTICE)) return this.global(target,type_str,send_str); var send_to_list = -1; if (target[0] == "@" && ( (target[1] == "#") || target[1] == "&") ) { send_to_list = CHANMODE_OP; target = target.slice(1); } else if (target[0]=="+" && ((target[1] == "#")|| target[1] == "&")) { send_to_list = CHANMODE_VOICE; target = target.slice(1); } if ((target[0] == "#") || (target[0] == "&")) { var chan = Channels[target.toUpperCase()]; if (!chan) { // check to see if it's a #*hostmask* oper message if ((target[0] == "#") && (this.mode&USERMODE_OPER) && (this.flags&OLINE_CAN_LGNOTICE)) { return this.global(target,type_str,send_str); } else { this.numeric401(target); return 0; } } if ((chan.mode&CHANMODE_NOOUTSIDE) && !this.channels[chan.nam.toUpperCase()]) { this.numeric(404, chan.nam + " :Cannot send to channel (+n: no outside messages)"); return 0; } if ( (chan.mode&CHANMODE_MODERATED) && !chan.modelist[CHANMODE_VOICE][this.id] && !chan.modelist[CHANMODE_OP][this.id] ) { this.numeric(404, chan.nam + " :Cannot send to channel (+m: moderated)"); return 0; } if (chan.isbanned(this.nuh) && !chan.modelist[CHANMODE_VOICE][this.id] && !chan.modelist[CHANMODE_OP][this.id] ) { this.numeric(404, chan.nam + " :Cannot send to channel (+b: you're banned!)"); return 0; } if(send_to_list == -1) { var str = type_str +" "+ chan.nam +" :"+ send_str; this.bcast_to_channel(chan, str, false); this.bcast_to_channel_servers(chan, str); } else { var prefix_chr; if (send_to_list == CHANMODE_OP) prefix_chr="@"; else if (send_to_list == CHANMODE_VOICE) prefix_chr="+"; var str = type_str +" " + prefix_chr + chan.nam + " :"+ send_str; this.bcast_to_list(chan, str, false, send_to_list); this.bcast_to_channel_servers(chan, str); } } else { if (target.match("[@]")) { var msg_arg = target.split('@'); var real_target = msg_arg[0]; var target_server = searchbyserver(msg_arg[1]); if (!target_server) { this.numeric401(target); return 0; } if (target_server == -1) { this.numeric(407, target + " :Duplicate recipients, no message delivered."); return 0; } target = msg_arg[0] + "@" + msg_arg[1]; } else { var real_target = target; } var target_socket = Users[real_target.toUpperCase()]; if (target_socket) { if (target_server && (target_server.parent != target_socket.parent)) { this.numeric401(target); return 0; } if (target_server && (target_server.id == target_socket.parent) ) target = real_target; var str = type_str + " " + target + " :" + send_str; target_socket.originatorout(str,this); if (target_socket.away && (type_str == "PRIVMSG") && !this.server && this.local) this.numeric(301, target_socket.nick + " :" + target_socket.away); } else { this.numeric401(target); return 0; } } return 1;}
if ((target[0] == "#") && (this.mode&USERMODE_OPER) && (this.flags&OLINE_CAN_LGNOTICE)) {
if ( (target[0] == "#") && (this.mode&USERMODE_OPER) && ( (this.flags&OLINE_CAN_LGNOTICE) || !this.local ) ) {
function IRCClient_do_msg(target,type_str,send_str) { if ((target[0] == "$") && (this.mode&USERMODE_OPER) && (this.flags&OLINE_CAN_LGNOTICE)) return this.global(target,type_str,send_str); var send_to_list = -1; if (target[0] == "@" && ( (target[1] == "#") || target[1] == "&") ) { send_to_list = CHANMODE_OP; target = target.slice(1); } else if (target[0]=="+" && ((target[1] == "#")|| target[1] == "&")) { send_to_list = CHANMODE_VOICE; target = target.slice(1); } if ((target[0] == "#") || (target[0] == "&")) { var chan = Channels[target.toUpperCase()]; if (!chan) { // check to see if it's a #*hostmask* oper message if ((target[0] == "#") && (this.mode&USERMODE_OPER) && (this.flags&OLINE_CAN_LGNOTICE)) { return this.global(target,type_str,send_str); } else { this.numeric401(target); return 0; } } if ((chan.mode&CHANMODE_NOOUTSIDE) && !this.channels[chan.nam.toUpperCase()]) { this.numeric(404, chan.nam + " :Cannot send to channel (+n: no outside messages)"); return 0; } if ( (chan.mode&CHANMODE_MODERATED) && !chan.modelist[CHANMODE_VOICE][this.id] && !chan.modelist[CHANMODE_OP][this.id] ) { this.numeric(404, chan.nam + " :Cannot send to channel (+m: moderated)"); return 0; } if (chan.isbanned(this.nuh) && !chan.modelist[CHANMODE_VOICE][this.id] && !chan.modelist[CHANMODE_OP][this.id] ) { this.numeric(404, chan.nam + " :Cannot send to channel (+b: you're banned!)"); return 0; } if(send_to_list == -1) { var str = type_str +" "+ chan.nam +" :"+ send_str; this.bcast_to_channel(chan, str, false); this.bcast_to_channel_servers(chan, str); } else { var prefix_chr; if (send_to_list == CHANMODE_OP) prefix_chr="@"; else if (send_to_list == CHANMODE_VOICE) prefix_chr="+"; var str = type_str +" " + prefix_chr + chan.nam + " :"+ send_str; this.bcast_to_list(chan, str, false, send_to_list); this.bcast_to_channel_servers(chan, str); } } else { if (target.match("[@]")) { var msg_arg = target.split('@'); var real_target = msg_arg[0]; var target_server = searchbyserver(msg_arg[1]); if (!target_server) { this.numeric401(target); return 0; } if (target_server == -1) { this.numeric(407, target + " :Duplicate recipients, no message delivered."); return 0; } target = msg_arg[0] + "@" + msg_arg[1]; } else { var real_target = target; } var target_socket = Users[real_target.toUpperCase()]; if (target_socket) { if (target_server && (target_server.parent != target_socket.parent)) { this.numeric401(target); return 0; } if (target_server && (target_server.id == target_socket.parent) ) target = real_target; var str = type_str + " " + target + " :" + send_str; target_socket.originatorout(str,this); if (target_socket.away && (type_str == "PRIVMSG") && !this.server && this.local) this.numeric(301, target_socket.nick + " :" + target_socket.away); } else { this.numeric401(target); return 0; } } return 1;}
if ((target[0] == "$") && (this.mode&USERMODE_OPER)) { var global_mask = target.slice(1); var global_str = type_str + " " + target + " :" + send_str; for(globClient in Clients) { var Client = Clients[globClient]; if ((Client.conntype == TYPE_USER) && match_irc_mask(Client.servername,global_mask) && Client.local) Client.originatorout(global_str,this); } global_str = ":" + this.nick + " " + global_str; if(this.parent) { var globServer = Clients[this.parent]; globServer.bcast_to_servers_raw(global_str); } else { server_bcast_to_servers(global_str); } return 1; }
if ((target[0] == "$") && (this.mode&USERMODE_OPER)) return this.global(target,type_str,send_str);
function IRCClient_do_msg(target,type_str,send_str) { if ((target[0] == "$") && (this.mode&USERMODE_OPER)) { var global_mask = target.slice(1); var global_str = type_str + " " + target + " :" + send_str; for(globClient in Clients) { var Client = Clients[globClient]; if ((Client.conntype == TYPE_USER) && match_irc_mask(Client.servername,global_mask) && Client.local) Client.originatorout(global_str,this); } global_str = ":" + this.nick + " " + global_str; if(this.parent) { var globServer = Clients[this.parent]; globServer.bcast_to_servers_raw(global_str); } else { server_bcast_to_servers(global_str); } return 1; } send_to_list = -1; if (target[0] == "@" && ( (target[1] == "#") || target[1] == "&") ) { send_to_list = CHANLIST_OP; target = target.slice(1); } else if (target[0]=="+" && ((target[1] == "#")|| target[1] == "&")) { send_to_list = CHANLIST_VOICE; target = target.slice(1); } if ((target[0] == "#") || (target[0] == "&")) { chan = searchbychannel(target); if (!chan) { this.numeric401(target); return 0; } if ( (chan.mode&CHANMODE_NOOUTSIDE) && !this.onchannel(chan.nam.toUpperCase())) { this.numeric(404, chan.nam + " :Cannot send to channel (+n: no outside messages)"); return 0; } if ( (chan.mode&CHANMODE_MODERATED) && !chan.ismode(this.id,CHANLIST_VOICE) && !chan.ismode(this.id,CHANLIST_OP) ) { this.numeric(404, chan.nam + " :Cannot send to channel (+m: moderated)"); return 0; } if (chan.isbanned(this.ircnuh) && !chan.ismode(this.id,CHANLIST_VOICE) && !chan.ismode(this.id,CHANLIST_OP) ) { this.numeric(404, chan.nam + " :Cannot send to channel (+b: you're banned!)"); return 0; } if(send_to_list == -1) { str = type_str +" "+ chan.nam +" :"+ send_str; this.bcast_to_channel(chan.nam, str, false); this.bcast_to_channel_servers(chan.nam, str); } else { if (send_to_list == CHANLIST_OP) prefix_chr="@"; else if (send_to_list == CHANLIST_VOICE) prefix_chr="+"; str = type_str +" " + prefix_chr + chan.nam + " :"+ send_str; this.bcast_to_list(chan, str, false, send_to_list); this.bcast_to_channel_servers(chan.nam, str); } } else { target_socket = searchbynick(target); if (target_socket) { str = type_str +" " + target_socket.nick +" :"+ send_str; target_socket.originatorout(str,this); if (target_socket.away && (type_str == "PRIVMSG") ) this.numeric(301, target_socket.nick + " :" + target_socket.away); } else { this.numeric401(target); return 0; } }}
this.numeric401(target); return 0;
if ((target[0] == "#") && (this.mode&USERMODE_OPER)) { return this.global(target,type_str,send_str); } else { this.numeric401(target); return 0; }
function IRCClient_do_msg(target,type_str,send_str) { if ((target[0] == "$") && (this.mode&USERMODE_OPER)) { var global_mask = target.slice(1); var global_str = type_str + " " + target + " :" + send_str; for(globClient in Clients) { var Client = Clients[globClient]; if ((Client.conntype == TYPE_USER) && match_irc_mask(Client.servername,global_mask) && Client.local) Client.originatorout(global_str,this); } global_str = ":" + this.nick + " " + global_str; if(this.parent) { var globServer = Clients[this.parent]; globServer.bcast_to_servers_raw(global_str); } else { server_bcast_to_servers(global_str); } return 1; } send_to_list = -1; if (target[0] == "@" && ( (target[1] == "#") || target[1] == "&") ) { send_to_list = CHANLIST_OP; target = target.slice(1); } else if (target[0]=="+" && ((target[1] == "#")|| target[1] == "&")) { send_to_list = CHANLIST_VOICE; target = target.slice(1); } if ((target[0] == "#") || (target[0] == "&")) { chan = searchbychannel(target); if (!chan) { this.numeric401(target); return 0; } if ( (chan.mode&CHANMODE_NOOUTSIDE) && !this.onchannel(chan.nam.toUpperCase())) { this.numeric(404, chan.nam + " :Cannot send to channel (+n: no outside messages)"); return 0; } if ( (chan.mode&CHANMODE_MODERATED) && !chan.ismode(this.id,CHANLIST_VOICE) && !chan.ismode(this.id,CHANLIST_OP) ) { this.numeric(404, chan.nam + " :Cannot send to channel (+m: moderated)"); return 0; } if (chan.isbanned(this.ircnuh) && !chan.ismode(this.id,CHANLIST_VOICE) && !chan.ismode(this.id,CHANLIST_OP) ) { this.numeric(404, chan.nam + " :Cannot send to channel (+b: you're banned!)"); return 0; } if(send_to_list == -1) { str = type_str +" "+ chan.nam +" :"+ send_str; this.bcast_to_channel(chan.nam, str, false); this.bcast_to_channel_servers(chan.nam, str); } else { if (send_to_list == CHANLIST_OP) prefix_chr="@"; else if (send_to_list == CHANLIST_VOICE) prefix_chr="+"; str = type_str +" " + prefix_chr + chan.nam + " :"+ send_str; this.bcast_to_list(chan, str, false, send_to_list); this.bcast_to_channel_servers(chan.nam, str); } } else { target_socket = searchbynick(target); if (target_socket) { str = type_str +" " + target_socket.nick +" :"+ send_str; target_socket.originatorout(str,this); if (target_socket.away && (type_str == "PRIVMSG") ) this.numeric(301, target_socket.nick + " :" + target_socket.away); } else { this.numeric401(target); return 0; } }}
target_socket = searchbynick(target);
if (target.match("[@]")) { var msg_arg = target.split('@'); var real_target = msg_arg[0]; var target_server = searchbyserver(msg_arg[1]); if (!target_server) { this.numeric401(target); return 0; } target = msg_arg[0] + "@" + msg_arg[1]; } else { var real_target = target; } target_socket = searchbynick(real_target);
function IRCClient_do_msg(target,type_str,send_str) { if ((target[0] == "$") && (this.mode&USERMODE_OPER)) { var global_mask = target.slice(1); var global_str = type_str + " " + target + " :" + send_str; for(globClient in Clients) { var Client = Clients[globClient]; if ((Client.conntype == TYPE_USER) && match_irc_mask(Client.servername,global_mask) && Client.local) Client.originatorout(global_str,this); } global_str = ":" + this.nick + " " + global_str; if(this.parent) { var globServer = Clients[this.parent]; globServer.bcast_to_servers_raw(global_str); } else { server_bcast_to_servers(global_str); } return 1; } send_to_list = -1; if (target[0] == "@" && ( (target[1] == "#") || target[1] == "&") ) { send_to_list = CHANLIST_OP; target = target.slice(1); } else if (target[0]=="+" && ((target[1] == "#")|| target[1] == "&")) { send_to_list = CHANLIST_VOICE; target = target.slice(1); } if ((target[0] == "#") || (target[0] == "&")) { chan = searchbychannel(target); if (!chan) { this.numeric401(target); return 0; } if ( (chan.mode&CHANMODE_NOOUTSIDE) && !this.onchannel(chan.nam.toUpperCase())) { this.numeric(404, chan.nam + " :Cannot send to channel (+n: no outside messages)"); return 0; } if ( (chan.mode&CHANMODE_MODERATED) && !chan.ismode(this.id,CHANLIST_VOICE) && !chan.ismode(this.id,CHANLIST_OP) ) { this.numeric(404, chan.nam + " :Cannot send to channel (+m: moderated)"); return 0; } if (chan.isbanned(this.ircnuh) && !chan.ismode(this.id,CHANLIST_VOICE) && !chan.ismode(this.id,CHANLIST_OP) ) { this.numeric(404, chan.nam + " :Cannot send to channel (+b: you're banned!)"); return 0; } if(send_to_list == -1) { str = type_str +" "+ chan.nam +" :"+ send_str; this.bcast_to_channel(chan.nam, str, false); this.bcast_to_channel_servers(chan.nam, str); } else { if (send_to_list == CHANLIST_OP) prefix_chr="@"; else if (send_to_list == CHANLIST_VOICE) prefix_chr="+"; str = type_str +" " + prefix_chr + chan.nam + " :"+ send_str; this.bcast_to_list(chan, str, false, send_to_list); this.bcast_to_channel_servers(chan.nam, str); } } else { target_socket = searchbynick(target); if (target_socket) { str = type_str +" " + target_socket.nick +" :"+ send_str; target_socket.originatorout(str,this); if (target_socket.away && (type_str == "PRIVMSG") ) this.numeric(301, target_socket.nick + " :" + target_socket.away); } else { this.numeric401(target); return 0; } }}
str = type_str +" " + target_socket.nick +" :"+ send_str;
if (!(target_server && (target_server.nick.toUpperCase() == target_socket.servername.toUpperCase()) ) ) { this.numeric401(target); return 0; } str = type_str + " " + target + " :" + send_str;
function IRCClient_do_msg(target,type_str,send_str) { if ((target[0] == "$") && (this.mode&USERMODE_OPER)) { var global_mask = target.slice(1); var global_str = type_str + " " + target + " :" + send_str; for(globClient in Clients) { var Client = Clients[globClient]; if ((Client.conntype == TYPE_USER) && match_irc_mask(Client.servername,global_mask) && Client.local) Client.originatorout(global_str,this); } global_str = ":" + this.nick + " " + global_str; if(this.parent) { var globServer = Clients[this.parent]; globServer.bcast_to_servers_raw(global_str); } else { server_bcast_to_servers(global_str); } return 1; } send_to_list = -1; if (target[0] == "@" && ( (target[1] == "#") || target[1] == "&") ) { send_to_list = CHANLIST_OP; target = target.slice(1); } else if (target[0]=="+" && ((target[1] == "#")|| target[1] == "&")) { send_to_list = CHANLIST_VOICE; target = target.slice(1); } if ((target[0] == "#") || (target[0] == "&")) { chan = searchbychannel(target); if (!chan) { this.numeric401(target); return 0; } if ( (chan.mode&CHANMODE_NOOUTSIDE) && !this.onchannel(chan.nam.toUpperCase())) { this.numeric(404, chan.nam + " :Cannot send to channel (+n: no outside messages)"); return 0; } if ( (chan.mode&CHANMODE_MODERATED) && !chan.ismode(this.id,CHANLIST_VOICE) && !chan.ismode(this.id,CHANLIST_OP) ) { this.numeric(404, chan.nam + " :Cannot send to channel (+m: moderated)"); return 0; } if (chan.isbanned(this.ircnuh) && !chan.ismode(this.id,CHANLIST_VOICE) && !chan.ismode(this.id,CHANLIST_OP) ) { this.numeric(404, chan.nam + " :Cannot send to channel (+b: you're banned!)"); return 0; } if(send_to_list == -1) { str = type_str +" "+ chan.nam +" :"+ send_str; this.bcast_to_channel(chan.nam, str, false); this.bcast_to_channel_servers(chan.nam, str); } else { if (send_to_list == CHANLIST_OP) prefix_chr="@"; else if (send_to_list == CHANLIST_VOICE) prefix_chr="+"; str = type_str +" " + prefix_chr + chan.nam + " :"+ send_str; this.bcast_to_list(chan, str, false, send_to_list); this.bcast_to_channel_servers(chan.nam, str); } } else { target_socket = searchbynick(target); if (target_socket) { str = type_str +" " + target_socket.nick +" :"+ send_str; target_socket.originatorout(str,this); if (target_socket.away && (type_str == "PRIVMSG") ) this.numeric(301, target_socket.nick + " :" + target_socket.away); } else { this.numeric401(target); return 0; } }}
if (target_socket.away && (type_str == "PRIVMSG") )
if (target_socket.away && (type_str == "PRIVMSG") && !this.server)
function IRCClient_do_msg(target,type_str,send_str) { if ((target[0] == "$") && (this.mode&USERMODE_OPER)) { var global_mask = target.slice(1); var global_str = type_str + " " + target + " :" + send_str; for(globClient in Clients) { var Client = Clients[globClient]; if ((Client.conntype == TYPE_USER) && match_irc_mask(Client.servername,global_mask) && Client.local) Client.originatorout(global_str,this); } global_str = ":" + this.nick + " " + global_str; if(this.parent) { var globServer = Clients[this.parent]; globServer.bcast_to_servers_raw(global_str); } else { server_bcast_to_servers(global_str); } return 1; } send_to_list = -1; if (target[0] == "@" && ( (target[1] == "#") || target[1] == "&") ) { send_to_list = CHANLIST_OP; target = target.slice(1); } else if (target[0]=="+" && ((target[1] == "#")|| target[1] == "&")) { send_to_list = CHANLIST_VOICE; target = target.slice(1); } if ((target[0] == "#") || (target[0] == "&")) { chan = searchbychannel(target); if (!chan) { this.numeric401(target); return 0; } if ( (chan.mode&CHANMODE_NOOUTSIDE) && !this.onchannel(chan.nam.toUpperCase())) { this.numeric(404, chan.nam + " :Cannot send to channel (+n: no outside messages)"); return 0; } if ( (chan.mode&CHANMODE_MODERATED) && !chan.ismode(this.id,CHANLIST_VOICE) && !chan.ismode(this.id,CHANLIST_OP) ) { this.numeric(404, chan.nam + " :Cannot send to channel (+m: moderated)"); return 0; } if (chan.isbanned(this.ircnuh) && !chan.ismode(this.id,CHANLIST_VOICE) && !chan.ismode(this.id,CHANLIST_OP) ) { this.numeric(404, chan.nam + " :Cannot send to channel (+b: you're banned!)"); return 0; } if(send_to_list == -1) { str = type_str +" "+ chan.nam +" :"+ send_str; this.bcast_to_channel(chan.nam, str, false); this.bcast_to_channel_servers(chan.nam, str); } else { if (send_to_list == CHANLIST_OP) prefix_chr="@"; else if (send_to_list == CHANLIST_VOICE) prefix_chr="+"; str = type_str +" " + prefix_chr + chan.nam + " :"+ send_str; this.bcast_to_list(chan, str, false, send_to_list); this.bcast_to_channel_servers(chan.nam, str); } } else { target_socket = searchbynick(target); if (target_socket) { str = type_str +" " + target_socket.nick +" :"+ send_str; target_socket.originatorout(str,this); if (target_socket.away && (type_str == "PRIVMSG") ) this.numeric(301, target_socket.nick + " :" + target_socket.away); } else { this.numeric401(target); return 0; } }}
return 1;
function IRCClient_do_msg(target,type_str,send_str) { if ((target[0] == "$") && (this.mode&USERMODE_OPER)) { var global_mask = target.slice(1); var global_str = type_str + " " + target + " :" + send_str; for(globClient in Clients) { var Client = Clients[globClient]; if ((Client.conntype == TYPE_USER) && match_irc_mask(Client.servername,global_mask) && Client.local) Client.originatorout(global_str,this); } global_str = ":" + this.nick + " " + global_str; if(this.parent) { var globServer = Clients[this.parent]; globServer.bcast_to_servers_raw(global_str); } else { server_bcast_to_servers(global_str); } return 1; } send_to_list = -1; if (target[0] == "@" && ( (target[1] == "#") || target[1] == "&") ) { send_to_list = CHANLIST_OP; target = target.slice(1); } else if (target[0]=="+" && ((target[1] == "#")|| target[1] == "&")) { send_to_list = CHANLIST_VOICE; target = target.slice(1); } if ((target[0] == "#") || (target[0] == "&")) { chan = searchbychannel(target); if (!chan) { this.numeric401(target); return 0; } if ( (chan.mode&CHANMODE_NOOUTSIDE) && !this.onchannel(chan.nam.toUpperCase())) { this.numeric(404, chan.nam + " :Cannot send to channel (+n: no outside messages)"); return 0; } if ( (chan.mode&CHANMODE_MODERATED) && !chan.ismode(this.id,CHANLIST_VOICE) && !chan.ismode(this.id,CHANLIST_OP) ) { this.numeric(404, chan.nam + " :Cannot send to channel (+m: moderated)"); return 0; } if (chan.isbanned(this.ircnuh) && !chan.ismode(this.id,CHANLIST_VOICE) && !chan.ismode(this.id,CHANLIST_OP) ) { this.numeric(404, chan.nam + " :Cannot send to channel (+b: you're banned!)"); return 0; } if(send_to_list == -1) { str = type_str +" "+ chan.nam +" :"+ send_str; this.bcast_to_channel(chan.nam, str, false); this.bcast_to_channel_servers(chan.nam, str); } else { if (send_to_list == CHANLIST_OP) prefix_chr="@"; else if (send_to_list == CHANLIST_VOICE) prefix_chr="+"; str = type_str +" " + prefix_chr + chan.nam + " :"+ send_str; this.bcast_to_list(chan, str, false, send_to_list); this.bcast_to_channel_servers(chan.nam, str); } } else { target_socket = searchbynick(target); if (target_socket) { str = type_str +" " + target_socket.nick +" :"+ send_str; target_socket.originatorout(str,this); if (target_socket.away && (type_str == "PRIVMSG") ) this.numeric(301, target_socket.nick + " :" + target_socket.away); } else { this.numeric401(target); return 0; } }}
if (target.match("[@]+")) {
if (target.match("[@]")) {
function IRCClient_do_msg(target,type_str,send_str) { if ((target[0] == "$") && (this.mode&USERMODE_OPER)) return this.global(target,type_str,send_str); send_to_list = -1; if (target[0] == "@" && ( (target[1] == "#") || target[1] == "&") ) { send_to_list = CHANLIST_OP; target = target.slice(1); } else if (target[0]=="+" && ((target[1] == "#")|| target[1] == "&")) { send_to_list = CHANLIST_VOICE; target = target.slice(1); } if ((target[0] == "#") || (target[0] == "&")) { chan = searchbychannel(target); if (!chan) { // check to see if it's a #*hostmask* oper message if ((target[0] == "#") && (this.mode&USERMODE_OPER)) { return this.global(target,type_str,send_str); } else { this.numeric401(target); return 0; } } if ( (chan.mode&CHANMODE_NOOUTSIDE) && !this.onchannel(chan.nam.toUpperCase())) { this.numeric(404, chan.nam + " :Cannot send to channel (+n: no outside messages)"); return 0; } if ( (chan.mode&CHANMODE_MODERATED) && !chan.ismode(this.id,CHANLIST_VOICE) && !chan.ismode(this.id,CHANLIST_OP) ) { this.numeric(404, chan.nam + " :Cannot send to channel (+m: moderated)"); return 0; } if (chan.isbanned(this.ircnuh) && !chan.ismode(this.id,CHANLIST_VOICE) && !chan.ismode(this.id,CHANLIST_OP) ) { this.numeric(404, chan.nam + " :Cannot send to channel (+b: you're banned!)"); return 0; } if(send_to_list == -1) { str = type_str +" "+ chan.nam +" :"+ send_str; this.bcast_to_channel(chan.nam, str, false); this.bcast_to_channel_servers(chan.nam, str); } else { if (send_to_list == CHANLIST_OP) prefix_chr="@"; else if (send_to_list == CHANLIST_VOICE) prefix_chr="+"; str = type_str +" " + prefix_chr + chan.nam + " :"+ send_str; this.bcast_to_list(chan, str, false, send_to_list); this.bcast_to_channel_servers(chan.nam, str); } } else { if (target.match("[@]+")) { var msg_arg = target.split('@'); var real_target = msg_arg[0]; var target_server = searchbyserver(msg_arg[1]); if (!target_server) { this.numeric401(target); return 0; } if (target_server == -1) { this.numeric(407, target + " :Duplicate recipients, no message delivered."); return 0; } target = msg_arg[0] + "@" + msg_arg[1]; } else { var real_target = target; } target_socket = searchbynick(real_target); if (target_socket) { if (target_server && (target_server.parent != target_socket.parent)) { this.numeric401(target); return 0; } if (target_server && (target_server.id == target_socket.parent) ) target = real_target; str = type_str + " " + target + " :" + send_str; target_socket.originatorout(str,this); if (target_socket.away && (type_str == "PRIVMSG") && !this.server) this.numeric(301, target_socket.nick + " :" + target_socket.away); } else { this.numeric401(target); return 0; } } return 1;}
send_to_list = CHANLIST_OP;
send_to_list = CHANMODE_OP;
function IRCClient_do_msg(target,type_str,send_str) { if ((target[0] == "$") && (this.mode&USERMODE_OPER)) return this.global(target,type_str,send_str); send_to_list = -1; if (target[0] == "@" && ( (target[1] == "#") || target[1] == "&") ) { send_to_list = CHANLIST_OP; target = target.slice(1); } else if (target[0]=="+" && ((target[1] == "#")|| target[1] == "&")) { send_to_list = CHANLIST_VOICE; target = target.slice(1); } if ((target[0] == "#") || (target[0] == "&")) { chan = searchbychannel(target); if (!chan) { // check to see if it's a #*hostmask* oper message if ((target[0] == "#") && (this.mode&USERMODE_OPER)) { return this.global(target,type_str,send_str); } else { this.numeric401(target); return 0; } } if ( (chan.mode&CHANMODE_NOOUTSIDE) && !this.onchannel(chan.nam.toUpperCase())) { this.numeric(404, chan.nam + " :Cannot send to channel (+n: no outside messages)"); return 0; } if ( (chan.mode&CHANMODE_MODERATED) && !chan.ismode(this.id,CHANLIST_VOICE) && !chan.ismode(this.id,CHANLIST_OP) ) { this.numeric(404, chan.nam + " :Cannot send to channel (+m: moderated)"); return 0; } if (chan.isbanned(this.ircnuh) && !chan.ismode(this.id,CHANLIST_VOICE) && !chan.ismode(this.id,CHANLIST_OP) ) { this.numeric(404, chan.nam + " :Cannot send to channel (+b: you're banned!)"); return 0; } if(send_to_list == -1) { str = type_str +" "+ chan.nam +" :"+ send_str; this.bcast_to_channel(chan.nam, str, false); this.bcast_to_channel_servers(chan.nam, str); } else { if (send_to_list == CHANLIST_OP) prefix_chr="@"; else if (send_to_list == CHANLIST_VOICE) prefix_chr="+"; str = type_str +" " + prefix_chr + chan.nam + " :"+ send_str; this.bcast_to_list(chan, str, false, send_to_list); this.bcast_to_channel_servers(chan.nam, str); } } else { if (target.match("[@]")) { var msg_arg = target.split('@'); var real_target = msg_arg[0]; var target_server = searchbyserver(msg_arg[1]); if (!target_server) { this.numeric401(target); return 0; } if (target_server == -1) { this.numeric(407, target + " :Duplicate recipients, no message delivered."); return 0; } target = msg_arg[0] + "@" + msg_arg[1]; } else { var real_target = target; } target_socket = searchbynick(real_target); if (target_socket) { if (target_server && (target_server.parent != target_socket.parent)) { this.numeric401(target); return 0; } if (target_server && (target_server.id == target_socket.parent) ) target = real_target; str = type_str + " " + target + " :" + send_str; target_socket.originatorout(str,this); if (target_socket.away && (type_str == "PRIVMSG") && !this.server && this.local) this.numeric(301, target_socket.nick + " :" + target_socket.away); } else { this.numeric401(target); return 0; } } return 1;}
send_to_list = CHANLIST_VOICE;
send_to_list = CHANMODE_VOICE;
function IRCClient_do_msg(target,type_str,send_str) { if ((target[0] == "$") && (this.mode&USERMODE_OPER)) return this.global(target,type_str,send_str); send_to_list = -1; if (target[0] == "@" && ( (target[1] == "#") || target[1] == "&") ) { send_to_list = CHANLIST_OP; target = target.slice(1); } else if (target[0]=="+" && ((target[1] == "#")|| target[1] == "&")) { send_to_list = CHANLIST_VOICE; target = target.slice(1); } if ((target[0] == "#") || (target[0] == "&")) { chan = searchbychannel(target); if (!chan) { // check to see if it's a #*hostmask* oper message if ((target[0] == "#") && (this.mode&USERMODE_OPER)) { return this.global(target,type_str,send_str); } else { this.numeric401(target); return 0; } } if ( (chan.mode&CHANMODE_NOOUTSIDE) && !this.onchannel(chan.nam.toUpperCase())) { this.numeric(404, chan.nam + " :Cannot send to channel (+n: no outside messages)"); return 0; } if ( (chan.mode&CHANMODE_MODERATED) && !chan.ismode(this.id,CHANLIST_VOICE) && !chan.ismode(this.id,CHANLIST_OP) ) { this.numeric(404, chan.nam + " :Cannot send to channel (+m: moderated)"); return 0; } if (chan.isbanned(this.ircnuh) && !chan.ismode(this.id,CHANLIST_VOICE) && !chan.ismode(this.id,CHANLIST_OP) ) { this.numeric(404, chan.nam + " :Cannot send to channel (+b: you're banned!)"); return 0; } if(send_to_list == -1) { str = type_str +" "+ chan.nam +" :"+ send_str; this.bcast_to_channel(chan.nam, str, false); this.bcast_to_channel_servers(chan.nam, str); } else { if (send_to_list == CHANLIST_OP) prefix_chr="@"; else if (send_to_list == CHANLIST_VOICE) prefix_chr="+"; str = type_str +" " + prefix_chr + chan.nam + " :"+ send_str; this.bcast_to_list(chan, str, false, send_to_list); this.bcast_to_channel_servers(chan.nam, str); } } else { if (target.match("[@]")) { var msg_arg = target.split('@'); var real_target = msg_arg[0]; var target_server = searchbyserver(msg_arg[1]); if (!target_server) { this.numeric401(target); return 0; } if (target_server == -1) { this.numeric(407, target + " :Duplicate recipients, no message delivered."); return 0; } target = msg_arg[0] + "@" + msg_arg[1]; } else { var real_target = target; } target_socket = searchbynick(real_target); if (target_socket) { if (target_server && (target_server.parent != target_socket.parent)) { this.numeric401(target); return 0; } if (target_server && (target_server.id == target_socket.parent) ) target = real_target; str = type_str + " " + target + " :" + send_str; target_socket.originatorout(str,this); if (target_socket.away && (type_str == "PRIVMSG") && !this.server && this.local) this.numeric(301, target_socket.nick + " :" + target_socket.away); } else { this.numeric401(target); return 0; } } return 1;}
!chan.ismode(this.id,CHANLIST_VOICE) && !chan.ismode(this.id,CHANLIST_OP) ) {
!chan.ismode(this.id,CHANMODE_VOICE) && !chan.ismode(this.id,CHANMODE_OP) ) {
function IRCClient_do_msg(target,type_str,send_str) { if ((target[0] == "$") && (this.mode&USERMODE_OPER)) return this.global(target,type_str,send_str); send_to_list = -1; if (target[0] == "@" && ( (target[1] == "#") || target[1] == "&") ) { send_to_list = CHANLIST_OP; target = target.slice(1); } else if (target[0]=="+" && ((target[1] == "#")|| target[1] == "&")) { send_to_list = CHANLIST_VOICE; target = target.slice(1); } if ((target[0] == "#") || (target[0] == "&")) { chan = searchbychannel(target); if (!chan) { // check to see if it's a #*hostmask* oper message if ((target[0] == "#") && (this.mode&USERMODE_OPER)) { return this.global(target,type_str,send_str); } else { this.numeric401(target); return 0; } } if ( (chan.mode&CHANMODE_NOOUTSIDE) && !this.onchannel(chan.nam.toUpperCase())) { this.numeric(404, chan.nam + " :Cannot send to channel (+n: no outside messages)"); return 0; } if ( (chan.mode&CHANMODE_MODERATED) && !chan.ismode(this.id,CHANLIST_VOICE) && !chan.ismode(this.id,CHANLIST_OP) ) { this.numeric(404, chan.nam + " :Cannot send to channel (+m: moderated)"); return 0; } if (chan.isbanned(this.ircnuh) && !chan.ismode(this.id,CHANLIST_VOICE) && !chan.ismode(this.id,CHANLIST_OP) ) { this.numeric(404, chan.nam + " :Cannot send to channel (+b: you're banned!)"); return 0; } if(send_to_list == -1) { str = type_str +" "+ chan.nam +" :"+ send_str; this.bcast_to_channel(chan.nam, str, false); this.bcast_to_channel_servers(chan.nam, str); } else { if (send_to_list == CHANLIST_OP) prefix_chr="@"; else if (send_to_list == CHANLIST_VOICE) prefix_chr="+"; str = type_str +" " + prefix_chr + chan.nam + " :"+ send_str; this.bcast_to_list(chan, str, false, send_to_list); this.bcast_to_channel_servers(chan.nam, str); } } else { if (target.match("[@]")) { var msg_arg = target.split('@'); var real_target = msg_arg[0]; var target_server = searchbyserver(msg_arg[1]); if (!target_server) { this.numeric401(target); return 0; } if (target_server == -1) { this.numeric(407, target + " :Duplicate recipients, no message delivered."); return 0; } target = msg_arg[0] + "@" + msg_arg[1]; } else { var real_target = target; } target_socket = searchbynick(real_target); if (target_socket) { if (target_server && (target_server.parent != target_socket.parent)) { this.numeric401(target); return 0; } if (target_server && (target_server.id == target_socket.parent) ) target = real_target; str = type_str + " " + target + " :" + send_str; target_socket.originatorout(str,this); if (target_socket.away && (type_str == "PRIVMSG") && !this.server && this.local) this.numeric(301, target_socket.nick + " :" + target_socket.away); } else { this.numeric401(target); return 0; } } return 1;}
if (send_to_list == CHANLIST_OP)
if (send_to_list == CHANMODE_OP)
function IRCClient_do_msg(target,type_str,send_str) { if ((target[0] == "$") && (this.mode&USERMODE_OPER)) return this.global(target,type_str,send_str); send_to_list = -1; if (target[0] == "@" && ( (target[1] == "#") || target[1] == "&") ) { send_to_list = CHANLIST_OP; target = target.slice(1); } else if (target[0]=="+" && ((target[1] == "#")|| target[1] == "&")) { send_to_list = CHANLIST_VOICE; target = target.slice(1); } if ((target[0] == "#") || (target[0] == "&")) { chan = searchbychannel(target); if (!chan) { // check to see if it's a #*hostmask* oper message if ((target[0] == "#") && (this.mode&USERMODE_OPER)) { return this.global(target,type_str,send_str); } else { this.numeric401(target); return 0; } } if ( (chan.mode&CHANMODE_NOOUTSIDE) && !this.onchannel(chan.nam.toUpperCase())) { this.numeric(404, chan.nam + " :Cannot send to channel (+n: no outside messages)"); return 0; } if ( (chan.mode&CHANMODE_MODERATED) && !chan.ismode(this.id,CHANLIST_VOICE) && !chan.ismode(this.id,CHANLIST_OP) ) { this.numeric(404, chan.nam + " :Cannot send to channel (+m: moderated)"); return 0; } if (chan.isbanned(this.ircnuh) && !chan.ismode(this.id,CHANLIST_VOICE) && !chan.ismode(this.id,CHANLIST_OP) ) { this.numeric(404, chan.nam + " :Cannot send to channel (+b: you're banned!)"); return 0; } if(send_to_list == -1) { str = type_str +" "+ chan.nam +" :"+ send_str; this.bcast_to_channel(chan.nam, str, false); this.bcast_to_channel_servers(chan.nam, str); } else { if (send_to_list == CHANLIST_OP) prefix_chr="@"; else if (send_to_list == CHANLIST_VOICE) prefix_chr="+"; str = type_str +" " + prefix_chr + chan.nam + " :"+ send_str; this.bcast_to_list(chan, str, false, send_to_list); this.bcast_to_channel_servers(chan.nam, str); } } else { if (target.match("[@]")) { var msg_arg = target.split('@'); var real_target = msg_arg[0]; var target_server = searchbyserver(msg_arg[1]); if (!target_server) { this.numeric401(target); return 0; } if (target_server == -1) { this.numeric(407, target + " :Duplicate recipients, no message delivered."); return 0; } target = msg_arg[0] + "@" + msg_arg[1]; } else { var real_target = target; } target_socket = searchbynick(real_target); if (target_socket) { if (target_server && (target_server.parent != target_socket.parent)) { this.numeric401(target); return 0; } if (target_server && (target_server.id == target_socket.parent) ) target = real_target; str = type_str + " " + target + " :" + send_str; target_socket.originatorout(str,this); if (target_socket.away && (type_str == "PRIVMSG") && !this.server && this.local) this.numeric(301, target_socket.nick + " :" + target_socket.away); } else { this.numeric401(target); return 0; } } return 1;}
else if (send_to_list == CHANLIST_VOICE)
else if (send_to_list == CHANMODE_VOICE)
function IRCClient_do_msg(target,type_str,send_str) { if ((target[0] == "$") && (this.mode&USERMODE_OPER)) return this.global(target,type_str,send_str); send_to_list = -1; if (target[0] == "@" && ( (target[1] == "#") || target[1] == "&") ) { send_to_list = CHANLIST_OP; target = target.slice(1); } else if (target[0]=="+" && ((target[1] == "#")|| target[1] == "&")) { send_to_list = CHANLIST_VOICE; target = target.slice(1); } if ((target[0] == "#") || (target[0] == "&")) { chan = searchbychannel(target); if (!chan) { // check to see if it's a #*hostmask* oper message if ((target[0] == "#") && (this.mode&USERMODE_OPER)) { return this.global(target,type_str,send_str); } else { this.numeric401(target); return 0; } } if ( (chan.mode&CHANMODE_NOOUTSIDE) && !this.onchannel(chan.nam.toUpperCase())) { this.numeric(404, chan.nam + " :Cannot send to channel (+n: no outside messages)"); return 0; } if ( (chan.mode&CHANMODE_MODERATED) && !chan.ismode(this.id,CHANLIST_VOICE) && !chan.ismode(this.id,CHANLIST_OP) ) { this.numeric(404, chan.nam + " :Cannot send to channel (+m: moderated)"); return 0; } if (chan.isbanned(this.ircnuh) && !chan.ismode(this.id,CHANLIST_VOICE) && !chan.ismode(this.id,CHANLIST_OP) ) { this.numeric(404, chan.nam + " :Cannot send to channel (+b: you're banned!)"); return 0; } if(send_to_list == -1) { str = type_str +" "+ chan.nam +" :"+ send_str; this.bcast_to_channel(chan.nam, str, false); this.bcast_to_channel_servers(chan.nam, str); } else { if (send_to_list == CHANLIST_OP) prefix_chr="@"; else if (send_to_list == CHANLIST_VOICE) prefix_chr="+"; str = type_str +" " + prefix_chr + chan.nam + " :"+ send_str; this.bcast_to_list(chan, str, false, send_to_list); this.bcast_to_channel_servers(chan.nam, str); } } else { if (target.match("[@]")) { var msg_arg = target.split('@'); var real_target = msg_arg[0]; var target_server = searchbyserver(msg_arg[1]); if (!target_server) { this.numeric401(target); return 0; } if (target_server == -1) { this.numeric(407, target + " :Duplicate recipients, no message delivered."); return 0; } target = msg_arg[0] + "@" + msg_arg[1]; } else { var real_target = target; } target_socket = searchbynick(real_target); if (target_socket) { if (target_server && (target_server.parent != target_socket.parent)) { this.numeric401(target); return 0; } if (target_server && (target_server.id == target_socket.parent) ) target = real_target; str = type_str + " " + target + " :" + send_str; target_socket.originatorout(str,this); if (target_socket.away && (type_str == "PRIVMSG") && !this.server && this.local) this.numeric(301, target_socket.nick + " :" + target_socket.away); } else { this.numeric401(target); return 0; } } return 1;}
target_socket.local)
!this.server && target_socket.local)
function IRCClient_do_msg(target,type_str,send_str) { if ( (target[0] == "$") && (this.mode&USERMODE_OPER) && ( (this.flags&OLINE_CAN_LGNOTICE) || !this.local) ) return this.global(target,type_str,send_str); var send_to_list = -1; if (target[0] == "@" && ( (target[1] == "#") || target[1] == "&") ) { send_to_list = CHANMODE_OP; target = target.slice(1); } else if (target[0]=="+" && ((target[1] == "#")|| target[1] == "&")) { send_to_list = CHANMODE_VOICE; target = target.slice(1); } if ((target[0] == "#") || (target[0] == "&")) { var chan = Channels[target.toUpperCase()]; if (!chan) { // check to see if it's a #*hostmask* oper message if ( (target[0] == "#") && (this.mode&USERMODE_OPER) && ( (this.flags&OLINE_CAN_LGNOTICE) || !this.local ) ) { return this.global(target,type_str,send_str); } else { this.numeric401(target); return 0; } } if ((chan.mode&CHANMODE_NOOUTSIDE) && !this.channels[chan.nam.toUpperCase()]) { this.numeric(404, chan.nam + " :Cannot send to channel (+n: no outside messages)"); return 0; } if ( (chan.mode&CHANMODE_MODERATED) && !chan.modelist[CHANMODE_VOICE][this.id] && !chan.modelist[CHANMODE_OP][this.id] ) { this.numeric(404, chan.nam + " :Cannot send to channel (+m: moderated)"); return 0; } if (chan.isbanned(this.nuh) && !chan.modelist[CHANMODE_VOICE][this.id] && !chan.modelist[CHANMODE_OP][this.id] ) { this.numeric(404, chan.nam + " :Cannot send to channel (+b: you're banned!)"); return 0; } if(send_to_list == -1) { var str = type_str +" "+ chan.nam +" :"+ send_str; this.bcast_to_channel(chan, str, false); this.bcast_to_channel_servers(chan, str); } else { var prefix_chr; if (send_to_list == CHANMODE_OP) prefix_chr="@"; else if (send_to_list == CHANMODE_VOICE) prefix_chr="+"; var str = type_str +" " + prefix_chr + chan.nam + " :"+ send_str; this.bcast_to_list(chan, str, false, send_to_list); this.bcast_to_channel_servers(chan, str); } } else { if (target.match("[@]")) { var msg_arg = target.split('@'); var real_target = msg_arg[0]; var target_server = searchbyserver(msg_arg[1]); if (!target_server) { this.numeric401(target); return 0; } if (target_server == -1) { this.numeric(407, target + " :Duplicate recipients, no message delivered."); return 0; } target = msg_arg[0] + "@" + msg_arg[1]; } else { var real_target = target; } var target_socket = Users[real_target.toUpperCase()]; if (target_socket) { if (target_server && (target_server.parent != target_socket.parent)) { this.numeric401(target); return 0; } if (target_server && (target_server.id == target_socket.parent) ) target = real_target; var str = type_str + " " + target + " :" + send_str; target_socket.originatorout(str,this); if (target_socket.away && (type_str == "PRIVMSG") && target_socket.local) this.numeric(301, target_socket.nick + " :" + target_socket.away); } else { this.numeric401(target); return 0; } } return 1;}
if (target.match("[@]")) {
if (target.match("[@]+")) {
function IRCClient_do_msg(target,type_str,send_str) { if ((target[0] == "$") && (this.mode&USERMODE_OPER)) return this.global(target,type_str,send_str); send_to_list = -1; if (target[0] == "@" && ( (target[1] == "#") || target[1] == "&") ) { send_to_list = CHANLIST_OP; target = target.slice(1); } else if (target[0]=="+" && ((target[1] == "#")|| target[1] == "&")) { send_to_list = CHANLIST_VOICE; target = target.slice(1); } if ((target[0] == "#") || (target[0] == "&")) { chan = searchbychannel(target); if (!chan) { // check to see if it's a #*hostmask* oper message if ((target[0] == "#") && (this.mode&USERMODE_OPER)) { return this.global(target,type_str,send_str); } else { this.numeric401(target); return 0; } } if ( (chan.mode&CHANMODE_NOOUTSIDE) && !this.onchannel(chan.nam.toUpperCase())) { this.numeric(404, chan.nam + " :Cannot send to channel (+n: no outside messages)"); return 0; } if ( (chan.mode&CHANMODE_MODERATED) && !chan.ismode(this.id,CHANLIST_VOICE) && !chan.ismode(this.id,CHANLIST_OP) ) { this.numeric(404, chan.nam + " :Cannot send to channel (+m: moderated)"); return 0; } if (chan.isbanned(this.ircnuh) && !chan.ismode(this.id,CHANLIST_VOICE) && !chan.ismode(this.id,CHANLIST_OP) ) { this.numeric(404, chan.nam + " :Cannot send to channel (+b: you're banned!)"); return 0; } if(send_to_list == -1) { str = type_str +" "+ chan.nam +" :"+ send_str; this.bcast_to_channel(chan.nam, str, false); this.bcast_to_channel_servers(chan.nam, str); } else { if (send_to_list == CHANLIST_OP) prefix_chr="@"; else if (send_to_list == CHANLIST_VOICE) prefix_chr="+"; str = type_str +" " + prefix_chr + chan.nam + " :"+ send_str; this.bcast_to_list(chan, str, false, send_to_list); this.bcast_to_channel_servers(chan.nam, str); } } else { if (target.match("[@]")) { var msg_arg = target.split('@'); var real_target = msg_arg[0]; var target_server = searchbyserver(msg_arg[1]); if (!target_server) { this.numeric401(target); return 0; } target = msg_arg[0] + "@" + msg_arg[1]; } else { var real_target = target; } target_socket = searchbynick(real_target); if (target_socket) { if (!(target_server && (target_server.nick.toUpperCase() == target_socket.servername.toUpperCase()) ) ) { this.numeric401(target); return 0; } str = type_str + " " + target + " :" + send_str; target_socket.originatorout(str,this); if (target_socket.away && (type_str == "PRIVMSG") && !this.server) this.numeric(301, target_socket.nick + " :" + target_socket.away); } else { this.numeric401(target); return 0; } } return 1;}
if (!(target_server && (target_server.nick.toUpperCase() == target_socket.servername.toUpperCase()) ) ) {
if (target_server && (target_server.parent != target_socket.parent)) {
function IRCClient_do_msg(target,type_str,send_str) { if ((target[0] == "$") && (this.mode&USERMODE_OPER)) return this.global(target,type_str,send_str); send_to_list = -1; if (target[0] == "@" && ( (target[1] == "#") || target[1] == "&") ) { send_to_list = CHANLIST_OP; target = target.slice(1); } else if (target[0]=="+" && ((target[1] == "#")|| target[1] == "&")) { send_to_list = CHANLIST_VOICE; target = target.slice(1); } if ((target[0] == "#") || (target[0] == "&")) { chan = searchbychannel(target); if (!chan) { // check to see if it's a #*hostmask* oper message if ((target[0] == "#") && (this.mode&USERMODE_OPER)) { return this.global(target,type_str,send_str); } else { this.numeric401(target); return 0; } } if ( (chan.mode&CHANMODE_NOOUTSIDE) && !this.onchannel(chan.nam.toUpperCase())) { this.numeric(404, chan.nam + " :Cannot send to channel (+n: no outside messages)"); return 0; } if ( (chan.mode&CHANMODE_MODERATED) && !chan.ismode(this.id,CHANLIST_VOICE) && !chan.ismode(this.id,CHANLIST_OP) ) { this.numeric(404, chan.nam + " :Cannot send to channel (+m: moderated)"); return 0; } if (chan.isbanned(this.ircnuh) && !chan.ismode(this.id,CHANLIST_VOICE) && !chan.ismode(this.id,CHANLIST_OP) ) { this.numeric(404, chan.nam + " :Cannot send to channel (+b: you're banned!)"); return 0; } if(send_to_list == -1) { str = type_str +" "+ chan.nam +" :"+ send_str; this.bcast_to_channel(chan.nam, str, false); this.bcast_to_channel_servers(chan.nam, str); } else { if (send_to_list == CHANLIST_OP) prefix_chr="@"; else if (send_to_list == CHANLIST_VOICE) prefix_chr="+"; str = type_str +" " + prefix_chr + chan.nam + " :"+ send_str; this.bcast_to_list(chan, str, false, send_to_list); this.bcast_to_channel_servers(chan.nam, str); } } else { if (target.match("[@]")) { var msg_arg = target.split('@'); var real_target = msg_arg[0]; var target_server = searchbyserver(msg_arg[1]); if (!target_server) { this.numeric401(target); return 0; } target = msg_arg[0] + "@" + msg_arg[1]; } else { var real_target = target; } target_socket = searchbynick(real_target); if (target_socket) { if (!(target_server && (target_server.nick.toUpperCase() == target_socket.servername.toUpperCase()) ) ) { this.numeric401(target); return 0; } str = type_str + " " + target + " :" + send_str; target_socket.originatorout(str,this); if (target_socket.away && (type_str == "PRIVMSG") && !this.server) this.numeric(301, target_socket.nick + " :" + target_socket.away); } else { this.numeric401(target); return 0; } } return 1;}
if (target_server && (target_server.id == target_socket.parent) ) target = real_target;
function IRCClient_do_msg(target,type_str,send_str) { if ((target[0] == "$") && (this.mode&USERMODE_OPER)) return this.global(target,type_str,send_str); send_to_list = -1; if (target[0] == "@" && ( (target[1] == "#") || target[1] == "&") ) { send_to_list = CHANLIST_OP; target = target.slice(1); } else if (target[0]=="+" && ((target[1] == "#")|| target[1] == "&")) { send_to_list = CHANLIST_VOICE; target = target.slice(1); } if ((target[0] == "#") || (target[0] == "&")) { chan = searchbychannel(target); if (!chan) { // check to see if it's a #*hostmask* oper message if ((target[0] == "#") && (this.mode&USERMODE_OPER)) { return this.global(target,type_str,send_str); } else { this.numeric401(target); return 0; } } if ( (chan.mode&CHANMODE_NOOUTSIDE) && !this.onchannel(chan.nam.toUpperCase())) { this.numeric(404, chan.nam + " :Cannot send to channel (+n: no outside messages)"); return 0; } if ( (chan.mode&CHANMODE_MODERATED) && !chan.ismode(this.id,CHANLIST_VOICE) && !chan.ismode(this.id,CHANLIST_OP) ) { this.numeric(404, chan.nam + " :Cannot send to channel (+m: moderated)"); return 0; } if (chan.isbanned(this.ircnuh) && !chan.ismode(this.id,CHANLIST_VOICE) && !chan.ismode(this.id,CHANLIST_OP) ) { this.numeric(404, chan.nam + " :Cannot send to channel (+b: you're banned!)"); return 0; } if(send_to_list == -1) { str = type_str +" "+ chan.nam +" :"+ send_str; this.bcast_to_channel(chan.nam, str, false); this.bcast_to_channel_servers(chan.nam, str); } else { if (send_to_list == CHANLIST_OP) prefix_chr="@"; else if (send_to_list == CHANLIST_VOICE) prefix_chr="+"; str = type_str +" " + prefix_chr + chan.nam + " :"+ send_str; this.bcast_to_list(chan, str, false, send_to_list); this.bcast_to_channel_servers(chan.nam, str); } } else { if (target.match("[@]")) { var msg_arg = target.split('@'); var real_target = msg_arg[0]; var target_server = searchbyserver(msg_arg[1]); if (!target_server) { this.numeric401(target); return 0; } target = msg_arg[0] + "@" + msg_arg[1]; } else { var real_target = target; } target_socket = searchbynick(real_target); if (target_socket) { if (!(target_server && (target_server.nick.toUpperCase() == target_socket.servername.toUpperCase()) ) ) { this.numeric401(target); return 0; } str = type_str + " " + target + " :" + send_str; target_socket.originatorout(str,this); if (target_socket.away && (type_str == "PRIVMSG") && !this.server) this.numeric(301, target_socket.nick + " :" + target_socket.away); } else { this.numeric401(target); return 0; } } return 1;}