#include #include #include "common.h" #define UIRC_IRCV3 #include "uirc/functions.h" #include "uirc/types.h" ssize_t get_buffer_line(char* buf, IRC_Message* parsed) { if (buf == NULL || parsed == NULL) return -1; char* ppoi; if ((ppoi = strchr(buf, '\n')) != NULL) { *ppoi = '\0'; if (ppoi > buf && *(ppoi - 1) == '\r') *(ppoi - 1) = '\0'; if (Tok_mesg(buf, parsed) == 1) return ++ppoi - buf; fprintf(stderr, "warning: received invalid message.\n"); return -1; } return 0; }