summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2007-05-12 15:52:55 +0000
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2007-05-12 15:52:55 +0000
commitfe04cdd9dc0d504e2a0d8fb74fcf80dc59a051d7 (patch)
tree1590ac3eb3ce6a64e1bec6125ceb3d90e7ebc395
parent3a60fed191af07b0e124c2704227b56f99a80f7a (diff)
Remove the char junk here, use an std::string
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6987 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/cmd_userhost.cpp37
1 files changed, 24 insertions, 13 deletions
diff --git a/src/cmd_userhost.cpp b/src/cmd_userhost.cpp
index 28bba1e7f..363ba611c 100644
--- a/src/cmd_userhost.cpp
+++ b/src/cmd_userhost.cpp
@@ -24,29 +24,40 @@ extern "C" command_t* init_command(InspIRCd* Instance)
CmdResult cmd_userhost::Handle (const char** parameters, int pcnt, userrec *user)
{
- char Return[MAXBUF],junk[MAXBUF];
- snprintf(Return,MAXBUF,"302 %s :",user->nick);
+ std::string retbuf = std::string("302 ") + user->nick + " :";
+
for (int i = 0; i < pcnt; i++)
{
userrec *u = ServerInstance->FindNick(parameters[i]);
+
if ((u) && (u->registered == REG_ALL))
{
- if(*u->oper)
- if(*user->oper)
- snprintf(junk,MAXBUF,"%s*=+%s@%s ",u->nick,u->ident,u->host);
- else
- snprintf(junk,MAXBUF,"%s*=+%s@%s ",u->nick,u->ident,u->dhost);
+ retbuf = retbuf + " ";
+
+ if (*u->oper)
+ {
+ retbuf = retbuf + "*=+";
+ }
else
- if(*user->oper)
- snprintf(junk,MAXBUF,"%s=+%s@%s ",u->nick,u->ident,u->host);
- else
- snprintf(junk,MAXBUF,"%s=+%s@%s ",u->nick,u->ident,u->dhost);
+ {
+ retbuf = retbuf + "=+";
+ }
- strlcat(Return,junk,MAXBUF);
+ retbuf = retbuf + u->ident + "@";
+
+ if (*user->oper)
+ {
+ retbuf = retbuf + u->host;
+ }
+ else
+ {
+ retbuf = retbuf + u->dhost;
+ }
}
}
- user->WriteServ(Return);
+
+ user->WriteServ(retbuf);
return CMD_SUCCESS;
}