/*
* citadel_dirs.c : calculate pathnames for various files used in the Citadel system
*
- * Copyright (c) 1987-2012 by the citadel.org team
+ * Copyright (c) 1987-2014 by the citadel.org team
*
* This program is open source software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3.
#include <ctype.h>
#include <string.h>
#include <limits.h>
-
-#if TIME_WITH_SYS_TIME
-# include <sys/time.h>
-# include <time.h>
-#else
-# if HAVE_SYS_TIME_H
-# include <sys/time.h>
-# else
-# include <time.h>
-# endif
-#endif
-
+#include <time.h>
#include <errno.h>
#include <libcitadel.h>
-
-
#include "citadel.h"
/* our directories... */
char ctdl_spool_dir[PATH_MAX]="network";
char ctdl_netout_dir[PATH_MAX]="network/spoolout";
char ctdl_netin_dir[PATH_MAX]="network/spoolin";
+char ctdl_netdigest_dir[PATH_MAX]="network/digest";
char ctdl_nettmp_dir[PATH_MAX]="network/spooltmp";
char ctdl_netcfg_dir[PATH_MAX]="netconfigs";
char ctdl_utilbin_dir[PATH_MAX]="";
/* some of our files, that are needed in several places */
char file_citadel_control[PATH_MAX]="";
-char file_citadel_rc[PATH_MAX]="";
char file_citadel_config[PATH_MAX]="";
char file_citadel_urlshorteners[PATH_MAX]="";
char file_lmtp_socket[PATH_MAX]="";
COMPUTE_DIRECTORY(ctdl_spool_dir);
COMPUTE_DIRECTORY(ctdl_netout_dir);
COMPUTE_DIRECTORY(ctdl_netin_dir);
+ COMPUTE_DIRECTORY(ctdl_netdigest_dir);
COMPUTE_DIRECTORY(ctdl_nettmp_dir);
StripSlashes(ctdl_spool_dir, 1);
StripSlashes(ctdl_netout_dir, 1);
StripSlashes(ctdl_netin_dir, 1);
+ StripSlashes(ctdl_netdigest_dir, 1);
StripSlashes(ctdl_nettmp_dir, 1);
/* ok, now we know the dirs, calc some commonly used files */
"%scitadel.config",
ctdl_autoetc_dir);
StripSlashes(file_citadel_config, 0);
- snprintf(file_citadel_rc,
- sizeof file_citadel_rc,
- "%scitadel.rc",
- ctdl_etc_dir);
- StripSlashes(file_citadel_rc, 0);
snprintf(file_citadel_urlshorteners,
sizeof file_citadel_urlshorteners,
"%scitadel_urlshorteners.rc",
DBG_PRINT(ctdl_spool_dir);
DBG_PRINT(ctdl_netout_dir);
DBG_PRINT(ctdl_netin_dir);
+ DBG_PRINT(ctdl_netdigest_dir);
DBG_PRINT(ctdl_nettmp_dir);
DBG_PRINT(ctdl_netcfg_dir);
DBG_PRINT(ctdl_bbsbase_dir);
DBG_PRINT(ctdl_bin_dir);
DBG_PRINT(ctdl_utilbin_dir);
DBG_PRINT(file_citadel_control);
- DBG_PRINT(file_citadel_rc);
DBG_PRINT(file_citadel_config);
DBG_PRINT(file_lmtp_socket);
DBG_PRINT(file_lmtp_unfiltered_socket);
return snprintf(buf, n, "%s%ld", prefix, qrbuf->QRnumber);
}
+void remove_digest_file(struct ctdlroom *room)
+{
+ char buf[PATH_MAX];
+
+ snprintf(buf, PATH_MAX, "%s/%ld.eml",
+ ctdl_netdigest_dir,
+ room->QRnumber);
+ StripSlashes(buf, 0);
+ fprintf(stderr, "----> %s \n", buf);
+ unlink(buf);
+}
+
+FILE *create_digest_file(struct ctdlroom *room)
+{
+ char buf[PATH_MAX];
+ FILE *fp;
+
+ snprintf(buf, PATH_MAX, "%s/%ld.eml",
+ ctdl_netdigest_dir,
+ room->QRnumber);
+ StripSlashes(buf, 0);
+ fprintf(stderr, "----> %s \n", buf);
+
+ fp = fopen(buf, "w+");
+ if (fp == NULL) {
+
+ }
+ return fp;
+}
+
int create_dir(char *which, long ACCESS, long UID, long GID)
{
rv = create_dir(ctdl_info_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1);
if (rv != -1)
- rv = create_dir(ctdl_bio_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1);
+ rv = create_dir(ctdl_bio_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1);
+ if (rv != -1)
+ rv = create_dir(ctdl_usrpic_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1);
+ if (rv != -1)
+ rv = create_dir(ctdl_message_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1);
+ if (rv != -1)
+ rv = create_dir(ctdl_hlp_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1);
+ if (rv != -1)
+ rv = create_dir(ctdl_image_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1);
+ if (rv != -1)
+ rv = create_dir(ctdl_bb_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1);
if (rv != -1)
- rv = create_dir(ctdl_usrpic_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1);
+ rv = create_dir(ctdl_file_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1);
if (rv != -1)
- rv = create_dir(ctdl_message_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1);
+ rv = create_dir(ctdl_netcfg_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1);
if (rv != -1)
- rv = create_dir(ctdl_hlp_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1);
+ rv = create_dir(ctdl_spool_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1);
if (rv != -1)
- rv = create_dir(ctdl_image_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1);
+ rv = create_dir(ctdl_netout_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1);
if (rv != -1)
- rv = create_dir(ctdl_bb_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1);
+ rv = create_dir(ctdl_netin_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1);
if (rv != -1)
- rv = create_dir(ctdl_file_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1);
+ rv = create_dir(ctdl_netdigest_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1);
if (rv != -1)
- rv = create_dir(ctdl_netcfg_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1);
+ rv = create_dir(ctdl_nettmp_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1);
if (rv != -1)
- rv = create_dir(ctdl_key_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1);
+ rv = create_dir(ctdl_key_dir , S_IRUSR|S_IWUSR|S_IXUSR, UID, -1);
if (rv != -1)
- rv = create_dir(ctdl_run_dir , S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH, UID, GID);
+ rv = create_dir(ctdl_run_dir , S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH, UID, GID);
return rv;
}