#include <limits.h>
#include "citadel.h"
#include "server.h"
-#include "sysdep_decls.h"
#include "citserver.h"
#include "support.h"
#include "config.h"
-#include "serv_extensions.h"
#include "database.h"
#include "msgbase.h"
#include "tools.h"
#include "control.h"
#include "euidindex.h"
+
+#include "ctdl_module.h"
+
+
+
+
#define END_OF_MESSAGE "---eom---dbd---"
char artv_tempfilename1[PATH_MAX];
/* write it in base64 */
CtdlMakeTempFileName(tempfile, sizeof tempfile);
- snprintf(buf, sizeof buf, "%sbase64 -e >%s", ctdl_sbin_dir, tempfile);
+ snprintf(buf, sizeof buf, "%s -e >%s", file_base64, tempfile);
fp = popen(buf, "w");
fwrite(smr.ser, smr.len, 1, fp);
pclose(fp);
/* decode base64 message text */
CtdlMakeTempFileName(tempfile, sizeof tempfile);
- snprintf(buf, sizeof buf, "%sbase64 -d >%s", ctdl_sbin_dir, tempfile);
+ snprintf(buf, sizeof buf, "%s -d >%s", file_base64, tempfile);
fp = popen(buf, "w");
while (client_getln(buf, sizeof buf), strcasecmp(buf, END_OF_MESSAGE)) {
fprintf(fp, "%s\n", buf);
void artv_do_import(void) {
char buf[SIZ];
+ char abuf[SIZ];
char s_version[SIZ];
int version;
+ long iterations;
unbuffer_output();
cprintf("%d sock it to me\n", SEND_LISTING);
+ abuf[0] = '\0';
+ unbuffer_output();
+ iterations = 0;
while (client_getln(buf, sizeof buf), strcmp(buf, "000")) {
lprintf(CTDL_DEBUG, "import keyword: <%s>\n", buf);
-
+ if ((abuf[0] == '\0') || (strcasecmp(buf, abuf))) {
+ cprintf ("\n\nImporting datatype %s\n", buf);
+ strncpy (abuf, buf, SIZ);
+ iterations = 0;
+ }
+ else {
+ cprintf(".");
+ if (iterations % 64 == 0)
+ cprintf("\n");
+
+ }
+
if (!strcasecmp(buf, "version")) {
client_getln(s_version, sizeof s_version);
version = atoi(s_version);
else if (!strcasecmp(buf, "visit")) artv_import_visit();
else if (!strcasecmp(buf, "message")) artv_import_message();
else break;
-
+ iterations ++;
}
lprintf(CTDL_INFO, "Invalid keyword <%s>. Flushing input.\n", buf);
while (client_getln(buf, sizeof buf), strcmp(buf, "000")) ;;
-char *serv_vandelay_init(void)
+CTDL_MODULE_INIT(vandelay)
{
CtdlRegisterProtoHook(cmd_artv, "ARTV", "import/export data store");
+
+ /* return our Subversion id for the Log */
return "$Id$";
}