* | Inspire Internet Relay Chat Daemon |
* +------------------------------------+
*
- * Inspire is copyright (C) 2002-2004 ChatSpike-Dev.
+ * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
* E-mail:
* <brain@chatspike.net>
* <Craig@chatspike.net>
#include "typedefs.h"
#include "command_parse.h"
-extern SocketEngine* SE;
extern ServerConfig* Config;
extern InspIRCd* ServerInstance;
// This table references users by file descriptor.
// its an array to make it VERY fast, as all lookups are referenced
// by an integer, meaning there is no need for a scan/search operation.
-extern userrec* fd_ref_table[65536];
+extern userrec* fd_ref_table[MAX_DESCRIPTORS];
-char* CleanFilename(char* name)
-{
- char* p = name + strlen(name);
- while ((p != name) && (*p != '/')) p--;
- return (p != name ? ++p : p);
-}
void split_chlist(userrec* user, userrec* dest, std::string &cl)
{
}
}
+/* 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;