Fixes for hubs

This commit is contained in:
Andrew Pamment 2018-05-23 15:38:00 +10:00
parent b5e5f8705b
commit 539291b54d
2 changed files with 23 additions and 13 deletions

View File

@ -1,5 +1,7 @@
MYNODE 1 MYNODE 1
IMHUB TRUE
INDIR /home/andrew/MagickaBBS/mnet/in INDIR /home/andrew/MagickaBBS/mnet/in
OUTDIR /home/andrew/MagickaBBS/mnet/out OUTDIR /home/andrew/MagickaBBS/mnet/out

View File

@ -10,6 +10,8 @@
char *baseindir = NULL; char *baseindir = NULL;
char *baseoutdir = NULL; char *baseoutdir = NULL;
int imhub = 0;
struct msgarea_t { struct msgarea_t {
int id; int id;
char *basedir; char *basedir;
@ -133,8 +135,12 @@ int parse_config_file(char *filename) {
if (buffer[0] != ';') { if (buffer[0] != ';') {
if (buffer[strlen(buffer) - 1] == '\n'){ if (buffer[strlen(buffer) - 1] == '\n'){
buffer[strlen(buffer) - 1] = '\0'; buffer[strlen(buffer) - 1] = '\0';
if (strncasecmp(buffer, "IMHUB", 5) == 0) {
if (strncasecmp(buffer, "INDIR", 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]); trimwhitespace(bufferw, 256, &buffer[6]);
baseindir = strdup(bufferw); baseindir = strdup(bufferw);
} else if (strncasecmp(buffer, "OUTDIR", 6) == 0) { } else if (strncasecmp(buffer, "OUTDIR", 6) == 0) {
@ -290,6 +296,7 @@ int import(char *filename) {
} }
} }
if (imhub) {
for (i=0;i<areas[areaid]->link_count;i++) { for (i=0;i<areas[areaid]->link_count;i++) {
if (areas[areaid]->links[i] == msg.oaddr) { if (areas[areaid]->links[i] == msg.oaddr) {
continue; continue;
@ -304,6 +311,7 @@ int import(char *filename) {
snprintf(buffer2, PATH_MAX, "%s/%d/%s", baseoutdir, areas[areaid]->links[i], filename); snprintf(buffer2, PATH_MAX, "%s/%d/%s", baseoutdir, areas[areaid]->links[i], filename);
copy_file(buffer, buffer2); copy_file(buffer, buffer2);
} }
}
ret = isdupe(&msg, uuid); ret = isdupe(&msg, uuid);
if (ret == -1) { if (ret == -1) {