src/irc.c
changeset 48 34094173351c
parent 47 a689b6a8e6ed
child 49 59b09b0aeb96
equal deleted inserted replaced
47:a689b6a8e6ed 48:34094173351c
   167     if ((theLine = compat_strdup (line)) == NULL)
   167     if ((theLine = compat_strdup (line)) == NULL)
   168         return "ENOMEM";
   168         return "ENOMEM";
   169     else
   169     else
   170         garbage_collector = theLine;
   170         garbage_collector = theLine;
   171 
   171 
   172     message->user = message->email = NULL;
   172     message->user = message->domain = NULL;
   173     message->command = NULL;
   173     message->command = NULL;
   174     message->channel = message->line = NULL;
   174     message->channel = message->line = NULL;
   175 
   175 
   176     token = strtok (theLine, " ");
   176     token = strtok (theLine, " ");
   177     if (*token != ':') {        /* SERVER MESSAGES */
   177     if (*token != ':') {        /* SERVER MESSAGES */
   251                 case VERSION:
   251                 case VERSION:
   252                     if ((ptr = strchr (message->user, ' ')))
   252                     if ((ptr = strchr (message->user, ' ')))
   253                         *ptr = '\0';
   253                         *ptr = '\0';
   254                     return command;
   254                     return command;
   255                 case PRIVMSG:
   255                 case PRIVMSG:
   256                     if ((message->email = strchr (message->user, '@')))
   256                     if ((message->domain = strchr (message->user, '@')))
   257                         ++message->email;
   257                         ++message->domain;
   258                     if ((ptr = strchr (message->user, '!')))
   258                     if ((ptr = strchr (message->user, '!')))
   259                         *ptr = '\0';
   259                         *ptr = '\0';
   260 
   260 
   261                     message->channel = strtok (message->line, " ");
   261                     message->channel = strtok (message->line, " ");
   262                     strncpy (message->current_channel, message->channel, sizeof (message->current_channel));
   262                     strncpy (message->current_channel, message->channel, sizeof (message->current_channel));