summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/commands/cmd_who.cpp37
-rw-r--r--src/modules.cpp2
-rw-r--r--src/modules/m_hideoper.cpp5
-rw-r--r--src/modules/m_invisible.cpp4
4 files changed, 32 insertions, 16 deletions
diff --git a/src/commands/cmd_who.cpp b/src/commands/cmd_who.cpp
index 6aac6eeea..8afb3d6e7 100644
--- a/src/commands/cmd_who.cpp
+++ b/src/commands/cmd_who.cpp
@@ -39,7 +39,7 @@ class CommandWho : public Command
CommandWho ( Module* parent) : Command(parent,"WHO", 1) {
syntax = "<server>|<nickname>|<channel>|<realname>|<host>|0 [ohurmMiaplf]";
}
- void SendWhoLine(User* user, const std::string &initial, Channel* ch, User* u, std::vector<std::string> &whoresults);
+ void SendWhoLine(User* user, const std::vector<std::string>& parms, const std::string &initial, Channel* ch, User* u, std::vector<std::string> &whoresults);
/** Handle command.
* @param parameters The parameters to the comamnd
* @param pcnt The number of parameters passed to teh command
@@ -184,14 +184,18 @@ bool CommandWho::CanView(Channel* chan, User* user)
return false;
}
-void CommandWho::SendWhoLine(User* user, const std::string &initial, Channel* ch, User* u, std::vector<std::string> &whoresults)
+void CommandWho::SendWhoLine(User* user, const std::vector<std::string>& parms, const std::string &initial, Channel* ch, User* u, std::vector<std::string> &whoresults)
{
const std::string& lcn = get_first_visible_channel(u);
- Channel* chlast = ServerInstance->FindChan(lcn);
- std::string wholine = initial + (ch ? ch->name : lcn) + " " + u->ident + " " + (opt_showrealhost ? u->host : u->dhost) + " " +
- ((!ServerInstance->Config->HideWhoisServer.empty() && !user->HasPrivPermission("servers/auspex")) ? ServerInstance->Config->HideWhoisServer : u->server) +
- " " + u->nick + " ";
+ std::string wholine = initial + (ch ? ch->name : lcn) + " " + u->ident + " " +
+ (opt_showrealhost ? u->host : u->dhost) + " ";
+ if (!ServerInstance->Config->HideWhoisServer.empty() && !user->HasPrivPermission("servers/auspex"))
+ wholine.append(ServerInstance->Config->HideWhoisServer);
+ else
+ wholine.append(u->server);
+
+ wholine.append(" " + u->nick + " ");
/* away? */
if (IS_AWAY(u))
@@ -206,12 +210,21 @@ void CommandWho::SendWhoLine(User* user, const std::string &initial, Channel* ch
/* oper? */
if (IS_OPER(u))
{
- wholine.append("*");
+ wholine.push_back('*');
+ }
+
+ if (ch)
+ wholine.append(ch->GetPrefixChar(u));
+ else
+ {
+ Channel* lch = ServerInstance->FindChan(lcn);
+ if (lch)
+ wholine.append(lch->GetPrefixChar(u));
}
- wholine = wholine + (ch ? ch->GetPrefixChar(u) : (chlast ? chlast->GetPrefixChar(u) : "")) + " :0 " + u->fullname;
+ wholine.append(" :0 " + u->fullname);
- FOREACH_MOD(I_OnSendWhoLine, OnSendWhoLine(user, u, ch, wholine));
+ FOREACH_MOD(I_OnSendWhoLine, OnSendWhoLine(user, parms, u, ch, wholine));
if (!wholine.empty())
whoresults.push_back(wholine);
@@ -340,7 +353,7 @@ CmdResult CommandWho::Handle (const std::vector<std::string>& parameters, User *
continue;
}
- SendWhoLine(user, initial, ch, i->first, whoresults);
+ SendWhoLine(user, parameters, initial, ch, i->first, whoresults);
}
}
}
@@ -362,7 +375,7 @@ CmdResult CommandWho::Handle (const std::vector<std::string>& parameters, User *
continue;
}
- SendWhoLine(user, initial, NULL, oper, whoresults);
+ SendWhoLine(user, parameters, initial, NULL, oper, whoresults);
}
}
}
@@ -378,7 +391,7 @@ CmdResult CommandWho::Handle (const std::vector<std::string>& parameters, User *
continue;
}
- SendWhoLine(user, initial, NULL, i->second, whoresults);
+ SendWhoLine(user, parameters, initial, NULL, i->second, whoresults);
}
}
}
diff --git a/src/modules.cpp b/src/modules.cpp
index 58c27e490..9186e38be 100644
--- a/src/modules.cpp
+++ b/src/modules.cpp
@@ -161,7 +161,7 @@ void Module::OnNamesListItem(User*, Membership*, std::string&, std::string&) {
ModResult Module::OnNumeric(User*, unsigned int, const std::string&) { return MOD_RES_PASSTHRU; }
void Module::OnHookIO(StreamSocket*, ListenSocket*) { }
ModResult Module::OnAcceptConnection(int, ListenSocket*, irc::sockets::sockaddrs*, irc::sockets::sockaddrs*) { return MOD_RES_PASSTHRU; }
-void Module::OnSendWhoLine(User*, User*, Channel*, std::string&) { }
+void Module::OnSendWhoLine(User*, const std::vector<std::string>&, User*, Channel*, std::string&) { }
ModResult Module::OnChannelRestrictionApply(User*, Channel*, const char*) { return MOD_RES_PASSTHRU; }
ModuleManager::ModuleManager() : ModCount(0)
diff --git a/src/modules/m_hideoper.cpp b/src/modules/m_hideoper.cpp
index 18db0320c..360dae014 100644
--- a/src/modules/m_hideoper.cpp
+++ b/src/modules/m_hideoper.cpp
@@ -88,7 +88,7 @@ class ModuleHideOper : public Module
return MOD_RES_PASSTHRU;
}
- void OnSendWhoLine(User* source, User* user, Channel* channel, std::string& line)
+ void OnSendWhoLine(User* source, const std::vector<std::string>& params, User* user, Channel* channel, std::string& line)
{
if (user->IsModeSet('H') && !source->HasPrivPermission("users/auspex"))
{
@@ -96,6 +96,9 @@ class ModuleHideOper : public Module
std::string::size_type pos = line.find("* ");
if (pos != std::string::npos)
line.erase(pos);
+ // hide the line completely if doing a "/who * o" query
+ if (params.size() > 1 && params[1].find('o') != std::string::npos)
+ line.clear();
}
}
};
diff --git a/src/modules/m_invisible.cpp b/src/modules/m_invisible.cpp
index abedaf0ce..602a45b49 100644
--- a/src/modules/m_invisible.cpp
+++ b/src/modules/m_invisible.cpp
@@ -133,7 +133,7 @@ class ModuleInvisible : public Module
void OnBuildNeighborList(User* source, UserChanList &include, std::map<User*,bool> &exceptions);
ModResult OnUserPreNotice(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list);
ModResult OnUserPreMessage(User* user,void* dest,int target_type, std::string &text, char status, CUList &exempt_list);
- void OnSendWhoLine(User* source, User* user, Channel* channel, std::string& line);
+ void OnSendWhoLine(User* source, const std::vector<std::string>&, User* user, Channel* channel, std::string& line);
void OnNamesListItem(User* issuer, Membership* memb, std::string &prefixes, std::string &nick);
};
@@ -191,7 +191,7 @@ ModResult ModuleInvisible::OnUserPreMessage(User* user,void* dest,int target_typ
return OnUserPreNotice(user, dest, target_type, text, status, exempt_list);
}
-void ModuleInvisible::OnSendWhoLine(User* source, User* user, Channel* channel, std::string& line)
+void ModuleInvisible::OnSendWhoLine(User* source, const std::vector<std::string>& params, User* user, Channel* channel, std::string& line)
{
if (user->IsModeSet('Q') && !IS_OPER(source))
line.clear();