+
+ if (CtdlThreadCheckStop())
+ goto bail;
+
+ /* If we get to this point, the message is on its way. Read it. */
+ body = CtdlReadMessageBody(".", config.c_maxmsglen, NULL, 1, sock);
+ if (body == NULL) goto bail;
+
+ CtdlLogPrintf(CTDL_DEBUG, "Converting message...\n");
+ msg = convert_internet_message(body);
+ body = NULL; /* yes, this should be dereferenced, NOT freed */
+
+ /* Do Something With It (tm) */
+ msgnum = CtdlSubmitMsg(msg, NULL, roomname, 0);
+ if (msgnum > 0L) {
+ /* Message has been committed to the store */
+
+ if (!keep) {
+ snprintf(buf, sizeof buf, "DELE %d\r", msglist[i]);
+ CtdlLogPrintf(CTDL_DEBUG, "<%s\n", buf);
+ if (sock_puts(sock, buf) <0) goto bail;
+ if (sock_getln(sock, buf, sizeof buf) < 0) goto bail;
+ CtdlLogPrintf(CTDL_DEBUG, ">%s\n", buf); /* errors here are non-fatal */
+ }
+
+ /* write the uidl to the use table so we don't fetch this message again */
+ strcpy(ut.ut_msgid, utmsgid);
+ ut.ut_timestamp = time(NULL);
+ cdb_store(CDB_USETABLE, utmsgid, strlen(utmsgid),
+ &ut, sizeof(struct UseTable) );
+ }
+ CtdlFreeMessage(msg);