Added broadcasting support to magimail

This commit is contained in:
Andrew Pamment 2017-03-23 08:35:00 +10:00
parent 7b2d13d15a
commit bafbad99f6
5 changed files with 54 additions and 7 deletions

View File

@ -13,6 +13,12 @@
SYSOP "Johan Billing" SYSOP "Johan Billing"
BBSNAME "Cauldron BBS"
; BROADCAST <address> <port>
;BROADCAST 192.168.1.255 2027
; LOGFILE <filename> ; LOGFILE <filename>
; LOGLEVEL <level> ; LOGLEVEL <level>
; ;

View File

@ -75,7 +75,8 @@ CMOBJS = $(OBJDIR)/magimail.o \
$(OBJDIR)/scan.o \ $(OBJDIR)/scan.o \
$(OBJDIR)/outbound.o \ $(OBJDIR)/outbound.o \
$(OBJDIR)/filter.o \ $(OBJDIR)/filter.o \
$(OBJDIR)/areafix.o $(OBJDIR)/areafix.o \
$(OBJDIR)/broadcast.o
files : $(BINDIR)/magimail$(EXESUFFIX) \ files : $(BINDIR)/magimail$(EXESUFFIX) \
$(BINDIR)/magistats$(EXESUFFIX) \ $(BINDIR)/magistats$(EXESUFFIX) \
@ -120,6 +121,9 @@ $(BINDIR)/magilistout$(EXESUFFIX) : tools/magilistout.c $(SHOBJS) $(OSLIB)
# magimail # magimail
$(OBJDIR)/broadcast.o : magimail/broadcast.c
$(CC) -c magimail/broadcast.c -o $(OBJDIR)/broadcast.o
$(OBJDIR)/magimail.o : magimail/magimail.c $(OBJDIR)/magimail.o : magimail/magimail.c
$(CC) -c magimail/magimail.c -o $(OBJDIR)/magimail.o $(CC) -c magimail/magimail.c -o $(OBJDIR)/magimail.o

View File

@ -96,6 +96,7 @@ bool ReadConfig(char *filename,struct Config *cfg,short *seconderr,uint32_t *cfg
jbNewList(&LastAka->AddList); jbNewList(&LastAka->AddList);
jbNewList(&LastAka->RemList); jbNewList(&LastAka->RemList);
} }
else if(stricmp(cfgword,"ADDNODE")==0) else if(stricmp(cfgword,"ADDNODE")==0)
{ {
if(!LastAka) if(!LastAka)
@ -192,6 +193,24 @@ bool ReadConfig(char *filename,struct Config *cfg,short *seconderr,uint32_t *cfg
} }
} }
else if (stricmp(cfgword, "BROADCAST") == 0)
{
if(!(jbstrcpy(buf2,cfgbuf,20,&jbcpos)))
{
strcpy(cfgerr,"Missing argument");
osClose(cfgfh);
return(FALSE);
}
strncpy(cfg->broadcastAddr, buf2, 20);
if(!(jbstrcpy(buf2,cfgbuf,6,&jbcpos)))
{
strcpy(cfgerr,"Missing argument");
osClose(cfgfh);
return(FALSE);
}
cfg->broadcastPort = atoi(buf2);
}
else if(stricmp(cfgword,"NODE")==0) else if(stricmp(cfgword,"NODE")==0)
{ {
if(!(tmpnode=(struct ConfigNode *)osAllocCleared(sizeof(struct ConfigNode)))) if(!(tmpnode=(struct ConfigNode *)osAllocCleared(sizeof(struct ConfigNode))))
@ -890,6 +909,15 @@ bool ReadConfig(char *filename,struct Config *cfg,short *seconderr,uint32_t *cfg
return(FALSE); return(FALSE);
} }
} }
else if(stricmp(cfgword,"BBSNAME")==0)
{
if(!(jbstrcpy(cfg->cfg_bbsname,cfgbuf,35,&jbcpos)))
{
strcpy(cfgerr,"Missing argument");
osClose(cfgfh);
return(FALSE);
}
}
else if(stricmp(cfgword,"BEFORETOSS")==0) else if(stricmp(cfgword,"BEFORETOSS")==0)
{ {
if(!(jbstrcpy(cfg->cfg_BeforeToss,cfgbuf,79,&jbcpos))) if(!(jbstrcpy(cfg->cfg_BeforeToss,cfgbuf,79,&jbcpos)))
@ -1910,7 +1938,8 @@ void InitConfig(struct Config *cfg)
memset(cfg,0,sizeof(struct Config)); memset(cfg,0,sizeof(struct Config));
strcpy(cfg->cfg_Sysop,"Sysop"); strcpy(cfg->cfg_Sysop,"Sysop");
strcpy(cfg->cfg_bbsname, "MagickaBBS");
cfg->cfg_LogLevel=3; cfg->cfg_LogLevel=3;
cfg->cfg_DupeSize=10000; cfg->cfg_DupeSize=10000;

View File

@ -175,7 +175,8 @@ struct ConfigNode
struct jbList RemoteAFList; struct jbList RemoteAFList;
char LastArcName[12]; char LastArcName[12];
/* Stats */ /* Stats */
uint32_t GotNetmails; uint32_t GotNetmails;
@ -301,7 +302,7 @@ struct Config
{ {
bool changed; bool changed;
char filename[100]; char filename[100];
char cfg_bbsname[36];
char cfg_Sysop[36]; char cfg_Sysop[36];
char cfg_Inbound[100]; char cfg_Inbound[100];
char cfg_Outbound[100]; char cfg_Outbound[100];
@ -326,6 +327,9 @@ struct Config
uint16_t cfg_DupeMode; uint16_t cfg_DupeMode;
uint16_t cfg_LoopMode; uint16_t cfg_LoopMode;
uint32_t cfg_DefaultZone; uint32_t cfg_DefaultZone;
char broadcastAddr[21];
int broadcastPort;
struct jbList AkaList; struct jbList AkaList;
struct jbList AreaList; struct jbList AreaList;
struct jbList CNodeList; struct jbList CNodeList;

View File

@ -1,4 +1,5 @@
#include "magimail.h" #include "magimail.h"
#include "broadcast.h"
bool Compare(char *str,char *recog) bool Compare(char *str,char *recog)
{ {
@ -62,11 +63,14 @@ void LogTossResults(void)
if(ctrlc) if(ctrlc)
return; return;
if(area->NewDupes) if(area->NewDupes) {
LogWrite(3,TOSSINGINFO,"Area %s -- %u messages (%u dupes)",area->Tagname,area->NewTexts,area->NewDupes); LogWrite(3,TOSSINGINFO,"Area %s -- %u messages (%u dupes)",area->Tagname,area->NewTexts,area->NewDupes);
broadcast("Tossed: Area %s: %u msgs (%u dupes)", area->Tagname,area->NewTexts,area->NewDupes);
else if(area->NewTexts) }
else if(area->NewTexts) {
LogWrite(3,TOSSINGINFO,"Area %s -- %u messages",area->Tagname,area->NewTexts); LogWrite(3,TOSSINGINFO,"Area %s -- %u messages",area->Tagname,area->NewTexts);
broadcast("Tossed: Area %s: %u msgs", area->Tagname,area->NewTexts);
}
} }
printf("\n"); printf("\n");