]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/coremods/core_userhost.cpp
Reduce std::string::substr() usage
[user/henk/code/inspircd.git] / src / coremods / core_userhost.cpp
index 8fa897641f69f36b70a977203f11d68c02aab795..a6782419496a0710f13bc8480a4248d7e07c87d7 100644 (file)
@@ -28,7 +28,7 @@ class CommandUserhost : public Command
        /** Constructor for userhost.
         */
        CommandUserhost ( Module* parent) : Command(parent,"USERHOST", 1, 5) {
-               syntax = "<nick> {<nick>}";
+               syntax = "<nick> [<nick> ...]";
        }
        /** Handle command.
         * @param parameters The parameters to the command
@@ -50,22 +50,17 @@ CmdResult CommandUserhost::Handle (const std::vector<std::string>& parameters, U
 
                if ((u) && (u->registered == REG_ALL))
                {
-                       retbuf = retbuf + u->nick;
+                       retbuf += u->nick;
 
                        if (u->IsOper())
-                               retbuf = retbuf + "*";
+                               retbuf += '*';
 
-                       retbuf = retbuf + "=";
-
-                       if (u->IsAway())
-                               retbuf += "-";
-                       else
-                               retbuf += "+";
-
-                       retbuf = retbuf + u->ident + "@";
-
-                       retbuf += (has_privs ? u->host : u->dhost);
-                       retbuf = retbuf + " ";
+                       retbuf += '=';
+                       retbuf += (u->IsAway() ? '-' : '+');
+                       retbuf += u->ident;
+                       retbuf += '@';
+                       retbuf += (((u == user) || (has_privs)) ? u->host : u->dhost);
+                       retbuf += ' ';
                }
        }