Fixes for hubs
This commit is contained in:
parent
b5e5f8705b
commit
539291b54d
2
dist/config/mnet.cfg.example
vendored
2
dist/config/mnet.cfg.example
vendored
@ -1,5 +1,7 @@
|
||||
MYNODE 1
|
||||
|
||||
IMHUB TRUE
|
||||
|
||||
INDIR /home/andrew/MagickaBBS/mnet/in
|
||||
OUTDIR /home/andrew/MagickaBBS/mnet/out
|
||||
|
||||
|
@ -10,6 +10,8 @@
|
||||
char *baseindir = NULL;
|
||||
char *baseoutdir = NULL;
|
||||
|
||||
int imhub = 0;
|
||||
|
||||
struct msgarea_t {
|
||||
int id;
|
||||
char *basedir;
|
||||
@ -133,8 +135,12 @@ int parse_config_file(char *filename) {
|
||||
if (buffer[0] != ';') {
|
||||
if (buffer[strlen(buffer) - 1] == '\n'){
|
||||
buffer[strlen(buffer) - 1] = '\0';
|
||||
|
||||
if (strncasecmp(buffer, "INDIR", 5) == 0) {
|
||||
if (strncasecmp(buffer, "IMHUB", 5) == 0) {
|
||||
trimwhitespace(bufferw, 256, &buffer[6]);
|
||||
if (strcasecmp(bufferw, "TRUE") == 0) {
|
||||
imhub = 1;
|
||||
}
|
||||
} else if (strncasecmp(buffer, "INDIR", 5) == 0) {
|
||||
trimwhitespace(bufferw, 256, &buffer[6]);
|
||||
baseindir = strdup(bufferw);
|
||||
} else if (strncasecmp(buffer, "OUTDIR", 6) == 0) {
|
||||
@ -290,21 +296,23 @@ int import(char *filename) {
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0;i<areas[areaid]->link_count;i++) {
|
||||
if (areas[areaid]->links[i] == msg.oaddr) {
|
||||
continue;
|
||||
}
|
||||
snprintf(buffer2, PATH_MAX, "%s/%d/", baseoutdir, areas[areaid]->links[i]);
|
||||
if (stat(buffer2, &st) != 0) {
|
||||
if (mkdir(buffer2, 0755) != 0) {
|
||||
fprintf(stderr, "Error making directory %s\n", buffer2);
|
||||
if (imhub) {
|
||||
for (i=0;i<areas[areaid]->link_count;i++) {
|
||||
if (areas[areaid]->links[i] == msg.oaddr) {
|
||||
continue;
|
||||
}
|
||||
snprintf(buffer2, PATH_MAX, "%s/%d/", baseoutdir, areas[areaid]->links[i]);
|
||||
if (stat(buffer2, &st) != 0) {
|
||||
if (mkdir(buffer2, 0755) != 0) {
|
||||
fprintf(stderr, "Error making directory %s\n", buffer2);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
snprintf(buffer2, PATH_MAX, "%s/%d/%s", baseoutdir, areas[areaid]->links[i], filename);
|
||||
copy_file(buffer, buffer2);
|
||||
}
|
||||
snprintf(buffer2, PATH_MAX, "%s/%d/%s", baseoutdir, areas[areaid]->links[i], filename);
|
||||
copy_file(buffer, buffer2);
|
||||
}
|
||||
|
||||
|
||||
ret = isdupe(&msg, uuid);
|
||||
if (ret == -1) {
|
||||
free(body);
|
||||
|
Reference in New Issue
Block a user