src/main.c
changeset 11 a769385a59c6
parent 10 311ea5fa60dd
child 15 f19c1f9b4cd3
equal deleted inserted replaced
10:311ea5fa60dd 11:a769385a59c6
    88         if (uc.topic)
    88         if (uc.topic)
    89             fprintf (message.stream, "TOPIC %s :%s\r\n", uc.channel, uc.topic);
    89             fprintf (message.stream, "TOPIC %s :%s\r\n", uc.channel, uc.topic);
    90     }
    90     }
    91 
    91 
    92     while (!feof (message.stream)) {
    92     while (!feof (message.stream)) {
    93         *buf = 0;
    93         *buf = '\0';
    94         fgets (buf, 512, message.stream);
    94         fgets (buf, 512, message.stream);
    95 
    95 
    96         if ((command = irc_parsemessage (buf, &message))) {
    96         if ((command = irc_parsemessage (buf, &message))) {
    97             printf ("%10s %s %s\n", command, message.channel, message.line);
    97             printf ("%10s %s %s\n", command, message.channel, message.line);
    98             if (!strcmp (command, "ERROR"))
    98             if (!strcmp (command, "ERROR") || !strcmp (command, "ENOMEM"))
    99                 break;
    99                 break;
   100         } else {
   100         } else {
   101             if ((msg = parse (&message)) != NULL) {
   101             if ((msg = parse (&message)) != NULL) {
   102                 fprintf (message.stream, "%s\r\n", msg);
   102                 fprintf (message.stream, "%s\r\n", msg);
   103                 printf ("%10s %s", "WRITE", msg);
   103                 printf ("%10s %s", "WRITE", msg);