+ while (client_getln(buf, sizeof buf) >= 0 && strcasecmp(buf, END_OF_MESSAGE)) {
+ if (CtdlThreadCheckStop())
+ return;
+
+ cprintdot(iterations);
+
+ /**
+ * Grow the buffers if we need to
+ */
+ mlen = strlen (buf);
+ if (b64len + mlen > *b64size)
+ {
+ tbuf = realloc (*b64buf, *b64size + SIZ);
+ tbuf2 = realloc (*plain, *plain_size + SIZ);
+ if (tbuf && tbuf2)
+ {
+ *b64buf = tbuf;
+ *plain = tbuf2;
+ *b64size += SIZ;
+ *plain_size += SIZ;
+ }
+ else
+ {
+ CtdlLogPrintf(CTDL_DEBUG, "ARTV import: realloc() failed.\n");
+ cprintf("\nMemory allocation failure.\n");
+ return;
+ }
+ }
+ strcat (*b64buf, buf);
+ b64len += mlen;
+ }
+
+ /**
+ * Decode and store the message
+ * If this decode and store takes more than 5 seconds the sendcommand WD timer may expire.
+ * This is the reason for outputting a dot before and after.
+ */
+ msglen = CtdlDecodeBase64(*plain, *b64buf, b64len);
+// cprintdot(iterations);
+ CtdlLogPrintf(CTDL_DEBUG, "msglen = %ld\n", msglen);
+ cdb_store(CDB_MSGMAIN, &msgnum, sizeof(long), *plain, msglen);
+// cprintdot(iterations);
+ PutMetaData(&smi);
+ CtdlLogPrintf(CTDL_INFO, "Imported message %ld\n", msgnum);
+
+/*