client_write("<msg_meta_content_type>", 23); xml_strout(smi.meta_content_type); client_write("</msg_meta_content_type>\n", 25);
client_write("<msg_text>", 10);
- serialize_message(&smr, msg);
- CtdlFreeMessage(msg);
+ CtdlSerializeMessage(&smr, msg);
+ CM_Free(msg);
/* Predict the buffer size we need. Expand the buffer if necessary. */
int encoded_len = smr.len * 15 / 10 ;
* Import begins here
*/
void migr_do_import(void) {
- char buf[SIZ];
+ StrBuf *Buf;
XML_Parser xp;
- int linelen;
+ int Finished = 0;
unbuffer_output();
-
+ Buf = NewStrBufPlain(NULL, SIZ);
xp = XML_ParserCreate(NULL);
if (!xp) {
cprintf("%d Failed to create XML parser instance\n", ERROR+INTERNAL_ERROR);
cprintf("%d sock it to me\n", SEND_LISTING);
unbuffer_output();
- while (client_getln(buf, sizeof buf) >= 0 && strcmp(buf, "000")) {
- linelen = strlen(buf);
- strcpy(&buf[linelen++], "\n");
+ client_set_inbound_buf(SIZ * 10);
+ while (!Finished && client_read_random_blob(Buf, -1) >= 0) {
+ if ((StrLength(Buf) > 4) &&
+ !strcmp(ChrPtr(Buf) + StrLength(Buf) - 4, "000\n"))
+ {
+ Finished = 1;
+ StrBufCutAt(Buf, StrLength(Buf) - 4, NULL);
+ }
if (server_shutting_down)
break; // Should we break or return?
- if (buf[0] == '\0')
+ if (StrLength(Buf) == 0)
continue;
- XML_Parse(xp, buf, linelen, 0);
+ XML_Parse(xp, ChrPtr(Buf), StrLength(Buf), 0);
+ FlushStrBuf(Buf);
}
XML_Parse(xp, "", 0, 1);
XML_ParserFree(xp);
-
+ FreeStrBuf(&Buf);
rebuild_euid_index();
rebuild_usersbynumber();
CC->dont_term = 0;