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"
BBSNAME "Cauldron BBS"
; BROADCAST <address> <port>
;BROADCAST 192.168.1.255 2027
; LOGFILE <filename>
; LOGLEVEL <level>
;

View File

@ -75,7 +75,8 @@ CMOBJS = $(OBJDIR)/magimail.o \
$(OBJDIR)/scan.o \
$(OBJDIR)/outbound.o \
$(OBJDIR)/filter.o \
$(OBJDIR)/areafix.o
$(OBJDIR)/areafix.o \
$(OBJDIR)/broadcast.o
files : $(BINDIR)/magimail$(EXESUFFIX) \
$(BINDIR)/magistats$(EXESUFFIX) \
@ -120,6 +121,9 @@ $(BINDIR)/magilistout$(EXESUFFIX) : tools/magilistout.c $(SHOBJS) $(OSLIB)
# magimail
$(OBJDIR)/broadcast.o : magimail/broadcast.c
$(CC) -c magimail/broadcast.c -o $(OBJDIR)/broadcast.o
$(OBJDIR)/magimail.o : magimail/magimail.c
$(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->RemList);
}
else if(stricmp(cfgword,"ADDNODE")==0)
{
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)
{
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);
}
}
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)
{
if(!(jbstrcpy(cfg->cfg_BeforeToss,cfgbuf,79,&jbcpos)))
@ -1910,7 +1938,8 @@ void InitConfig(struct Config *cfg)
memset(cfg,0,sizeof(struct Config));
strcpy(cfg->cfg_Sysop,"Sysop");
strcpy(cfg->cfg_bbsname, "MagickaBBS");
cfg->cfg_LogLevel=3;
cfg->cfg_DupeSize=10000;

View File

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

View File

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