summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cmd_whowas.cpp17
-rw-r--r--src/commands.cpp6
2 files changed, 16 insertions, 7 deletions
diff --git a/src/cmd_whowas.cpp b/src/cmd_whowas.cpp
index d70b1eafa..143877219 100644
--- a/src/cmd_whowas.cpp
+++ b/src/cmd_whowas.cpp
@@ -73,22 +73,31 @@ void cmd_whowas::Handle (char **parameters, int pcnt, userrec* user)
}
else
{
- whowas_set* grp = (whowas_set*)i->second;
+ whowas_set* grp = i->second;
if (grp->size())
{
for (whowas_set::iterator ux = grp->begin(); ux != grp->end(); ux++)
{
- WhoWasGroup* u = (WhoWasGroup*)*ux;
+ WhoWasGroup* u = *ux;
time_t rawtime = u->signon;
tm *timeinfo;
char b[MAXBUF];
timeinfo = localtime(&rawtime);
+
+ /* XXX - 'b' could be only 25 chars long and then strlcpy() would terminate it for us too? */
strlcpy(b,asctime(timeinfo),MAXBUF);
b[24] = 0;
WriteServ(user->fd,"314 %s %s %s %s * :%s",user->nick,parameters[0],u->ident,u->dhost,u->gecos);
- WriteServ(user->fd,"312 %s %s %s :%s",user->nick,parameters[0], *Config->HideWhoisServer ? Config->HideWhoisServer : u->server,b);
+
+ if(*user->oper)
+ WriteServ(user->fd,"379 %s %s :was connecting from *@%s", user->nick, parameters[0], u->host);
+
+ if(*Config->HideWhoisServer && !(*user->oper))
+ WriteServ(user->fd,"312 %s %s %s :%s",user->nick,parameters[0], Config->HideWhoisServer, b);
+ else
+ WriteServ(user->fd,"312 %s %s %s :%s",user->nick,parameters[0], u->server, b);
}
}
else
@@ -96,6 +105,6 @@ void cmd_whowas::Handle (char **parameters, int pcnt, userrec* user)
WriteServ(user->fd,"406 %s %s :There was no such nickname",user->nick,parameters[0]);
}
}
+
WriteServ(user->fd,"369 %s %s :End of WHOWAS",user->nick,parameters[0]);
}
-
diff --git a/src/commands.cpp b/src/commands.cpp
index f0f5ddf30..aea43482f 100644
--- a/src/commands.cpp
+++ b/src/commands.cpp
@@ -119,7 +119,7 @@ void do_whois(userrec* user, userrec* dest,unsigned long signon, unsigned long i
WriteServ(user->fd,"311 %s %s %s %s * :%s",user->nick, dest->nick, dest->ident, dest->dhost, dest->fullname);
if ((user == dest) || (*user->oper))
{
- WriteServ(user->fd,"378 %s %s :is connecting from *@%s %s",user->nick, dest->nick, dest->host, (char*)inet_ntoa(dest->ip4));
+ WriteServ(user->fd,"378 %s %s :is connecting from *@%s %s",user->nick, dest->nick, dest->host, inet_ntoa(dest->ip4));
}
std::string cl = chlist(dest,user);
if (cl.length())
@@ -133,9 +133,9 @@ void do_whois(userrec* user, userrec* dest,unsigned long signon, unsigned long i
WriteServ(user->fd,"319 %s %s :%s",user->nick, dest->nick, cl.c_str());
}
}
- if (*Config->HideWhoisServer)
+ if (*Config->HideWhoisServer && !(*user->oper))
{
- WriteServ(user->fd,"312 %s %s %s :%s",user->nick, dest->nick, *user->oper ? dest->server : Config->HideWhoisServer, *user->oper ? GetServerDescription(dest->server).c_str() : Config->Network);
+ WriteServ(user->fd,"312 %s %s %s :%s",user->nick, dest->nick, Config->HideWhoisServer, Config->Network);
}
else
{