}
}
+/* XXX - perhaps this should be in cmd_whois? -- w00t */
void do_whois(userrec* user, userrec* dest,unsigned long signon, unsigned long idle, char* nick)
{
// bug found by phidjit - were able to whois an incomplete connection if it had sent a NICK or USER
if (dest->registered == 7)
{
WriteServ(user->fd,"311 %s %s %s %s * :%s",user->nick, dest->nick, dest->ident, dest->dhost, dest->fullname);
- if ((user == dest) || (strchr(user->modes,'o')))
+ if ((user == dest) || (*user->oper))
{
- WriteServ(user->fd,"378 %s %s :is connecting from *@%s %s",user->nick, dest->nick, dest->host, dest->ip);
+ WriteServ(user->fd,"378 %s %s :is connecting from *@%s %s",user->nick, dest->nick, dest->host, (char*)inet_ntoa(dest->ip4));
}
std::string cl = chlist(dest,user);
if (cl.length())
WriteServ(user->fd,"319 %s %s :%s",user->nick, dest->nick, cl.c_str());
}
}
- WriteServ(user->fd,"312 %s %s %s :%s",user->nick, dest->nick, dest->server, GetServerDescription(dest->server).c_str());
+ if (*Config->HideWhoisServer)
+ {
+ 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);
+ }
+ else
+ {
+ WriteServ(user->fd,"312 %s %s %s :%s",user->nick, dest->nick, dest->server, GetServerDescription(dest->server).c_str());
+ }
if (*dest->awaymsg)
{
WriteServ(user->fd,"301 %s %s :%s",user->nick, dest->nick, dest->awaymsg);
}
- if (strchr(dest->modes,'o'))
+ if (*dest->oper)
{
- if (*dest->oper)
- {
- WriteServ(user->fd,"313 %s %s :is %s %s on %s",user->nick, dest->nick, (strchr("aeiou",dest->oper[0]) ? "an" : "a"),dest->oper, Config->Network);
- }
- else
- {
- WriteServ(user->fd,"313 %s %s :is opered but has an unknown type",user->nick, dest->nick);
- }
+ WriteServ(user->fd,"313 %s %s :is %s %s on %s",user->nick, dest->nick, (strchr("aeiou",*dest->oper) ? "an" : "a"),dest->oper, Config->Network);
}
if ((!signon) && (!idle))
{
}
}
+
+/* XXX - these really belong in helperfuncs perhaps -- w00t */
bool is_uline(const char* server)
{
char ServName[MAXBUF];
long matches = 0;
for (user_hash::iterator u = clientlist.begin(); u != clientlist.end(); u++)
{
- if (match(u->second->ip,ip.c_str()))
+ if (match((char*)inet_ntoa(u->second->ip4),ip.c_str()))
matches++;
}
float percent = ((float)matches / (float)clientlist.size()) * 100;