summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2014-06-22 13:25:09 +0200
committerAttila Molnar <attilamolnar@hush.com>2014-06-22 13:25:09 +0200
commitabc36583542c458a60a63c315791964bb6380879 (patch)
treeb38dbe2a50ebfce72e936031e60af98ffbeb9c29 /src
parentee0c7d07afb33935e1f7f23144e2e33ced33f762 (diff)
core_userhost Do the HasPrivPermission() check only once, not once per nick
Diffstat (limited to 'src')
-rw-r--r--src/coremods/core_userhost.cpp12
1 files changed, 3 insertions, 9 deletions
diff --git a/src/coremods/core_userhost.cpp b/src/coremods/core_userhost.cpp
index 541402c10..8fa897641 100644
--- a/src/coremods/core_userhost.cpp
+++ b/src/coremods/core_userhost.cpp
@@ -40,6 +40,8 @@ class CommandUserhost : public Command
CmdResult CommandUserhost::Handle (const std::vector<std::string>& parameters, User *user)
{
+ const bool has_privs = user->HasPrivPermission("users/auspex");
+
std::string retbuf = "302 " + user->nick + " :";
for (unsigned int i = 0; i < parameters.size(); i++)
@@ -62,15 +64,7 @@ CmdResult CommandUserhost::Handle (const std::vector<std::string>& parameters, U
retbuf = retbuf + u->ident + "@";
- if (user->HasPrivPermission("users/auspex"))
- {
- retbuf = retbuf + u->host;
- }
- else
- {
- retbuf = retbuf + u->dhost;
- }
-
+ retbuf += (has_privs ? u->host : u->dhost);
retbuf = retbuf + " ";
}
}