00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 #ifndef USE_PCH
00017 #include "sys.h"
00018 #endif
00019 
00020 #include "keys.h"
00021 
00022 char const* command_to_str(int command)
00023 {
00024   if (command > 0)
00025   {
00026     static char numeric_buf[4];
00027     char* p = numeric_buf + 3;
00028     *p = 0;
00029     for (int i = 0; i < 3; ++i)
00030     {
00031       *--p = '0' + (command % 10);
00032       command /= 10;
00033     }
00034     return numeric_buf;
00035   }
00036   using namespace keys;
00037   switch (command)
00038   {
00039     case WHO:
00040       return "WHO";
00041     case NICK:
00042       return "NICK";
00043     case WHOIS:
00044       return "WHOIS";
00045     case WHOWAS:
00046       return "WHOWAS";
00047     case CNOTICE:
00048       return "CNOTICE";
00049     case NOTICE:
00050       return "NOTICE";
00051     case PING:
00052       return "PING";
00053     case CPRIVMSG:
00054       return "CPRIVMSG";
00055     case PART:
00056       return "PART";
00057     case TOPIC:
00058       return "TOPIC";
00059     case LINKS:
00060       return "LINKS";
00061     case KICK:
00062       return "KICK";
00063     case ERROR:
00064       return "ERROR";
00065     case USER:
00066       return "USER";
00067     case PASS:
00068       return "PASS";
00069     case PRIVMSG:
00070       return "PRIVMSG";
00071     case QUIT:
00072       return "QUIT";
00073     case NAMES:
00074       return "NAMES";
00075     case JOIN:
00076       return "JOIN";
00077     case KILL:
00078       return "KILL";
00079     case MODE:
00080       return "MODE";
00081     case LIST:
00082       return "LIST";
00083     case INVITE:
00084       return "INVITE";
00085     case SILENCE:
00086       return "SILENCE";
00087     case PONG:
00088       return "PONG";
00089     case OPER:
00090       return "OPER";
00091     case STATS:
00092       return "STATS";
00093     case MAP:
00094       return "MAP";
00095     case WALLOPS:
00096       return "WALLOPS";
00097     case WALLUSERS:
00098       return "WALLUSERS";
00099     case VERSION:
00100       return "VERSION";
00101     case CONNECT:
00102       return "CONNECT";
00103   }
00104   DoutFatal(dc::core, "Unhandled command");
00105 }