int ReadNextIRCMessage(cbuff *cb,char *buffer) {// test the circlebuffer to see if a full irc message is in the buffer. // If there is a full ircmessage in the circle buffer extract it into 'buffer'. // return: success = message length, message copyied to buffer and null-terminated; // return: failure, no message ready = 0, buffer left unchanged.. int len; int idx; //int cliplen; if(!cb->nbytes)// no data implies no message. { return 0; } // else see if there's a '\n' char. idx = CbuffFindByte(cb,'\n'); if(idx==-1)return 0; if(cb == ircs->sb) { len=1; } // full message in buffer copy it out of the buffer. len = idx + 1; CbuffRead(buffer,1,len,cb); // null terminate string. buffer[len]=0; return len; }// end ReadNextIRCMessage(cb,buffer).