From bafbad99f6756082316588720234f598022d4207 Mon Sep 17 00:00:00 2001 From: Andrew Pamment Date: Thu, 23 Mar 2017 08:35:00 +1000 Subject: [PATCH] Added broadcasting support to magimail --- utils/magimail/doc/example.prefs | 6 ++++++ utils/magimail/src/Makefile.linux | 6 +++++- utils/magimail/src/magimail/config.c | 31 +++++++++++++++++++++++++++- utils/magimail/src/magimail/config.h | 8 +++++-- utils/magimail/src/magimail/toss.c | 10 ++++++--- 5 files changed, 54 insertions(+), 7 deletions(-) diff --git a/utils/magimail/doc/example.prefs b/utils/magimail/doc/example.prefs index fd6e289..75f1dd5 100644 --- a/utils/magimail/doc/example.prefs +++ b/utils/magimail/doc/example.prefs @@ -13,6 +13,12 @@ SYSOP "Johan Billing" +BBSNAME "Cauldron BBS" + +; BROADCAST
+ +;BROADCAST 192.168.1.255 2027 + ; LOGFILE ; LOGLEVEL ; diff --git a/utils/magimail/src/Makefile.linux b/utils/magimail/src/Makefile.linux index 967eca6..9746431 100644 --- a/utils/magimail/src/Makefile.linux +++ b/utils/magimail/src/Makefile.linux @@ -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 diff --git a/utils/magimail/src/magimail/config.c b/utils/magimail/src/magimail/config.c index f70e4b5..b443c02 100644 --- a/utils/magimail/src/magimail/config.c +++ b/utils/magimail/src/magimail/config.c @@ -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; diff --git a/utils/magimail/src/magimail/config.h b/utils/magimail/src/magimail/config.h index bc76b4f..79032bc 100644 --- a/utils/magimail/src/magimail/config.h +++ b/utils/magimail/src/magimail/config.h @@ -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; diff --git a/utils/magimail/src/magimail/toss.c b/utils/magimail/src/magimail/toss.c index d8fc48f..52ab040 100644 --- a/utils/magimail/src/magimail/toss.c +++ b/utils/magimail/src/magimail/toss.c @@ -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");