X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fcommands.cpp;h=00f44c74a4c7e251b99cd3a352e610d9848be8c1;hb=59b1a8955142935b02af6446005ab47fc7c3fc8c;hp=599ccdb8079284a3ae9abb105f01592561c8a3be;hpb=d2a9c07bd45ab0c97b49364faf80588ff5558f8f;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/commands.cpp b/src/commands.cpp index 599ccdb80..00f44c74a 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -2,7 +2,7 @@ * | Inspire Internet Relay Chat Daemon | * +------------------------------------+ * - * Inspire is copyright (C) 2002-2004 ChatSpike-Dev. + * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev. * E-mail: * * @@ -87,14 +87,8 @@ extern std::vector local_users; // This table references users by file descriptor. // its an array to make it VERY fast, as all lookups are referenced // by an integer, meaning there is no need for a scan/search operation. -extern userrec* fd_ref_table[65536]; +extern userrec* fd_ref_table[MAX_DESCRIPTORS]; -char* CleanFilename(char* name) -{ - char* p = name + strlen(name); - while ((p != name) && (*p != '/')) p--; - return (p != name ? ++p : p); -} void split_chlist(userrec* user, userrec* dest, std::string &cl) { @@ -117,15 +111,16 @@ void split_chlist(userrec* user, userrec* dest, std::string &cl) } } +/* XXX - perhaps this should be in cmd_whois? -- w00t */ void do_whois(userrec* user, userrec* dest,unsigned long signon, unsigned long idle, char* nick) { // bug found by phidjit - were able to whois an incomplete connection if it had sent a NICK or USER if (dest->registered == 7) { WriteServ(user->fd,"311 %s %s %s %s * :%s",user->nick, dest->nick, dest->ident, dest->dhost, dest->fullname); - if ((user == dest) || (strchr(user->modes,'o'))) + if ((user == dest) || (*user->oper)) { - WriteServ(user->fd,"378 %s %s :is connecting from *@%s %s",user->nick, dest->nick, dest->host, dest->ip); + WriteServ(user->fd,"378 %s %s :is connecting from *@%s %s",user->nick, dest->nick, dest->host, (char*)inet_ntoa(dest->ip4)); } std::string cl = chlist(dest,user); if (cl.length()) @@ -139,21 +134,21 @@ void do_whois(userrec* user, userrec* dest,unsigned long signon, unsigned long i WriteServ(user->fd,"319 %s %s :%s",user->nick, dest->nick, cl.c_str()); } } - WriteServ(user->fd,"312 %s %s %s :%s",user->nick, dest->nick, dest->server, GetServerDescription(dest->server).c_str()); + if (*Config->HideWhoisServer) + { + WriteServ(user->fd,"312 %s %s %s :%s",user->nick, dest->nick, *user->oper ? dest->server : Config->HideWhoisServer, *user->oper ? GetServerDescription(dest->server).c_str() : Config->Network); + } + else + { + WriteServ(user->fd,"312 %s %s %s :%s",user->nick, dest->nick, dest->server, GetServerDescription(dest->server).c_str()); + } if (*dest->awaymsg) { WriteServ(user->fd,"301 %s %s :%s",user->nick, dest->nick, dest->awaymsg); } - if (strchr(dest->modes,'o')) + if (*dest->oper) { - if (*dest->oper) - { - WriteServ(user->fd,"313 %s %s :is %s %s on %s",user->nick, dest->nick, (strchr("aeiou",dest->oper[0]) ? "an" : "a"),dest->oper, Config->Network); - } - else - { - WriteServ(user->fd,"313 %s %s :is opered but has an unknown type",user->nick, dest->nick); - } + WriteServ(user->fd,"313 %s %s :is %s %s on %s",user->nick, dest->nick, (strchr("aeiou",*dest->oper) ? "an" : "a"),dest->oper, Config->Network); } if ((!signon) && (!idle)) { @@ -178,6 +173,8 @@ void do_whois(userrec* user, userrec* dest,unsigned long signon, unsigned long i } } + +/* XXX - these really belong in helperfuncs perhaps -- w00t */ bool is_uline(const char* server) { char ServName[MAXBUF]; @@ -315,7 +312,7 @@ bool ip_matches_everyone(std::string ip, userrec* user) long matches = 0; for (user_hash::iterator u = clientlist.begin(); u != clientlist.end(); u++) { - if (match(u->second->ip,ip.c_str())) + if (match((char*)inet_ntoa(u->second->ip4),ip.c_str())) matches++; } float percent = ((float)matches / (float)clientlist.size()) * 100;