X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fcommands%2Fcmd_who.cpp;h=718eb20020b3078e6d0f24d1b214ffe99493d547;hb=7b6eae36661bc798f69b22393b85a4f06d533cf6;hp=1ce4e4c287abb093eb5e4e36f64c6fcfea8792ab;hpb=56f500b2c916d8801daaa631cd9215263bb3de23;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/commands/cmd_who.cpp b/src/commands/cmd_who.cpp index 1ce4e4c28..718eb2002 100644 --- a/src/commands/cmd_who.cpp +++ b/src/commands/cmd_who.cpp @@ -2,8 +2,8 @@ * | Inspire Internet Relay Chat Daemon | * +------------------------------------+ * - * InspIRCd: (C) 2002-2008 InspIRCd Development Team - * See: http://www.inspircd.org/wiki/index.php/Credits + * InspIRCd: (C) 2002-2009 InspIRCd Development Team + * See: http://wiki.inspircd.org/Credits * * This program is free but copyrighted software; see * the file COPYING for details. @@ -71,11 +71,11 @@ bool CommandWho::whomatch(User* user, const char* matchtext) if (opt_metadata) match = user->GetExt(matchtext, dummy); else if (opt_realname) - match = InspIRCd::Match(user->fullname, matchtext, lowermap); + match = InspIRCd::Match(user->fullname, matchtext); else if (opt_showrealhost) - match = InspIRCd::Match(user->host, matchtext, lowermap); + match = InspIRCd::Match(user->host, matchtext, ascii_case_insensitive_map); else if (opt_ident) - match = InspIRCd::Match(user->ident, matchtext, lowermap); + match = InspIRCd::Match(user->ident, matchtext, ascii_case_insensitive_map); else if (opt_port) { irc::portparser portrange(matchtext, false); @@ -88,7 +88,7 @@ bool CommandWho::whomatch(User* user, const char* matchtext) } } else if (opt_away) - match = InspIRCd::Match(user->awaymsg, matchtext, lowermap); + match = InspIRCd::Match(user->awaymsg, matchtext); else if (opt_time) { long seconds = ServerInstance->Duration(matchtext); @@ -106,13 +106,13 @@ bool CommandWho::whomatch(User* user, const char* matchtext) * -- w00t */ if (!match) - match = InspIRCd::Match(user->dhost, matchtext, lowermap); + match = InspIRCd::Match(user->dhost, matchtext, ascii_case_insensitive_map); if (!match) - match = InspIRCd::Match(user->nick, matchtext, lowermap); + match = InspIRCd::Match(user->nick, matchtext); if (!match) - match = InspIRCd::Match(user->server, matchtext, lowermap); + match = InspIRCd::Match(user->server, matchtext); return match; } @@ -136,7 +136,7 @@ bool CommandWho::CanView(Channel* chan, User* user) if (chan->HasUser(user)) return true; /* Opers see all */ - if (IS_OPER(user)) + if (user->HasPrivPermission("users/auspex")) return true; /* Cant see inside a +s or a +p channel unless we are a member (see above) */ else if (!chan->IsModeSet('s') && !chan->IsModeSet('p')) @@ -155,7 +155,7 @@ void CommandWho::SendWhoLine(User* user, const std::string &initial, Channel* ch Channel* chlast = ServerInstance->FindChan(lcn); std::string wholine = initial + (ch ? ch->name : lcn) + " " + u->ident + " " + (opt_showrealhost ? u->host : u->dhost) + " " + - ((*ServerInstance->Config->HideWhoisServer && !IS_OPER(user)) ? ServerInstance->Config->HideWhoisServer : u->server) + + ((*ServerInstance->Config->HideWhoisServer && !user->HasPrivPermission("servers/auspex")) ? ServerInstance->Config->HideWhoisServer : u->server) + " " + u->nick + " "; /* away? */ @@ -239,36 +239,41 @@ CmdResult CommandWho::Handle (const std::vector& parameters, User * opt_viewopersonly = true; break; case 'h': - if (IS_OPER(user)) + if (user->HasPrivPermission("users/auspex")) opt_showrealhost = true; break; case 'u': - if (IS_OPER(user)) + if (user->HasPrivPermission("users/auspex")) opt_unlimit = true; break; case 'r': opt_realname = true; break; case 'm': - opt_mode = true; + if (user->HasPrivPermission("users/auspex")) + opt_mode = true; break; case 'M': - opt_metadata = true; + if (user->HasPrivPermission("users/auspex")) + opt_metadata = true; break; case 'i': opt_ident = true; break; case 'p': - opt_port = true; + if (user->HasPrivPermission("users/auspex")) + opt_port = true; break; case 'a': opt_away = true; break; case 'l': - opt_local = true; + if (user->HasPrivPermission("users/auspex") || !*ServerInstance->Config->HideWhoisServer) + opt_local = true; break; case 'f': - opt_far = true; + if (user->HasPrivPermission("users/auspex") || !*ServerInstance->Config->HideWhoisServer) + opt_far = true; break; case 't': opt_time = true; @@ -286,10 +291,10 @@ CmdResult CommandWho::Handle (const std::vector& parameters, User * if (CanView(ch,user)) { bool inside = ch->HasUser(user); - + /* who on a channel. */ CUList *cu = ch->GetUsers(); - + for (CUList::iterator i = cu->begin(); i != cu->end(); i++) { /* None of this applies if we WHO ourselves */ @@ -298,12 +303,12 @@ CmdResult CommandWho::Handle (const std::vector& parameters, User * /* opers only, please */ if (opt_viewopersonly && !IS_OPER(i->first)) continue; - + /* If we're not inside the channel, hide +i users */ - if (i->first->IsModeSet('i') && !inside && !IS_OPER(user)) + if (i->first->IsModeSet('i') && !inside && !user->HasPrivPermission("users/auspex")) continue; } - + SendWhoLine(user, initial, ch, i->first, whoresults); } } @@ -322,7 +327,7 @@ CmdResult CommandWho::Handle (const std::vector& parameters, User * { if (!user->SharesChannelWith(oper)) { - if (usingwildcards && (!oper->IsModeSet('i')) && (!IS_OPER(user))) + if (usingwildcards && (!oper->IsModeSet('i')) && (!user->HasPrivPermission("users/auspex"))) continue; } @@ -338,7 +343,7 @@ CmdResult CommandWho::Handle (const std::vector& parameters, User * { if (!user->SharesChannelWith(i->second)) { - if (usingwildcards && (i->second->IsModeSet('i')) && (!IS_OPER(user))) + if (usingwildcards && (i->second->IsModeSet('i')) && (!user->HasPrivPermission("users/auspex"))) continue; } @@ -362,4 +367,3 @@ CmdResult CommandWho::Handle (const std::vector& parameters, User * return CMD_FAILURE; } } -