src/irc.c
changeset 13 d3554afaa768
parent 12 213c3d4abc66
child 15 f19c1f9b4cd3
equal deleted inserted replaced
12:213c3d4abc66 13:d3554afaa768
    15 #include <arpa/inet.h>
    15 #include <arpa/inet.h>
    16 #include <netdb.h>
    16 #include <netdb.h>
    17 
    17 
    18 #include <pwd.h>
    18 #include <pwd.h>
    19 
    19 
       
    20 #include <compat.h>
    20 #include <irc.h>
    21 #include <irc.h>
    21 
    22 
    22 #define VERSION_STRING "MCBOT on GNU/LINUX"
    23 #define VERSION_STRING "MCBOT on GNU/LINUX"
    23 
    24 
    24 const char *IRC_Commands[] = {
    25 const char *IRC_Commands[] = {
   145     static char *garbage_collector = NULL;
   146     static char *garbage_collector = NULL;
   146     char *theLine;
   147     char *theLine;
   147     char *token;
   148     char *token;
   148     char *ptr;
   149     char *ptr;
   149 
   150 
   150     if (garbage_collector != NULL)
   151     if (garbage_collector != NULL) {
   151         free (garbage_collector);
   152         free (garbage_collector);
   152 
   153         garbage_collector = NULL;
   153     if ((theLine = strdup (line)) == NULL)
   154     }
       
   155 
       
   156     if ((theLine = compat_strdup (line)) == NULL)
   154         return "ENOMEM";
   157         return "ENOMEM";
   155     else
   158     else
   156         garbage_collector = theLine;
   159         garbage_collector = theLine;
   157 
   160 
   158     message->user = message->email = NULL;
   161     message->user = message->email = NULL;
   321             case 375:
   324             case 375:
   322             case 376:          /* END OF MOTD */
   325             case 376:          /* END OF MOTD */
   323                 return command;
   326                 return command;
   324             case 401:          /* NO SUCH NICK/CHANNEL */
   327             case 401:          /* NO SUCH NICK/CHANNEL */
   325             case 403:          /* THAT CHANNEL DOESN'T EXIST */
   328             case 403:          /* THAT CHANNEL DOESN'T EXIST */
       
   329             case 412:          /* NO TEXT TO SEND */
   326             case 441:          /* THEY AREN'T ON THIS CHANNEL */
   330             case 441:          /* THEY AREN'T ON THIS CHANNEL */
   327                 return command;
   331                 return command;
   328             case 474:
   332             case 474:
   329             case 475:
   333             case 475:
   330             case 476:
   334             case 476: