The InspIRCd Project
Home | Developers | Wiki | Forums | Bug Tracker | SVN | Download | Blog | Stats
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

cmd_whois.h File Reference

#include "users.h"
#include "channels.h"

Include dependency graph for cmd_whois.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  cmd_whois
 Handle /WHOIS. More...

Functions

const char * Spacify (char *n)
DllExport void do_whois (InspIRCd *Instance, userrec *user, userrec *dest, unsigned long signon, unsigned long idle, const char *nick)


Function Documentation

DllExport void do_whois InspIRCd Instance,
userrec user,
userrec dest,
unsigned long  signon,
unsigned long  idle,
const char *  nick
 

Definition at line 21 of file cmd_whois.cpp.

References userrec::awaymsg, userrec::ChannelList(), InspIRCd::Config, userrec::dhost, FOREACH_MOD, userrec::fullname, userrec::GetIPString(), InspIRCd::GetServerDescription(), ServerConfig::HideWhoisServer, connection::host, I_OnWhois, userrec::ident, IS_AWAY, IS_OPER, ServerConfig::Network, userrec::nick, userrec::oper, REG_ALL, connection::registered, InspIRCd::SendWhoisLine(), userrec::server, irc::Spacify(), userrec::Visibility, and VisData::VisibleTo().

Referenced by cmd_whois::Handle(), and TreeSocket::Whois().

00022 {
00023         if (dest->Visibility && !dest->Visibility->VisibleTo(user))
00024         {
00025                 ServerInstance->SendWhoisLine(user, dest, 401, "%s %s :No such nick/channel",user->nick, *nick ? nick : "*");
00026                 ServerInstance->SendWhoisLine(user, dest, 318, "%s %s :End of /WHOIS list.",user->nick, *nick ? nick : "*");
00027                 return;
00028         }
00029 
00030         if (dest->registered == REG_ALL)
00031         {
00032                 ServerInstance->SendWhoisLine(user, dest, 311, "%s %s %s %s * :%s",user->nick, dest->nick, dest->ident, dest->dhost, dest->fullname);
00033                 if (user == dest || IS_OPER(user))
00034                 {
00035                         ServerInstance->SendWhoisLine(user, dest, 378, "%s %s :is connecting from %s@%s %s", user->nick, dest->nick, dest->ident, dest->host, dest->GetIPString());
00036                 }
00037 
00038                 std::string cl = dest->ChannelList(user);
00039 
00040                 if (cl.length())
00041                 {
00042                         if (cl.length() > 400)
00043                         {
00044                                 user->SplitChanList(dest,cl);
00045                         }
00046                         else
00047                         {
00048                                 ServerInstance->SendWhoisLine(user, dest, 319, "%s %s :%s",user->nick, dest->nick, cl.c_str());
00049                         }
00050                 }
00051                 if (*ServerInstance->Config->HideWhoisServer && !IS_OPER(user))
00052                 {
00053                         ServerInstance->SendWhoisLine(user, dest, 312, "%s %s %s :%s",user->nick, dest->nick, ServerInstance->Config->HideWhoisServer, ServerInstance->Config->Network);
00054                 }
00055                 else
00056                 {
00057                         ServerInstance->SendWhoisLine(user, dest, 312, "%s %s %s :%s",user->nick, dest->nick, dest->server, ServerInstance->GetServerDescription(dest->server).c_str());
00058                 }
00059 
00060                 if (IS_AWAY(dest))
00061                 {
00062                         ServerInstance->SendWhoisLine(user, dest, 301, "%s %s :%s",user->nick, dest->nick, dest->awaymsg);
00063                 }
00064 
00065                 if (IS_OPER(dest))
00066                 {
00067                         ServerInstance->SendWhoisLine(user, dest, 313, "%s %s :is %s %s on %s",user->nick, dest->nick, (strchr("AEIOUaeiou",*dest->oper) ? "an" : "a"),irc::Spacify(dest->oper), ServerInstance->Config->Network);
00068                 }
00069 
00070                 FOREACH_MOD(I_OnWhois,OnWhois(user,dest));
00071 
00072                 /*
00073                  * We only send these if we've been provided them. That is, if hidewhois is turned off, and user is local, or
00074                  * if remote whois is queried, too. This is to keep the user hidden, and also since you can't reliably tell remote time. -- w00t
00075                  */
00076                 if ((idle) || (signon))
00077                 {
00078                         ServerInstance->SendWhoisLine(user, dest, 317, "%s %s %d %d :seconds idle, signon time",user->nick, dest->nick, idle, signon);
00079                 }
00080 
00081                 ServerInstance->SendWhoisLine(user, dest, 318, "%s %s :End of /WHOIS list.",user->nick, dest->nick);
00082         }
00083         else
00084         {
00085                 ServerInstance->SendWhoisLine(user, dest, 401, "%s %s :No such nick/channel",user->nick, *nick ? nick : "*");
00086                 ServerInstance->SendWhoisLine(user, dest, 318, "%s %s :End of /WHOIS list.",user->nick, *nick ? nick : "*");
00087         }
00088 }

const char* Spacify char *  n  )