AreaMgr and FileMgr messages don't have hardcoded fallback anymore
This commit is contained in:
parent
1c92032427
commit
742d84c9d4
@ -4693,7 +4693,7 @@ v0.33.20 10-Feb-2002
|
||||
newsgroup didn't exist.
|
||||
For points in echomail no seen-by entry is added.
|
||||
The AreaMgr and FileMgr responses and notify messages now use
|
||||
the diesel macro language with fallback to hardcoded replies.
|
||||
the diesel macro language.
|
||||
|
||||
mball:
|
||||
Will not crash anymore when it needs more then 10 minutes to
|
||||
|
@ -37,7 +37,7 @@ export CVSROOT=username@cvs.mbse.sourceforge.net:/cvsroot/mbse
|
||||
|
||||
Install the sources with the followin command:
|
||||
|
||||
cvs co mbsebbs
|
||||
cvs -dusername@cvs.mbse.sourceforge.net:/cvsroot/mbse co mbsebbs
|
||||
|
||||
That will create the directory mbsebbs with all subdirectories. When you made
|
||||
some changes you can commit these from within the directory mbsebbs with:
|
||||
|
@ -230,7 +230,7 @@ FILE *OpenMacro(const char *filename, int Language)
|
||||
}
|
||||
|
||||
if (fi == NULL)
|
||||
Syslog('d', "OpenMacro(%s, %c): not found, using hardcoded", filename, Language);
|
||||
WriteError("OpenMacro(%s, %c): not found", filename, Language);
|
||||
else {
|
||||
Syslog('d', "OpenMacro(%s, %c): using %s", filename, Language, temp);
|
||||
MacroVars("HLMNSTUYZ", "ssssssssd", CFG.www_url, CFG.location, CFG.sysdomain, CFG.bbs_name,
|
||||
|
@ -150,7 +150,7 @@ forward.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib
|
||||
lhash.o: ../lib/libs.h ../lib/clcomm.h lhash.h
|
||||
mbfido.o: ../lib/libs.h ../lib/mbse.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbdupe.h ../lib/dbcfg.h ../lib/dbnode.h ../lib/dbmsgs.h ../lib/dbuser.h ../lib/dbftn.h ../lib/dbtic.h ../lib/msg.h flock.h tosspkt.h pack.h ulock.h tic.h fsort.h scan.h mbfido.h tracker.h notify.h rollover.h hatch.h scannews.h maketags.h makestat.h newspost.h rnews.h backalias.h rfc2ftn.h
|
||||
mkftnhdr.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h atoul.h hash.h aliasdb.h mkftnhdr.h
|
||||
ping.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/msg.h ../lib/msgtext.h ../lib/dbcfg.h ../lib/dbnode.h ../lib/dbtic.h ../lib/dbdupe.h ../lib/dbuser.h ../lib/dbftn.h sendmail.h mgrutil.h postnetmail.h ping.h
|
||||
ping.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/msg.h ../lib/msgtext.h ../lib/dbcfg.h ../lib/dbnode.h ../lib/dbtic.h ../lib/dbdupe.h ../lib/dbuser.h ../lib/dbftn.h sendmail.h postnetmail.h ping.h
|
||||
rfc2ftn.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/mbinet.h ../lib/dbdupe.h ../lib/dbnode.h ../lib/dbmsgs.h ../lib/msg.h ../lib/msgtext.h mkftnhdr.h hash.h rollover.h pack.h postnetmail.h postecho.h rfc2ftn.h
|
||||
storeecho.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/msg.h ../lib/msgtext.h ../lib/dbmsgs.h ../lib/dbuser.h rollover.h storeecho.h
|
||||
ulock.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h flock.h ulock.h
|
||||
@ -203,7 +203,7 @@ virscan.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib
|
||||
mbftoberep.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h mbfutil.h mbftoberep.h
|
||||
mbfmove.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h mbfutil.h mbfmove.h
|
||||
mbfdel.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/dbcfg.h mbfutil.h mbfmove.h
|
||||
bounce.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/msg.h ../lib/msgtext.h ../lib/dbcfg.h ../lib/dbnode.h ../lib/dbtic.h ../lib/dbdupe.h ../lib/dbuser.h ../lib/dbftn.h sendmail.h mgrutil.h postnetmail.h ping.h
|
||||
bounce.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h ../lib/msg.h ../lib/msgtext.h ../lib/dbcfg.h ../lib/dbnode.h ../lib/dbtic.h ../lib/dbdupe.h ../lib/dbuser.h ../lib/dbftn.h sendmail.h postnetmail.h ping.h
|
||||
createm.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h mgrutil.h createm.h
|
||||
createf.o: ../lib/libs.h ../lib/structs.h ../lib/users.h ../lib/records.h ../lib/common.h ../lib/clcomm.h createm.h
|
||||
# End of generated dependencies
|
||||
|
308
mbfido/areamgr.c
308
mbfido/areamgr.c
@ -95,51 +95,15 @@ void A_Help(faddr *t, char *replyid)
|
||||
if ((fi = OpenMacro("areamgr.help", nodes.Language)) != NULL ){
|
||||
MacroVars("sAYP", "ssss", nodes.Sysop, "Areamgr", ascfnode(bestaka_s(t), 0xf), nodes.Apasswd );
|
||||
MacroRead(fi, fp);
|
||||
MacroClear();
|
||||
fclose(fi);
|
||||
}else{
|
||||
fprintf(fp, "Address all requests to '%s' (without quotes)\r", (char *)"Areamgr");
|
||||
fprintf(fp, "Your AreaMgr password goes on the subject line.\r\r");
|
||||
|
||||
fprintf(fp, "In the body of the message to AreaMgr:\r\r");
|
||||
|
||||
fprintf(fp, "+<areaname> To connect to an echomail area\r");
|
||||
fprintf(fp, "-<areaname> To disconnect from an echomail area\r");
|
||||
fprintf(fp, "%%+ALL To connect to all echomail areas\r");
|
||||
fprintf(fp, "%%-ALL To disconnect from all echomail areas\r");
|
||||
fprintf(fp, "%%+<group> To connect all echomail areas of a group\r");
|
||||
fprintf(fp, "%%-<group> To disconnect from all echomail areas of a group\r");
|
||||
fprintf(fp, "%%HELP To request this help message\r");
|
||||
fprintf(fp, "%%LIST To request a list of echomail areas available to you\r");
|
||||
fprintf(fp, "%%QUERY To request a list of echomail areas for which you are active\r");
|
||||
fprintf(fp, "%%UNLINKED To request a list of echomail areas available to you\r");
|
||||
fprintf(fp, " to which you are not already connected\r");
|
||||
fprintf(fp, "%%FLOW To request a flow report of available areas\r");
|
||||
fprintf(fp, "%%STATUS To request a status report for your system\r");
|
||||
fprintf(fp, "%%PAUSE To temporary disconnect from the connected echomail areas\r");
|
||||
fprintf(fp, "%%RESUME To reconnect the temporary disconnected echomail areas\r");
|
||||
fprintf(fp, "%%PWD=newpwd To set a new AreaMgr and FileMgr password\r");
|
||||
fprintf(fp, "%%MSGS <n> To set max. number of messages to be rescanned\r");
|
||||
fprintf(fp, "%%RESCAN <area> To request messages from 'area' again\r");
|
||||
fprintf(fp, "%%NOTIFY=On/Off To switch the notify function on or off\r");
|
||||
fprintf(fp, "[---] Everything below the tearline is ignored\r\r");
|
||||
|
||||
fprintf(fp, "Example:\r\r");
|
||||
|
||||
fprintf(fp, " By: %s\r", nodes.Sysop);
|
||||
fprintf(fp, " To: %s, %s\r", (char *)"Areamgr", ascfnode(bestaka_s(t), 0xf));
|
||||
fprintf(fp, " Re: %s\r", nodes.Apasswd);
|
||||
fprintf(fp, " St: Pvt Local Kill\r");
|
||||
fprintf(fp, " ----------------------------------------------------------\r");
|
||||
fprintf(fp, " +SYSOPS\r");
|
||||
fprintf(fp, " -GENERAL\r");
|
||||
fprintf(fp, " %%QUERY\r");
|
||||
fprintf(fp, " %%LIST\r\r");
|
||||
}
|
||||
|
||||
fprintf(fp, "%s\r", TearLine());
|
||||
CloseMail(fp, t);
|
||||
} else
|
||||
} else {
|
||||
WriteError("Can't create netmail");
|
||||
}
|
||||
|
||||
free(subject);
|
||||
MacroClear();
|
||||
}
|
||||
@ -152,6 +116,8 @@ void A_Query(faddr *t, char *replyid)
|
||||
A_List(t, replyid, LIST_QUERY);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void A_List(faddr *t, char *replyid, int Notify)
|
||||
{
|
||||
FILE *qp, *gp, *mp, *fi = NULL;
|
||||
@ -167,27 +133,34 @@ void A_List(faddr *t, char *replyid, int Notify)
|
||||
f = bestaka_s(t);
|
||||
MacroVars("sKyY", "sdss", nodes.Sysop, Notify, ascfnode(t, 0xff), ascfnode(f, 0xf));
|
||||
|
||||
if (Notify==LIST_NOTIFY){
|
||||
Syslog('+', "AreaMgr: Notify to %s", ascfnode(t, 0xff));
|
||||
switch (Notify) {
|
||||
case LIST_NOTIFY: Syslog('+', "AreaMgr: Notify to %s", ascfnode(t, 0xff));
|
||||
sprintf(subject,"AreaMgr Notify");
|
||||
GetRpSubject("areamgr.notify.list",subject);
|
||||
}
|
||||
if (Notify==LIST_LIST){
|
||||
Syslog('+', "AreaMgr: List");
|
||||
fi = OpenMacro("areamgr.notify.list", nodes.Language);
|
||||
break;
|
||||
case LIST_LIST: Syslog('+', "AreaMgr: List");
|
||||
sprintf(subject,"AreaMgr list");
|
||||
GetRpSubject("areamgr.list",subject);
|
||||
}
|
||||
if (Notify==LIST_QUERY){
|
||||
Syslog('+', "AreaMgr: Query");
|
||||
fi = OpenMacro("areamgr.list", nodes.Language);
|
||||
break;
|
||||
case LIST_QUERY: Syslog('+', "AreaMgr: Query");
|
||||
sprintf(subject,"AreaMgr Query");
|
||||
GetRpSubject("areamgr.query",subject);
|
||||
}
|
||||
if (Notify>=LIST_UNLINK){
|
||||
Syslog('+', "AreaMgr: Unlinked");
|
||||
fi = OpenMacro("areamgr.query", nodes.Language);
|
||||
break;
|
||||
case LIST_UNLINK: Syslog('+', "AreaMgr: Unlinked");
|
||||
sprintf(subject,"AreaMgr: Unlinked areas");
|
||||
GetRpSubject("areamgr.unlink",subject);
|
||||
fi = OpenMacro("areamgr.unlink", nodes.Language);
|
||||
break;
|
||||
}
|
||||
|
||||
if (fi == NULL) {
|
||||
MacroClear();
|
||||
free(subject);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((qp = SendMgrMail(t, CFG.ct_KeepMgr, FALSE, (char *)"Areamgr", subject, replyid)) != NULL) {
|
||||
|
||||
@ -196,24 +169,12 @@ void A_List(faddr *t, char *replyid, int Notify)
|
||||
*/
|
||||
msgptr = ftell(qp);
|
||||
|
||||
if (Notify==LIST_LIST){
|
||||
fi=OpenMacro("areamgr.list", nodes.Language);
|
||||
if ((Notify == LIST_LIST) || (Notify == LIST_NOTIFY))
|
||||
WriteMailGroups(qp, f);
|
||||
}
|
||||
if (Notify==LIST_NOTIFY){
|
||||
fi=OpenMacro("areamgr.notify.list", nodes.Language);
|
||||
WriteMailGroups(qp, f);
|
||||
}
|
||||
if (Notify==LIST_QUERY)
|
||||
fi=OpenMacro("areamgr.query", nodes.Language);
|
||||
if (Notify>=LIST_UNLINK)
|
||||
fi=OpenMacro("areamgr.unlink", nodes.Language);
|
||||
if (fi != NULL){
|
||||
|
||||
MacroRead(fi, qp);
|
||||
fgetpos(fi,&fileptr);
|
||||
}else{
|
||||
fprintf(qp, "The following is a list of message areas\r\r");
|
||||
}
|
||||
|
||||
temp = calloc(PATH_MAX, sizeof(char));
|
||||
sprintf(temp, "%s/etc/mareas.data", getenv("MBSE_ROOT"));
|
||||
if ((mp = fopen(temp, "r")) == NULL) {
|
||||
@ -221,6 +182,7 @@ void A_List(faddr *t, char *replyid, int Notify)
|
||||
free(temp);
|
||||
free(subject);
|
||||
MacroClear();
|
||||
fclose(fi);
|
||||
return;
|
||||
}
|
||||
fread(&msgshdr, sizeof(msgshdr), 1, mp);
|
||||
@ -233,6 +195,7 @@ void A_List(faddr *t, char *replyid, int Notify)
|
||||
free(subject);
|
||||
MacroClear();
|
||||
fclose(mp);
|
||||
fclose(fi);
|
||||
return;
|
||||
}
|
||||
fread(&mgrouphdr, sizeof(mgrouphdr), 1, gp);
|
||||
@ -248,19 +211,12 @@ void A_List(faddr *t, char *replyid, int Notify)
|
||||
while (fread(&mgroup, mgrouphdr.recsize, 1, gp) == 1) {
|
||||
g = bestaka_s(fido2faddr(mgroup.UseAka));
|
||||
if ((!strcmp(mgroup.Name, Group)) &&
|
||||
(g->zone == f->zone) && (g->net == f->net) &&
|
||||
(g->node == f->node) && (g->point == f->point)) {
|
||||
(g->zone == f->zone) && (g->net == f->net) && (g->node == f->node) && (g->point == f->point)) {
|
||||
SubTot = 0;
|
||||
if (fi != NULL){
|
||||
MacroVars("GJI", "sss",mgroup.Name, mgroup.Comment, aka2str(mgroup.UseAka) );
|
||||
fsetpos(fi,&fileptr);
|
||||
MacroRead(fi, qp);
|
||||
fgetpos(fi,&fileptr1);
|
||||
}else{
|
||||
fprintf(qp, "Group %s - %s (%s)\r\r", mgroup.Name, mgroup.Comment, aka2str(mgroup.UseAka));
|
||||
fprintf(qp, "Con Message area Description\r");
|
||||
fprintf(qp, "----------------------------------------------------------------------------\r");
|
||||
}
|
||||
fseek(mp, msgshdr.hdrsize, SEEK_SET);
|
||||
|
||||
while (fread(&msgs, msgshdr.recsize, 1, mp) == 1) {
|
||||
@ -285,11 +241,9 @@ void A_List(faddr *t, char *replyid, int Notify)
|
||||
Stat[3] = 'C';
|
||||
}
|
||||
}
|
||||
if ( (Notify == LIST_LIST)
|
||||
|| (Notify == LIST_NOTIFY)
|
||||
if ( (Notify == LIST_LIST) || (Notify == LIST_NOTIFY)
|
||||
|| ((Notify == LIST_QUERY) && ((Stat[0]=='S') || (Stat[1]=='R')))
|
||||
|| ((Notify >= LIST_UNLINK) && ((Stat[0]!='S') && (Stat[1]!='R')))){
|
||||
if (fi !=NULL){
|
||||
MacroVars("XDEsrpc", "sssdddd",
|
||||
Stat, msgs.Tag, msgs.Name,
|
||||
(Stat[0] == 'S'),
|
||||
@ -300,16 +254,12 @@ void A_List(faddr *t, char *replyid, int Notify)
|
||||
fsetpos(fi,&fileptr1);
|
||||
MacroRead(fi, qp);
|
||||
fgetpos(fi,&fileptr2);
|
||||
}else{
|
||||
fprintf(qp, "%s %-25s %s\r", Stat, msgs.Tag, msgs.Name);
|
||||
}
|
||||
SubTot++;
|
||||
Total++;
|
||||
}
|
||||
} else
|
||||
fseek(mp, msgshdr.syssize, SEEK_CUR);
|
||||
}
|
||||
if (fi != NULL){
|
||||
MacroVars("ZC", "dd", (int) 0 , SubTot );
|
||||
fsetpos(fi,&fileptr2);
|
||||
if (((ftell(qp) - msgptr) / 1024) >= CFG.new_split) {
|
||||
@ -320,36 +270,14 @@ void A_List(faddr *t, char *replyid, int Notify)
|
||||
msgptr = ftell(qp);
|
||||
}
|
||||
MacroRead(fi, qp);
|
||||
}else{
|
||||
fprintf(qp, "----------------------------------------------------------------------------\r");
|
||||
fprintf(qp, "%d area(s)\r\r\r", SubTot);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (((ftell(qp) - msgptr) / 1024) >= CFG.new_split) {
|
||||
fprintf(qp, "To be continued....\r\r");
|
||||
Syslog('-', " Splitting message at %ld bytes", ftell(qp) - msgptr);
|
||||
CloseMail(qp, t);
|
||||
qp = SendMgrMail(t, CFG.ct_KeepMgr, FALSE, (char *)"Areamgr", subject, replyid);
|
||||
msgptr = ftell(qp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (fi != NULL){
|
||||
MacroVars("B", "d", Total );
|
||||
MacroRead(fi, qp);
|
||||
MacroClear();
|
||||
fclose(fi);
|
||||
}else{
|
||||
fprintf(qp, "Total: %d available area(s)\r\r\r", Total);
|
||||
|
||||
fprintf(qp, "Con means:\r");
|
||||
fprintf(qp, " R - You receive mail from my system\r");
|
||||
fprintf(qp, " S - You may send mail to my system\r");
|
||||
fprintf(qp, " P - The message area is temporary paused\r");
|
||||
fprintf(qp, " C - You are cutoff from this area\r\r");
|
||||
fprintf(qp, "With regards, %s\r\r", CFG.sysop_name);
|
||||
}
|
||||
fclose(mp);
|
||||
fclose(gp);
|
||||
fprintf(qp, "%s\r", TearLine());
|
||||
@ -393,18 +321,21 @@ void A_Flow(faddr *t, char *replyid, int Notify)
|
||||
Syslog('+', "AreaMgr: Flow report to %s", ascfnode(t, 0xff));
|
||||
sprintf(subject,"AreaMgr Notify Flow Report");
|
||||
GetRpSubject("areamgr.notify.flow",subject);
|
||||
fi = OpenMacro("areamgr.notify.flow", nodes.Language);
|
||||
}else{
|
||||
Syslog('+', "AreaMgr: Flow report");
|
||||
sprintf(subject,"AreaMgr Flow Report");
|
||||
GetRpSubject("areamgr.flow",subject);
|
||||
fi = OpenMacro("areamgr.flow", nodes.Language);
|
||||
}
|
||||
|
||||
if (fi == 0) {
|
||||
free(subject);
|
||||
MacroClear();
|
||||
return;
|
||||
}
|
||||
|
||||
if ((qp = SendMgrMail(t, CFG.ct_KeepMgr, FALSE, (char *)"Areamgr", subject, replyid)) != NULL) {
|
||||
if (Notify) {
|
||||
fi = OpenMacro("areamgr.notify.flow", nodes.Language);
|
||||
} else {
|
||||
fi = OpenMacro("areamgr.flow", nodes.Language);
|
||||
}
|
||||
/*
|
||||
* Mark begin of message in .pkt
|
||||
*/
|
||||
@ -416,10 +347,8 @@ void A_Flow(faddr *t, char *replyid, int Notify)
|
||||
WriteError("$Can't open %s", temp);
|
||||
free(temp);
|
||||
free(subject);
|
||||
if (fi) {
|
||||
fclose(fi);
|
||||
MacroClear();
|
||||
}
|
||||
return;
|
||||
}
|
||||
fread(&msgshdr, sizeof(msgshdr), 1, mp);
|
||||
@ -431,20 +360,16 @@ void A_Flow(faddr *t, char *replyid, int Notify)
|
||||
free(temp);
|
||||
free(subject);
|
||||
fclose(mp);
|
||||
if (fi) {
|
||||
fclose(fi);
|
||||
MacroClear();
|
||||
}
|
||||
return;
|
||||
}
|
||||
fread(&mgrouphdr, sizeof(mgrouphdr), 1, gp);
|
||||
free(temp);
|
||||
if (fi != NULL){
|
||||
|
||||
MacroRead(fi, qp);
|
||||
fgetpos(fi,&fileptr);
|
||||
}else{
|
||||
fprintf(qp, "The following is a flow report of all message areas\r\r");
|
||||
}
|
||||
|
||||
while (TRUE) {
|
||||
Group = GetNodeMailGrp(First);
|
||||
if (Group == NULL)
|
||||
@ -456,19 +381,12 @@ void A_Flow(faddr *t, char *replyid, int Notify)
|
||||
while (fread(&mgroup, mgrouphdr.recsize, 1, gp) == 1) {
|
||||
g = bestaka_s(fido2faddr(mgroup.UseAka));
|
||||
if ((!strcmp(mgroup.Name, Group)) &&
|
||||
(g->zone == f->zone) && (g->net == f->net) &&
|
||||
(g->node == f->node) && (g->point == f->point)) {
|
||||
(g->zone == f->zone) && (g->net == f->net) && (g->node == f->node) && (g->point == f->point)) {
|
||||
|
||||
if (fi != NULL){
|
||||
MacroVars("GJI", "sss",mgroup.Name, mgroup.Comment, aka2str(mgroup.UseAka) );
|
||||
fsetpos(fi,&fileptr);
|
||||
MacroRead(fi, qp);
|
||||
fgetpos(fi,&fileptr1);
|
||||
}else{
|
||||
fprintf(qp, "Group %s - %s\r\r", mgroup.Name, mgroup.Comment);
|
||||
fprintf(qp, "Con Message area Last week Last Month\r");
|
||||
fprintf(qp, "---------------------------------------------------------------------------\r");
|
||||
}
|
||||
fseek(mp, msgshdr.hdrsize, SEEK_SET);
|
||||
|
||||
while (fread(&msgs, msgshdr.recsize, 1, mp) == 1) {
|
||||
@ -487,7 +405,6 @@ void A_Flow(faddr *t, char *replyid, int Notify)
|
||||
Stat[0] = 'C';
|
||||
}
|
||||
}
|
||||
if (fi !=NULL){
|
||||
MacroVars("XAPQRpqrx", "csddddddd",
|
||||
Stat[0],
|
||||
msgs.Tag,
|
||||
@ -502,10 +419,6 @@ void A_Flow(faddr *t, char *replyid, int Notify)
|
||||
fsetpos(fi,&fileptr1);
|
||||
MacroRead(fi, qp);
|
||||
fgetpos(fi,&fileptr2);
|
||||
}else{
|
||||
fprintf(qp, "%s %s %9lu %10lu\r", Stat, padleft(msgs.Tag, 50, ' '),
|
||||
msgs.Received.lweek, msgs.Received.month[lmonth]);
|
||||
}
|
||||
rlm += msgs.Received.month[lmonth];
|
||||
rlw += msgs.Received.lweek;
|
||||
rlt += msgs.Received.total;
|
||||
@ -515,7 +428,6 @@ void A_Flow(faddr *t, char *replyid, int Notify)
|
||||
} else
|
||||
fseek(mp, msgshdr.syssize, SEEK_CUR);
|
||||
}
|
||||
if (fi != NULL){
|
||||
MacroVars("ZBCDbcd", "ddddddd", (int) 0 , rlw, rlm, rlt, plw, plm, plt);
|
||||
fsetpos(fi,&fileptr2);
|
||||
if (((ftell(qp) - msgptr) / 1024) >= CFG.new_split) {
|
||||
@ -526,33 +438,14 @@ void A_Flow(faddr *t, char *replyid, int Notify)
|
||||
msgptr = ftell(qp);
|
||||
}
|
||||
MacroRead(fi, qp);
|
||||
}else{
|
||||
fprintf(qp, "---------------------------------------------------------------------------\r");
|
||||
fprintf(qp, "Total %58lu %10lu\r\r\r", rlw, rlm);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (((ftell(qp) - msgptr) / 1024) >= CFG.new_split) {
|
||||
fprintf(qp, "To be continued....\r\r");
|
||||
Syslog('-', " Splitting message at %ld bytes", ftell(qp) - msgptr);
|
||||
CloseMail(qp, t);
|
||||
qp = SendMgrMail(t, CFG.ct_KeepMgr, FALSE, (char *)"Areamgr", subject, replyid);
|
||||
msgptr = ftell(qp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (fi != NULL){
|
||||
MacroRead(fi, qp);
|
||||
MacroClear();
|
||||
fclose(fi);
|
||||
}else{
|
||||
fprintf(qp, "Con means:\r");
|
||||
fprintf(qp, " C - You connected to this area\r");
|
||||
fprintf(qp, "With regards, %s\r\r", CFG.sysop_name);
|
||||
fprintf(qp, "%s\r", TearLine());
|
||||
}
|
||||
CloseMail(qp, t);
|
||||
|
||||
fclose(mp);
|
||||
fclose(gp);
|
||||
} else
|
||||
@ -594,30 +487,17 @@ void A_Status(faddr *t, char *replyid)
|
||||
ascfnode(bestaka_s(t), 0xf)
|
||||
);
|
||||
GetRpSubject("areamgr.status",subject);
|
||||
|
||||
Syslog('+', "AreaMgr: Status");
|
||||
|
||||
if ((fi = OpenMacro("areamgr.status", nodes.Language)) == NULL ){
|
||||
MacroClear();
|
||||
free(subject);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((fp = SendMgrMail(t, CFG.ct_KeepMgr, FALSE, (char *)"Areamgr", subject, replyid)) != NULL) {
|
||||
if ( (fi=OpenMacro("areamgr.status", nodes.Language)) != NULL ){
|
||||
MacroRead(fi, fp);
|
||||
fclose(fi);
|
||||
}else{
|
||||
fprintf(fp, "Here is your (echo)mail status:\r\r");
|
||||
fprintf(fp, "Netmail direct %s\r", GetBool(nodes.Direct));
|
||||
fprintf(fp, "Netmail crash %s\r", GetBool(nodes.Crash));
|
||||
fprintf(fp, "Netmail hold %s\r", GetBool(nodes.Hold));
|
||||
if (nodes.RouteVia.zone)
|
||||
fprintf(fp, "Route via %s\r", aka2str(nodes.RouteVia));
|
||||
fprintf(fp, "\r\rMailflow:\r\r");
|
||||
fprintf(fp, " Last week Last month Total ever\r");
|
||||
fprintf(fp, " ---------- ---------- ----------\r");
|
||||
fprintf(fp, "Messages to you %-10ld %-10ld %-10ld\r", nodes.MailSent.lweek,
|
||||
nodes.MailSent.month[i], nodes.MailSent.total);
|
||||
fprintf(fp, "Messages from you %-10ld %-10ld %-10ld\r", nodes.MailRcvd.lweek,
|
||||
nodes.MailRcvd.month[i], nodes.MailRcvd.total);
|
||||
|
||||
fprintf(fp, "\rWith regards, %s\r\r", CFG.sysop_name);
|
||||
}
|
||||
fprintf(fp, "%s\r", TearLine());
|
||||
CloseMail(fp, t);
|
||||
} else
|
||||
@ -652,8 +532,7 @@ void A_Disconnect(faddr *t, char *Area, FILE *tmp)
|
||||
if (!SearchMsgs(Area)) {
|
||||
MacroVars("SsP", "sss", CFG.sysop_name, nodes.Sysop, "Areamgr");
|
||||
MacroVars("RABCDE", "ssssss","ERR_DISC_NOTFOUND",Area,"","","","");
|
||||
if (!MsgResult("areamgr.responses",tmp))
|
||||
fprintf(tmp, "Area %s not found\n", Area);
|
||||
MsgResult("areamgr.responses",tmp);
|
||||
Syslog('+', " Area not found");
|
||||
MacroClear();
|
||||
return;
|
||||
@ -670,8 +549,7 @@ void A_Disconnect(faddr *t, char *Area, FILE *tmp)
|
||||
if (Group == NULL) {
|
||||
MacroVars("SsP", "sss", CFG.sysop_name, nodes.Sysop, "Areamgr");
|
||||
MacroVars("RABCDE", "ssssss","ERR_DISC_NOTGROUP",Area,"","","","");
|
||||
if (!MsgResult("areamgr.responses",tmp))
|
||||
fprintf(tmp, "You may not disconnect from area %s\n", Area);
|
||||
MsgResult("areamgr.responses",tmp);
|
||||
Syslog('+', " Group %s not available for %s", mgroup.Name, ascfnode(t, 0x1f));
|
||||
MacroClear();
|
||||
return;
|
||||
@ -684,8 +562,7 @@ void A_Disconnect(faddr *t, char *Area, FILE *tmp)
|
||||
if (i >= METRIC_NET) {
|
||||
MacroVars("SsP", "sss", CFG.sysop_name, nodes.Sysop, "Areamgr");
|
||||
MacroVars("RABCDE", "ssssss","ERR_DISC_BADADD",Area,ascfnode(t, 0x1f),"","","");
|
||||
if (!MsgResult("areamgr.responses",tmp))
|
||||
fprintf(tmp, "You may not disconnect area %s with nodenumber %s\n", Area, ascfnode(t, 0x1f));
|
||||
MsgResult("areamgr.responses",tmp);
|
||||
Syslog('+', " %s may not disconnect from group %s", ascfnode(t, 0x1f), mgroup.Name);
|
||||
MacroClear();
|
||||
return;
|
||||
@ -699,8 +576,7 @@ void A_Disconnect(faddr *t, char *Area, FILE *tmp)
|
||||
if (!MsgSystemConnected(Sys)) {
|
||||
MacroVars("SsP", "sss", CFG.sysop_name, nodes.Sysop,"Areamgr");
|
||||
MacroVars("RABCDE", "ssssss","ERR_DISC_NC",Area,"","","","");
|
||||
if (!MsgResult("areamgr.responses",tmp))
|
||||
fprintf(tmp, "You are not connected to %s\n", Area);
|
||||
MsgResult("areamgr.responses",tmp);
|
||||
Syslog('+', " %s is not connected to %s", ascfnode(t, 0x1f), Area);
|
||||
MacroClear();
|
||||
return;
|
||||
@ -715,16 +591,14 @@ void A_Disconnect(faddr *t, char *Area, FILE *tmp)
|
||||
Syslog('+', "Disconnected echo area %s", Area);
|
||||
MacroVars("SsP", "sss", CFG.sysop_name, nodes.Sysop,"Areamgr");
|
||||
MacroVars("RABCDE", "ssssss","OK_DISC",Area,"","","","");
|
||||
if (!MsgResult("areamgr.responses",tmp))
|
||||
fprintf(tmp, "Disconnected from area %s\n", Area);
|
||||
MsgResult("areamgr.responses",tmp);
|
||||
MacroClear();
|
||||
return;
|
||||
}
|
||||
|
||||
MacroVars("SsP", "sss", CFG.sysop_name, nodes.Sysop,"Areamgr");
|
||||
MacroVars("RABCDE", "ssssss","ERR_DISC_NOTAVAIL",Area,"","","","");
|
||||
if (!MsgResult("areamgr.responses",tmp))
|
||||
fprintf(tmp, "You may not disconnect area %s\n", Area);
|
||||
MsgResult("areamgr.responses",tmp);
|
||||
Syslog('+', "Didn't disconnect %s from mandatory or cutoff echo area %s", ascfnode(t, 0x1f), Area);
|
||||
MacroClear();
|
||||
}
|
||||
@ -770,8 +644,7 @@ void A_Connect(faddr *t, char *Area, FILE *tmp)
|
||||
if (CheckEchoGroup(Area, TRUE, t) == 0) {
|
||||
MacroVars("SsP", "sss", CFG.sysop_name, nodes.Sysop,"Areamgr");
|
||||
MacroVars("RABCDE", "ssssss","ERR_CONN_FORWARD",Area,aka2str(mgroup.UpLink),"","","");
|
||||
if (!MsgResult("areamgr.responses",tmp))
|
||||
fprintf(tmp, "Area %s not available, requested from uplink %s\n", Area, aka2str(mgroup.UpLink));
|
||||
MsgResult("areamgr.responses",tmp);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -786,8 +659,7 @@ void A_Connect(faddr *t, char *Area, FILE *tmp)
|
||||
if (!SearchMsgs(Area)) {
|
||||
MacroVars("SsP", "sss", CFG.sysop_name, nodes.Sysop, "Areamgr");
|
||||
MacroVars("RABCDE", "ssssss","ERR_CONN_NOTFOUND",Area,"","","","");
|
||||
if (!MsgResult("areamgr.responses",tmp))
|
||||
fprintf(tmp, "Area %s not found\n", Area);
|
||||
MsgResult("areamgr.responses",tmp);
|
||||
Syslog('+', "Area %s not found", Area);
|
||||
MacroClear();
|
||||
return;
|
||||
@ -805,8 +677,7 @@ void A_Connect(faddr *t, char *Area, FILE *tmp)
|
||||
if (Group == NULL) {
|
||||
MacroVars("SsP", "sss", CFG.sysop_name, nodes.Sysop, "Areamgr");
|
||||
MacroVars("RABCDE", "ssssss","ERR_CONN_NOTGROUP",Area,"","","","");
|
||||
if (!MsgResult("areamgr.responses",tmp))
|
||||
fprintf(tmp, "You may not connect to area %s\n", Area);
|
||||
MsgResult("areamgr.responses",tmp);
|
||||
Syslog('+', " Group %s not available for node %s", mgroup.Name, ascfnode(t, 0x1f));
|
||||
MacroClear();
|
||||
return;
|
||||
@ -819,8 +690,7 @@ void A_Connect(faddr *t, char *Area, FILE *tmp)
|
||||
if (i >= METRIC_NET) {
|
||||
MacroVars("SsP", "sss", CFG.sysop_name, nodes.Sysop,"Areamgr");
|
||||
MacroVars("RABCDE", "ssssss","ERR_CONN_BADADD",Area,ascfnode(t, 0x1f),"","","");
|
||||
if (!MsgResult("areamgr.responses",tmp))
|
||||
fprintf(tmp, "You may not connect area %s with nodenumber %s\n", Area, ascfnode(t, 0x1f));
|
||||
MsgResult("areamgr.responses",tmp);
|
||||
Syslog('+', " %s may not connect to group %s", ascfnode(t, 0x1f), mgroup.Name);
|
||||
MacroClear();
|
||||
return;
|
||||
@ -834,8 +704,7 @@ void A_Connect(faddr *t, char *Area, FILE *tmp)
|
||||
if (MsgSystemConnected(Sys)) {
|
||||
MacroVars("SsP", "sss", CFG.sysop_name, nodes.Sysop,"Areamgr");
|
||||
MacroVars("RABCDE", "ssssss","ERR_CONN_ALREADY",Area,"","","","");
|
||||
if (!MsgResult("areamgr.responses",tmp))
|
||||
fprintf(tmp, "You are already connected to %s\n", Area);
|
||||
MsgResult("areamgr.responses",tmp);
|
||||
Syslog('+', " %s is already connected to %s", ascfnode(t, 0x1f), Area);
|
||||
MacroClear();
|
||||
return;
|
||||
@ -850,15 +719,13 @@ void A_Connect(faddr *t, char *Area, FILE *tmp)
|
||||
Syslog('+', "Connected echo area %s", Area);
|
||||
MacroVars("SsP", "sss", CFG.sysop_name, nodes.Sysop,"Areamgr");
|
||||
MacroVars("RABCDE", "ssssss","OK_CONN",Area,aka2str(msgs.Aka),"","","");
|
||||
if (!MsgResult("areamgr.responses",tmp))
|
||||
fprintf(tmp, "Connected to area %s using aka %s\n", Area, aka2str(msgs.Aka));
|
||||
MsgResult("areamgr.responses",tmp);
|
||||
MacroClear();
|
||||
return;
|
||||
}
|
||||
MacroVars("SsP", "sss", CFG.sysop_name, nodes.Sysop,"Areamgr");
|
||||
MacroVars("RABCDE", "ssssss","ERR_CONN_NOTAVAIL",Area,"","","","");
|
||||
if (!MsgResult("areamgr.responses",tmp))
|
||||
fprintf(tmp, "Not connected to %s, this is not allowed\n", Area);
|
||||
MsgResult("areamgr.responses",tmp);
|
||||
WriteError("Can't connect node %s to echo area %s", ascfnode(t, 0x1f), Area);
|
||||
MacroClear();
|
||||
}
|
||||
@ -951,8 +818,7 @@ void A_All(faddr *t, int Connect, FILE *tmp, char *Grp)
|
||||
Syslog('+', "AreaMgr: Connected %s", msgs.Tag);
|
||||
MacroVars("SsP", "sss", CFG.sysop_name, nodes.Sysop,"Areamgr");
|
||||
MacroVars("RABCDE", "ssssss","OK_CONN",msgs.Tag,aka2str(msgs.Aka),"","","");
|
||||
if (!MsgResult("areamgr.responses",tmp))
|
||||
fprintf(tmp, "Connected area %s using aka %s\n", msgs.Tag, aka2str(msgs.Aka));
|
||||
MsgResult("areamgr.responses",tmp);
|
||||
MacroClear();
|
||||
a_list = TRUE;
|
||||
break;
|
||||
@ -970,8 +836,7 @@ void A_All(faddr *t, int Connect, FILE *tmp, char *Grp)
|
||||
Syslog('+', "AreaMgr: Disconnected %s", msgs.Tag);
|
||||
MacroVars("SsP", "sss", CFG.sysop_name, nodes.Sysop,"Areamgr");
|
||||
MacroVars("RABCDE", "ssssss","OK_DISC",msgs.Tag,"","","","");
|
||||
if (!MsgResult("areamgr.responses",tmp))
|
||||
fprintf(tmp, "Disconnected area %s\n", msgs.Tag);
|
||||
MsgResult("areamgr.responses",tmp);
|
||||
MacroClear();
|
||||
a_list = TRUE;
|
||||
}
|
||||
@ -1042,8 +907,7 @@ void A_Pause(faddr *t, int Pause, FILE *tmp)
|
||||
Syslog('+', "AreaMgr: %s area %s", Pause?"Pause":"Resume", msgs.Tag);
|
||||
MacroVars("SsP", "sss", CFG.sysop_name, nodes.Sysop,"Areamgr");
|
||||
MacroVars("RABCDE", "ssssss","OK_PAUSE",msgs.Tag,ascfnode(t, 0x1f),"","");
|
||||
if (!MsgResult("areamgr.responses",tmp))
|
||||
fprintf(tmp, "%s area %s\n", Pause?"Pause":"Resume", msgs.Tag);
|
||||
MsgResult("areamgr.responses",tmp);
|
||||
a_list = TRUE;
|
||||
}
|
||||
}
|
||||
@ -1073,24 +937,17 @@ void A_Rescan(faddr *t, char *Area, FILE *tmp)
|
||||
MacroVars("SsP", "sss", CFG.sysop_name, nodes.Sysop,"Areamgr");
|
||||
if (result == 0){
|
||||
MacroVars("RABCDE", "ssdsss","OK_RESCAN",Area,a_msgs,"","","");
|
||||
if (!MsgResult("areamgr.responses",tmp)){
|
||||
if (a_msgs > 0)
|
||||
fprintf(tmp, "Rescan area %s, %lu last msgs.\n", Area, a_msgs);
|
||||
else
|
||||
fprintf(tmp, "Rescan area %s \n", Area);
|
||||
}
|
||||
} else if (result == 1)
|
||||
MsgResult("areamgr.responses",tmp);
|
||||
} else if (result == 1) {
|
||||
MacroVars("RABCDE", "ssssss","ERR_RESCAN_UNK",Area,"","","","");
|
||||
if (!MsgResult("areamgr.responses",tmp))
|
||||
fprintf(tmp, "Can't rescan unknown area %s\n", Area);
|
||||
else if (result == 2)
|
||||
MsgResult("areamgr.responses",tmp);
|
||||
} else if (result == 2) {
|
||||
MacroVars("RABCDE", "ssssss","ERR_RESCAN_NOTAVAIL",Area,ascfnode(t, 0x1f),"","","");
|
||||
if (!MsgResult("areamgr.responses",tmp))
|
||||
fprintf(tmp, "%s can't rescan area %s\n", ascfnode(t, 0x1f), Area);
|
||||
else
|
||||
MsgResult("areamgr.responses",tmp);
|
||||
} else {
|
||||
MacroVars("RABCDE", "ssssss","ERR_RESCAN_FATAL",Area,ascfnode(t, 0x1f),"","","");
|
||||
if (!MsgResult("areamgr.responses",tmp))
|
||||
fprintf(tmp, "Fatal Error Rescanning area %s\n", Area);
|
||||
MsgResult("areamgr.responses",tmp);
|
||||
}
|
||||
MacroClear();
|
||||
}
|
||||
|
||||
@ -1230,10 +1087,7 @@ int AreaMgr(faddr *f, faddr *t, char *replyid, char *subj, time_t mdate, int fla
|
||||
GetRpSubject("areamgr.responses",subject);
|
||||
if ((np = SendMgrMail(f, CFG.ct_KeepMgr, FALSE, (char *)"Areamgr", subject, replyid)) != NULL) {
|
||||
MacroVars("RABCDE", "ssssss","WELLCOME","","","","","");
|
||||
if (!MsgResult("areamgr.responses",np)){
|
||||
fprintf(np, " Dear %s\r\r", nodes.Sysop);
|
||||
fprintf(np, "Here is the result of your AreaMgr request:\r\r");
|
||||
}
|
||||
MsgResult("areamgr.responses",np);
|
||||
fseek(tmp, 0, SEEK_SET);
|
||||
|
||||
while ((fgets(Buf, 2048, tmp)) != NULL) {
|
||||
@ -1244,8 +1098,7 @@ int AreaMgr(faddr *f, faddr *t, char *replyid, char *subj, time_t mdate, int fla
|
||||
Syslog('m', "Rep: %s", Buf);
|
||||
}
|
||||
MacroVars("RABCDE", "ssssss","GOODBYE","","","","","");
|
||||
if (!MsgResult("areamgr.responses",np))
|
||||
fprintf(np, "\rWith regards, %s\r\r", CFG.sysop_name);
|
||||
MsgResult("areamgr.responses",np);
|
||||
fprintf(np, "%s\r", TearLine());
|
||||
CloseMail(np, t);
|
||||
} else
|
||||
@ -1276,3 +1129,4 @@ int AreaMgr(faddr *f, faddr *t, char *replyid, char *subj, time_t mdate, int fla
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@ -43,7 +43,6 @@
|
||||
#include "../lib/dbuser.h"
|
||||
#include "../lib/dbftn.h"
|
||||
#include "sendmail.h"
|
||||
#include "mgrutil.h"
|
||||
#include "postnetmail.h"
|
||||
#include "ping.h"
|
||||
|
||||
|
240
mbfido/filemgr.c
240
mbfido/filemgr.c
@ -91,45 +91,6 @@ void F_Help(faddr *t, char *replyid)
|
||||
MacroRead(fi, fp);
|
||||
MacroClear();
|
||||
fclose(fi);
|
||||
} else {
|
||||
fprintf(fp, "Address all requests to '%s' (without quotes)\r", (char *)"Filemgr");
|
||||
fprintf(fp, "Your FileMgr password goes on the subject line.\r\r");
|
||||
|
||||
fprintf(fp, "In the body of the message to FileMgr:\r\r");
|
||||
|
||||
fprintf(fp, "+<ticname> To connect to an fileecho area\r");
|
||||
fprintf(fp, "-<ticname> To disconnect from an fileecho area\r");
|
||||
fprintf(fp, "%%+ALL To connect to all fileecho areas\r");
|
||||
fprintf(fp, "%%-ALL To disconnect from all fileecho areas\r");
|
||||
fprintf(fp, "%%+<group> To connect all fileecho areas of a group\r");
|
||||
fprintf(fp, "%%-<group> To disconnect from all fileecho areas of a group\r");
|
||||
fprintf(fp, "%%HELP To request this help message\r");
|
||||
fprintf(fp, "%%LIST To request a list of available fileecho areas\r");
|
||||
fprintf(fp, "%%QUERY To request a list of active fileecho areas\r");
|
||||
fprintf(fp, "%%UNLINKED To request a list of available fileecho areas\r");
|
||||
fprintf(fp, " to which you are not already connected\r");
|
||||
fprintf(fp, "%%STATUS To request a status report for your system\r");
|
||||
fprintf(fp, "%%PAUSE To temporary disconnect from the connected areas\r");
|
||||
fprintf(fp, "%%RESUME To reconnect the temporary disconnected areas\r");
|
||||
fprintf(fp, "%%PWD=newpwd To set a new AreaMgr and FileMgr password\r");
|
||||
// fprintf(fp, "%%RESCAN <area> To request all files from 'area' again\r");
|
||||
fprintf(fp, "%%MESSGAE=On/Off To switch the message function on or off\r");
|
||||
fprintf(fp, "%%TICK=On/Off/Advanced To set the tic file mode off, normal or advanced\r");
|
||||
fprintf(fp, "%%NOTIFY=On/Off To switch the notify function on or off\r");
|
||||
// fprintf(fp, "%%RESEND <name> To resend file 'name' with tic file\r");
|
||||
fprintf(fp, "[---] Everything below the tearline is ignored\r\r");
|
||||
|
||||
fprintf(fp, "Example:\r\r");
|
||||
|
||||
fprintf(fp, " By: %s\r", nodes.Sysop);
|
||||
fprintf(fp, " To: %s, %s\r", (char *)"Filemgr", ascfnode(bestaka_s(t), 0xf));
|
||||
fprintf(fp, " Re: %s\r", nodes.Fpasswd);
|
||||
fprintf(fp, " St: Pvt Local Kill\r");
|
||||
fprintf(fp, " ----------------------------------------------------------\r");
|
||||
fprintf(fp, " +MBSE_BBS\r");
|
||||
fprintf(fp, " -NODELIST\r");
|
||||
fprintf(fp, " %%QUERY\r");
|
||||
fprintf(fp, " %%LIST\r\r");
|
||||
}
|
||||
fprintf(fp, "%s\r", TearLine());
|
||||
CloseMail(fp, t);
|
||||
@ -146,9 +107,11 @@ void F_Query(faddr *t, char *replyid)
|
||||
F_List(t, replyid, LIST_QUERY);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void F_List(faddr *t, char *replyid, int Notify)
|
||||
{
|
||||
FILE *qp, *gp, *fp, *fi;
|
||||
FILE *qp, *gp, *fp, *fi = NULL;
|
||||
char *temp, *Group, *subject;
|
||||
int i, First = TRUE, SubTot, Total = 0, Cons;
|
||||
char Stat[4];
|
||||
@ -161,25 +124,33 @@ void F_List(faddr *t, char *replyid, int Notify)
|
||||
f = bestaka_s(t);
|
||||
MacroVars("sKyY", "sdss", nodes.Sysop, Notify, ascfnode(t, 0xff), ascfnode(f, 0xf));
|
||||
|
||||
if (Notify==LIST_NOTIFY){
|
||||
Syslog('+', "FileMgr: Notify to %s", ascfnode(t, 0xff));
|
||||
switch (Notify) {
|
||||
case LIST_NOTIFY: Syslog('+', "FileMgr: Notify to %s", ascfnode(t, 0xff));
|
||||
sprintf(subject,"FileMgr Notify");
|
||||
GetRpSubject("filemgr.notify.list",subject);
|
||||
}
|
||||
if (Notify==LIST_LIST){
|
||||
Syslog('+', "FileMgr: List");
|
||||
fi=OpenMacro("filemgr.notify.list", nodes.Language);
|
||||
break;
|
||||
case LIST_LIST: Syslog('+', "FileMgr: List");
|
||||
sprintf(subject,"FileMgr list");
|
||||
GetRpSubject("filemgr.list",subject);
|
||||
}
|
||||
if (Notify==LIST_QUERY){
|
||||
Syslog('+', "FileMgr: Query");
|
||||
fi=OpenMacro("filemgr.list", nodes.Language);
|
||||
break;
|
||||
case LIST_QUERY: Syslog('+', "FileMgr: Query");
|
||||
sprintf(subject,"FileMgr Query");
|
||||
GetRpSubject("filemgr.query",subject);
|
||||
}
|
||||
if (Notify>=LIST_UNLINK){
|
||||
Syslog('+', "FileMgr: Unlinked");
|
||||
fi=OpenMacro("filemgr.query", nodes.Language);
|
||||
break;
|
||||
default: Syslog('+', "FileMgr: Unlinked");
|
||||
sprintf(subject,"FileMgr: Unlinked areas");
|
||||
GetRpSubject("filemgr.unlink",subject);
|
||||
fi=OpenMacro("filemgr.unlink", nodes.Language);
|
||||
break;
|
||||
}
|
||||
|
||||
if (fi == NULL) {
|
||||
MacroClear();
|
||||
free(subject);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((qp = SendMgrMail(t, CFG.ct_KeepMgr, FALSE, (char *)"Filemgr", subject, replyid)) != NULL) {
|
||||
@ -189,25 +160,11 @@ void F_List(faddr *t, char *replyid, int Notify)
|
||||
*/
|
||||
msgptr = ftell(qp);
|
||||
|
||||
fi=NULL;
|
||||
if (Notify==LIST_LIST){
|
||||
fi=OpenMacro("filemgr.list", nodes.Language);
|
||||
if ((Notify == LIST_LIST) || (Notify == LIST_NOTIFY))
|
||||
WriteFileGroups(qp, f);
|
||||
}
|
||||
if (Notify==LIST_NOTIFY){
|
||||
fi=OpenMacro("filemgr.notify.list", nodes.Language);
|
||||
WriteFileGroups(qp, f);
|
||||
}
|
||||
if (Notify==LIST_QUERY)
|
||||
fi=OpenMacro("filemgr.query", nodes.Language);
|
||||
if (Notify>=LIST_UNLINK)
|
||||
fi=OpenMacro("filemgr.unlink", nodes.Language);
|
||||
if (fi != NULL){
|
||||
|
||||
MacroRead(fi, qp);
|
||||
fgetpos(fi,&fileptr);
|
||||
}else{
|
||||
fprintf(qp, "The following is a list of file areas\r\r");
|
||||
}
|
||||
temp = calloc(PATH_MAX, sizeof(char));
|
||||
sprintf(temp, "%s/etc/tic.data", getenv("MBSE_ROOT"));
|
||||
if ((fp = fopen(temp, "r")) == NULL) {
|
||||
@ -215,6 +172,7 @@ void F_List(faddr *t, char *replyid, int Notify)
|
||||
free(temp);
|
||||
free(subject);
|
||||
MacroClear();
|
||||
fclose(fi);
|
||||
return;
|
||||
}
|
||||
fread(&tichdr, sizeof(tichdr), 1, fp);
|
||||
@ -227,6 +185,7 @@ void F_List(faddr *t, char *replyid, int Notify)
|
||||
free(subject);
|
||||
MacroClear();
|
||||
fclose(fp);
|
||||
fclose(fi);
|
||||
return;
|
||||
}
|
||||
fread(&fgrouphdr, sizeof(fgrouphdr), 1, gp);
|
||||
@ -242,19 +201,12 @@ void F_List(faddr *t, char *replyid, int Notify)
|
||||
while (fread(&fgroup, fgrouphdr.recsize, 1, gp) == 1) {
|
||||
g = bestaka_s(fido2faddr(fgroup.UseAka));
|
||||
if ((!strcmp(fgroup.Name, Group)) &&
|
||||
(g->zone == f->zone) && (g->net == f->net) &&
|
||||
(g->node == f->node) && (g->point == f->point)) {
|
||||
(g->zone == f->zone) && (g->net == f->net) && (g->node == f->node) && (g->point == f->point)) {
|
||||
SubTot = 0;
|
||||
if (fi != NULL){
|
||||
MacroVars("GJI", "sss",fgroup.Name, fgroup.Comment, aka2str(fgroup.UseAka) );
|
||||
fsetpos(fi,&fileptr);
|
||||
MacroRead(fi, qp);
|
||||
fgetpos(fi,&fileptr1);
|
||||
}else{
|
||||
fprintf(qp, "Group %s - %s (%s)\r\r", fgroup.Name, fgroup.Comment, aka2str(fgroup.UseAka));
|
||||
fprintf(qp, "Con File tic Description\r");
|
||||
fprintf(qp, "------------------------------------------------------------------------\r");
|
||||
}
|
||||
fseek(fp, tichdr.hdrsize, SEEK_SET);
|
||||
|
||||
while (fread(&tic, tichdr.recsize, 1, fp) == 1) {
|
||||
@ -281,7 +233,6 @@ void F_List(faddr *t, char *replyid, int Notify)
|
||||
|| (Notify == LIST_NOTIFY)
|
||||
|| ((Notify == LIST_QUERY) && ((Stat[0]=='S') || (Stat[1]=='R')))
|
||||
|| ((Notify >= LIST_UNLINK) && ((Stat[0]!='S') && (Stat[1]!='R')))){
|
||||
if (fi !=NULL){
|
||||
MacroVars("XDEsrp", "sssddd",
|
||||
Stat, tic.Name, tic.Comment,
|
||||
(Stat[0] == 'S'),
|
||||
@ -291,16 +242,12 @@ void F_List(faddr *t, char *replyid, int Notify)
|
||||
fsetpos(fi,&fileptr1);
|
||||
MacroRead(fi, qp);
|
||||
fgetpos(fi,&fileptr2);
|
||||
}else{
|
||||
fprintf(qp, "%s %-20s %s\r", Stat, tic.Name, tic.Comment);
|
||||
}
|
||||
SubTot++;
|
||||
Total++;
|
||||
}
|
||||
} else
|
||||
fseek(fp, tichdr.syssize, SEEK_CUR);
|
||||
}
|
||||
if (fi != NULL){
|
||||
MacroVars("ZA", "dd", (int) 0 , SubTot );
|
||||
fsetpos(fi,&fileptr2);
|
||||
if (((ftell(qp) - msgptr) / 1024) >= CFG.new_split) {
|
||||
@ -311,36 +258,14 @@ void F_List(faddr *t, char *replyid, int Notify)
|
||||
msgptr = ftell(qp);
|
||||
}
|
||||
MacroRead(fi, qp);
|
||||
}else{
|
||||
fprintf(qp, "------------------------------------------------------------------------\r");
|
||||
fprintf(qp, "%d available area(s)\r\r\r", SubTot);
|
||||
|
||||
if (((ftell(qp) - msgptr) / 1024) >= CFG.new_split) {
|
||||
fprintf(qp, "To be continued....\r\r");
|
||||
Syslog('-', " Splitting message at %ld bytes", ftell(qp) - msgptr);
|
||||
CloseMail(qp, t);
|
||||
qp = SendMgrMail(t, CFG.ct_KeepMgr, FALSE, (char *)"Filemgr", subject, replyid);
|
||||
msgptr = ftell(qp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (fi != NULL){
|
||||
MacroVars("B", "d", Total );
|
||||
MacroRead(fi, qp);
|
||||
MacroClear();
|
||||
fclose(fi);
|
||||
}else{
|
||||
fprintf(qp, "Total: %d available area(s)\r\r\r", Total);
|
||||
|
||||
fprintf(qp, "Con means:\r");
|
||||
fprintf(qp, " R - You receive files from my system\r");
|
||||
fprintf(qp, " S - You may send files in this area\r");
|
||||
fprintf(qp, " P - The file area is temporary paused\r\r");
|
||||
fprintf(qp, "With regards, %s\r\r", CFG.sysop_name);
|
||||
}
|
||||
fclose(fp);
|
||||
fclose(gp);
|
||||
fprintf(qp, "%s\r", TearLine());
|
||||
@ -393,42 +318,16 @@ void F_Status(faddr *t, char *replyid)
|
||||
);
|
||||
GetRpSubject("filemgr.status",subject);
|
||||
|
||||
if ((fi = OpenMacro("filemgr.status", nodes.Language)) == NULL ) {
|
||||
free(subject);
|
||||
MacroClear();
|
||||
return;
|
||||
}
|
||||
|
||||
if ((fp = SendMgrMail(t, CFG.ct_KeepMgr, FALSE, (char *)"Filemgr", subject, replyid)) != NULL) {
|
||||
if ( (fi=OpenMacro("filemgr.status", nodes.Language)) != NULL ){
|
||||
MacroRead(fi, fp);
|
||||
MacroClear();
|
||||
fclose(fi);
|
||||
}else{
|
||||
fprintf(fp, "Here is your fileecho status:\r\r");
|
||||
|
||||
fprintf(fp, "Netmail message %s\r", GetBool(nodes.Message));
|
||||
fprintf(fp, "TIC files %s\r", GetBool(nodes.Tic));
|
||||
if (nodes.Tic)
|
||||
fprintf(fp, "Andvanced TIC files %s\r", GetBool(nodes.AdvTic));
|
||||
fprintf(fp, "Notify messages %s\r", GetBool(nodes.Notify));
|
||||
fprintf(fp, "Cost sharing %s\r", GetBool(nodes.Billing));
|
||||
if (nodes.Billing) {
|
||||
fprintf(fp, "Send bill direct %s\r", GetBool(nodes.BillDirect));
|
||||
fprintf(fp, "Units debet %ld\r", nodes.Debet);
|
||||
fprintf(fp, "Units credit %ld\r", nodes.Credit);
|
||||
fprintf(fp, "Warning level %ld\r", nodes.WarnLevel);
|
||||
}
|
||||
|
||||
fprintf(fp, "\r\rRecent flow:\r\r");
|
||||
|
||||
fprintf(fp, " Last week Last month Total ever\r");
|
||||
fprintf(fp, " ---------- ---------- ----------\r");
|
||||
fprintf(fp, "Files sent %-10ld %-10ld %-10ld\r", nodes.FilesSent.lweek,
|
||||
nodes.FilesSent.month[i], nodes.FilesSent.total);
|
||||
fprintf(fp, "KBytes sent %-10ld %-10ld %-10ld\r", nodes.F_KbSent.lweek,
|
||||
nodes.F_KbSent.month[i], nodes.F_KbSent.total);
|
||||
fprintf(fp, "Files received %-10ld %-10ld %-10ld\r", nodes.FilesRcvd.lweek,
|
||||
nodes.FilesRcvd.month[i], nodes.FilesRcvd.total);
|
||||
fprintf(fp, "KBytes received %-10ld %-10ld %-10ld\r", nodes.F_KbRcvd.lweek,
|
||||
nodes.F_KbRcvd.month[i], nodes.F_KbRcvd.total);
|
||||
|
||||
fprintf(fp, "\rWith regards, %s\r\r", CFG.sysop_name);
|
||||
}
|
||||
fprintf(fp, "%s\r", TearLine());
|
||||
CloseMail(fp, t);
|
||||
} else
|
||||
@ -463,8 +362,7 @@ void F_Disconnect(faddr *t, char *Area, FILE *tmp)
|
||||
if (!SearchTic(Area)) {
|
||||
MacroVars("SsP", "sss", CFG.sysop_name, nodes.Sysop, "Filemgr");
|
||||
MacroVars("RABCDE", "ssssss","ERR_DISC_NOTFOUND",Area,"","","","");
|
||||
if (!MsgResult("filemgr.responses",tmp))
|
||||
fprintf(tmp, "Area %s not found\n", Area);
|
||||
MsgResult("filemgr.responses",tmp);
|
||||
Syslog('+', " Area not found");
|
||||
MacroClear();
|
||||
return;
|
||||
@ -481,8 +379,7 @@ void F_Disconnect(faddr *t, char *Area, FILE *tmp)
|
||||
if (Group == NULL) {
|
||||
MacroVars("SsP", "sss", CFG.sysop_name, nodes.Sysop, "Filemgr");
|
||||
MacroVars("RABCDE", "ssssss","ERR_DISC_NOTGROUP",Area,"","","","");
|
||||
if (!MsgResult("filemgr.responses",tmp))
|
||||
fprintf(tmp, "You may not disconnect from area %s\n", Area);
|
||||
MsgResult("filemgr.responses",tmp);
|
||||
Syslog('+', " Group %s not available for %s", fgroup.Name, ascfnode(t, 0x1f));
|
||||
MacroClear();
|
||||
return;
|
||||
@ -495,8 +392,7 @@ void F_Disconnect(faddr *t, char *Area, FILE *tmp)
|
||||
if (i >= METRIC_NET) {
|
||||
MacroVars("SsP", "sss", CFG.sysop_name, nodes.Sysop, "Filemgr");
|
||||
MacroVars("RABCDE", "ssssss","ERR_DISC_BADADD",Area,ascfnode(t, 0x1f),"","","");
|
||||
if (!MsgResult("filemgr.responses",tmp))
|
||||
fprintf(tmp, "You may not disconnect area %s with nodenumber %s\n", Area, ascfnode(t, 0x1f));
|
||||
MsgResult("filemgr.responses",tmp);
|
||||
Syslog('+', " %s may not disconnect from group %s", ascfnode(t, 0x1f), fgroup.Name);
|
||||
MacroClear();
|
||||
return;
|
||||
@ -510,8 +406,7 @@ void F_Disconnect(faddr *t, char *Area, FILE *tmp)
|
||||
if (!TicSystemConnected(Sys)) {
|
||||
MacroVars("SsP", "sss", CFG.sysop_name, nodes.Sysop,"Filemgr");
|
||||
MacroVars("RABCDE", "ssssss","ERR_DISC_NC",Area,"","","","");
|
||||
if (!MsgResult("filemgr.responses",tmp))
|
||||
fprintf(tmp, "You are not connected to %s\n", Area);
|
||||
MsgResult("filemgr.responses",tmp);
|
||||
Syslog('+', " %s is not connected to %s", ascfnode(t, 0x1f), Area);
|
||||
MacroClear();
|
||||
return;
|
||||
@ -526,21 +421,20 @@ void F_Disconnect(faddr *t, char *Area, FILE *tmp)
|
||||
Syslog('+', "Disconnected file area %s", Area);
|
||||
MacroVars("SsP", "sss", CFG.sysop_name, nodes.Sysop,"Filemgr");
|
||||
MacroVars("RABCDE", "ssssss","OK_DISC",Area,"","","","");
|
||||
if (!MsgResult("filemgr.responses",tmp))
|
||||
fprintf(tmp, "Disconnected from area %s\n", Area);
|
||||
MsgResult("filemgr.responses",tmp);
|
||||
MacroClear();
|
||||
return;
|
||||
}
|
||||
|
||||
MacroVars("SsP", "sss", CFG.sysop_name, nodes.Sysop,"Filemgr");
|
||||
MacroVars("RABCDE", "ssssss","ERR_DISC_NOTAVAIL",Area,"","","","");
|
||||
if (!MsgResult("filemgr.responses",tmp))
|
||||
fprintf(tmp, "You may not disconnect area %s, area is mandatory\n", Area);
|
||||
MsgResult("filemgr.responses",tmp);
|
||||
Syslog('+', "Didn't disconnect %s from mandatory file area %s", ascfnode(t, 0x1f), Area);
|
||||
MacroClear();
|
||||
}
|
||||
|
||||
|
||||
|
||||
void F_Connect(faddr *, char *, FILE *);
|
||||
void F_Connect(faddr *t, char *Area, FILE *tmp)
|
||||
{
|
||||
@ -559,8 +453,7 @@ void F_Connect(faddr *t, char *Area, FILE *tmp)
|
||||
if (!SearchTic(Area)) {
|
||||
MacroVars("SsP", "sss", CFG.sysop_name, nodes.Sysop, "Filemgr");
|
||||
MacroVars("RABCDE", "ssssss","ERR_CONN_NOTFOUND",Area,"","","","");
|
||||
if (!MsgResult("filemgr.responses",tmp))
|
||||
fprintf(tmp, "Area %s not found\n", Area);
|
||||
MsgResult("filemgr.responses",tmp);
|
||||
Syslog('m', " Area not found");
|
||||
/* SHOULD CHECK FOR AREAS FILE AND ASK UPLINK
|
||||
CHECK ALL GROUPRECORDS FOR AKA MATCH
|
||||
@ -584,8 +477,7 @@ void F_Connect(faddr *t, char *Area, FILE *tmp)
|
||||
if (Group == NULL) {
|
||||
MacroVars("SsP", "sss", CFG.sysop_name, nodes.Sysop, "Filemgr");
|
||||
MacroVars("RABCDE", "ssssss","ERR_CONN_NOTGROUP",Area,"","","","");
|
||||
if (!MsgResult("filemgr.responses",tmp))
|
||||
fprintf(tmp, "You may not connect to area %s\n", Area);
|
||||
MsgResult("filemgr.responses",tmp);
|
||||
Syslog('+', " Group %s not available for %s", fgroup.Name, ascfnode(t, 0x1f));
|
||||
MacroClear();
|
||||
return;
|
||||
@ -598,8 +490,7 @@ void F_Connect(faddr *t, char *Area, FILE *tmp)
|
||||
if (i >= METRIC_NET) {
|
||||
MacroVars("SsP", "sss", CFG.sysop_name, nodes.Sysop,"Filemgr");
|
||||
MacroVars("RABCDE", "ssssss","ERR_CONN_BADADD",Area,ascfnode(t, 0x1f),"","","");
|
||||
if (!MsgResult("filemgr.responses",tmp))
|
||||
fprintf(tmp, "You may not connect area %s with nodenumber %s\n", Area, ascfnode(t, 0x1f));
|
||||
MsgResult("filemgr.responses",tmp);
|
||||
Syslog('+', " Node %s may not connect to group %s", ascfnode(t, 0x1f), fgroup.Name);
|
||||
MacroClear();
|
||||
return;
|
||||
@ -612,8 +503,7 @@ void F_Connect(faddr *t, char *Area, FILE *tmp)
|
||||
if (TicSystemConnected(Sys)) {
|
||||
MacroVars("SsP", "sss", CFG.sysop_name, nodes.Sysop,"Filemgr");
|
||||
MacroVars("RABCDE", "ssssss","ERR_CONN_ALREADY",Area,"","","","");
|
||||
if (!MsgResult("filemgr.responses",tmp))
|
||||
fprintf(tmp, "You are already connected to %s\n", Area);
|
||||
MsgResult("filemgr.responses",tmp);
|
||||
Syslog('+', " %s is already connected to %s", ascfnode(t, 0x1f), Area);
|
||||
MacroClear();
|
||||
return;
|
||||
@ -628,15 +518,13 @@ void F_Connect(faddr *t, char *Area, FILE *tmp)
|
||||
Syslog('+', "Connected to file area %s", Area);
|
||||
MacroVars("SsP", "sss", CFG.sysop_name, nodes.Sysop,"Filemgr");
|
||||
MacroVars("RABCDE", "ssssss","OK_CONN",Area,aka2str(tic.Aka),"","","");
|
||||
if (!MsgResult("filemgr.responses",tmp))
|
||||
fprintf(tmp, "Connected to area %s using aka %s\n", Area, aka2str(tic.Aka));
|
||||
MsgResult("filemgr.responses",tmp);
|
||||
MacroClear();
|
||||
return;
|
||||
}
|
||||
MacroVars("SsP", "sss", CFG.sysop_name, nodes.Sysop,"Filemgr");
|
||||
MacroVars("RABCDE", "ssssss","ERR_CONN_NOTAVAIL",Area,"","","","");
|
||||
if (!MsgResult("filemgr.responses",tmp))
|
||||
fprintf(tmp, "Not connected to %s, internal error, sysop is notified\n", Area);
|
||||
MsgResult("filemgr.responses",tmp);
|
||||
WriteError("Can't connect node %s to file area %s", ascfnode(t, 0x1f), Area);
|
||||
MacroClear();
|
||||
}
|
||||
@ -723,8 +611,7 @@ void F_All(faddr *t, int Connect, FILE *tmp, char *Grp)
|
||||
Syslog('+', "FileMgr: Connected %s", tic.Name);
|
||||
MacroVars("SsP", "sss", CFG.sysop_name, nodes.Sysop,"Filemgr");
|
||||
MacroVars("RABCDE", "ssssss","OK_CONN",tic.Name,aka2str(tic.Aka),"","","");
|
||||
if (!MsgResult("filemgr.responses",tmp))
|
||||
fprintf(tmp, "Connected area %s using aka %s\n", tic.Name, aka2str(tic.Aka));
|
||||
MsgResult("filemgr.responses",tmp);
|
||||
MacroClear();
|
||||
f_list = TRUE;
|
||||
break;
|
||||
@ -742,8 +629,7 @@ void F_All(faddr *t, int Connect, FILE *tmp, char *Grp)
|
||||
Syslog('+', "FileMgr: Disconnected %s", tic.Name);
|
||||
MacroVars("SsP", "sss", CFG.sysop_name, nodes.Sysop,"Filemgr");
|
||||
MacroVars("RABCDE", "ssssss","OK_DISC",tic.Name,"","","","");
|
||||
if (!MsgResult("filemgr.responses",tmp))
|
||||
fprintf(tmp, "Disconnected area %s\n", tic.Name);
|
||||
MsgResult("filemgr.responses",tmp);
|
||||
MacroClear();
|
||||
f_list = TRUE;
|
||||
}
|
||||
@ -811,7 +697,9 @@ void F_Pause(faddr *t, int Pause, FILE *tmp)
|
||||
fseek(fp, - sizeof(Sys), SEEK_CUR);
|
||||
fwrite(&Sys, sizeof(Sys), 1, fp);
|
||||
Syslog('+', "FileMgr: %s area %s", Pause?"Pause":"Resume", tic.Name);
|
||||
fprintf(tmp, "%s area %s\n", Pause?"Pause":"Resume", tic.Name);
|
||||
MacroVars("SsP", "sss", CFG.sysop_name, nodes.Sysop,"FileMgr");
|
||||
MacroVars("RABCDE", "ssssss","OK_PAUSE",tic.Name,ascfnode(t, 0x1f),"","");
|
||||
MsgResult("filemgr.responses",tmp);
|
||||
f_list = TRUE;
|
||||
}
|
||||
}
|
||||
@ -838,11 +726,10 @@ void F_Message(faddr *t, char *Buf, FILE *tmp)
|
||||
|
||||
UpdateNode();
|
||||
SearchNodeFaddr(t);
|
||||
Syslog('+', "FileMgr: Message %s", GetBool(nodes.Message));
|
||||
Syslog('+', "FileMgr: Message %s", nodes.Message?"Yes":"No");
|
||||
MacroVars("SsP", "sss", CFG.sysop_name, nodes.Sysop,"Filemgr");
|
||||
MacroVars("RABCDE", "sdssss","OK_MESSAGE",nodes.Message,"","","","");
|
||||
if (!MsgResult("filemgr.responses",tmp))
|
||||
fprintf(tmp, "FileMgr Message file is %s\n", GetBool(nodes.Message));
|
||||
MsgResult("filemgr.responses",tmp);
|
||||
MacroClear();
|
||||
}
|
||||
|
||||
@ -865,27 +752,26 @@ void F_Tick(faddr *t, char *Buf, FILE *tmp)
|
||||
|
||||
UpdateNode();
|
||||
SearchNodeFaddr(t);
|
||||
Syslog('+', "FileMgr: Tick %s, Advanced %s", GetBool(nodes.Tic), GetBool(nodes.AdvTic));
|
||||
Syslog('+', "FileMgr: Tick %s, Advanced %s", nodes.Tic?"Yes":"No", nodes.AdvTic?"Yes":"No");
|
||||
if (nodes.Tic)
|
||||
if (nodes.AdvTic){
|
||||
MacroVars("SsP", "sss", CFG.sysop_name, nodes.Sysop,"Filemgr");
|
||||
MacroVars("RABCDE", "sddsss","OK_TIC_ADV",nodes.Tic,nodes.AdvTic,"","","");
|
||||
if (!MsgResult("filemgr.responses",tmp))
|
||||
fprintf(tmp, "Tick mode is advanced\n");
|
||||
MsgResult("filemgr.responses",tmp);
|
||||
}else{
|
||||
MacroVars("SsP", "sss", CFG.sysop_name, nodes.Sysop,"Filemgr");
|
||||
MacroVars("RABCDE", "sddsss","OK_TIC_NORM",nodes.Tic,nodes.AdvTic,"","","");
|
||||
if (!MsgResult("filemgr.responses",tmp))
|
||||
fprintf(tmp, "Tick mode is normal\n");
|
||||
MsgResult("filemgr.responses",tmp);
|
||||
}else{
|
||||
MacroVars("SsP", "sss", CFG.sysop_name, nodes.Sysop,"Filemgr");
|
||||
MacroVars("RABCDE", "sddsss","OK_TIC_OFF",nodes.Tic,nodes.AdvTic,"","","");
|
||||
if (!MsgResult("filemgr.responses",tmp))
|
||||
fprintf(tmp, "Tick mode is off\n");
|
||||
MsgResult("filemgr.responses",tmp);
|
||||
}
|
||||
MacroClear();
|
||||
}
|
||||
|
||||
|
||||
|
||||
int FileMgr(faddr *f, faddr *t, char *replyid, char *subj, time_t mdate, int flags, FILE *fp)
|
||||
{
|
||||
int i, rc = 0, spaces;
|
||||
@ -1000,10 +886,7 @@ int FileMgr(faddr *f, faddr *t, char *replyid, char *subj, time_t mdate, int fla
|
||||
GetRpSubject("filemgr.responses",subject);
|
||||
if ((np = SendMgrMail(f, CFG.ct_KeepMgr, FALSE, (char *)"Filemgr", subject, replyid)) != NULL) {
|
||||
MacroVars("RABCDE", "ssssss","WELLCOME","","","","","");
|
||||
if (!MsgResult("filemgr.responses",np)){
|
||||
fprintf(np, " Dear %s\r\r", nodes.Sysop);
|
||||
fprintf(np, "Here is the result of your FileMgr request:\r\r");
|
||||
}
|
||||
MsgResult("filemgr.responses",np);
|
||||
fseek(tmp, 0, SEEK_SET);
|
||||
|
||||
while ((fgets(Buf, 2048, tmp)) != NULL) {
|
||||
@ -1015,8 +898,7 @@ int FileMgr(faddr *f, faddr *t, char *replyid, char *subj, time_t mdate, int fla
|
||||
}
|
||||
|
||||
MacroVars("RABCDE", "ssssss","GOODBYE","","","","","");
|
||||
if (!MsgResult("filemgr.responses",np))
|
||||
fprintf(np, "\rWith regards, %s\r\r", CFG.sysop_name);
|
||||
MsgResult("filemgr.responses",np);
|
||||
fprintf(np, "%s\r", TearLine());
|
||||
CloseMail(np, t);
|
||||
} else
|
||||
|
@ -93,27 +93,23 @@ void WriteMailGroups(FILE *fp, faddr *f)
|
||||
faddr *g;
|
||||
fpos_t fileptr;
|
||||
|
||||
if ((fi = OpenMacro("areamgr.group", nodes.Language)) == NULL)
|
||||
return;
|
||||
|
||||
MacroRead(fi, fp);
|
||||
fgetpos(fi,&fileptr);
|
||||
|
||||
temp = calloc(PATH_MAX, sizeof(char));
|
||||
sprintf(temp, "%s/etc/mgroups.data", getenv("MBSE_ROOT"));
|
||||
|
||||
if ((fi = OpenMacro("areamgr.group", nodes.Language)) != NULL){
|
||||
MacroRead(fi, fp);
|
||||
fgetpos(fi,&fileptr);
|
||||
} else {
|
||||
fprintf(fp, "Dear %s\r\r", nodes.Sysop);
|
||||
fprintf(fp, "The following is a list of mail groups at %s\r\r", ascfnode(f, 0x1f));
|
||||
}
|
||||
if ((gp = fopen(temp, "r")) == NULL) {
|
||||
WriteError("$Can't open %s", temp);
|
||||
free(temp);
|
||||
fclose(fi);
|
||||
return;
|
||||
}
|
||||
fread(&mgrouphdr, sizeof(mgrouphdr), 1, gp);
|
||||
|
||||
if (fi == NULL){
|
||||
fprintf(fp, "Group Description\r");
|
||||
fprintf(fp, "--------------------------------------------------------------------\r");
|
||||
}
|
||||
while (TRUE) {
|
||||
Group = GetNodeMailGrp(First);
|
||||
if (Group == NULL)
|
||||
@ -124,28 +120,19 @@ void WriteMailGroups(FILE *fp, faddr *f)
|
||||
while (fread(&mgroup, mgrouphdr.recsize, 1, gp) == 1) {
|
||||
g = bestaka_s(fido2faddr(mgroup.UseAka));
|
||||
if ((!strcmp(mgroup.Name, Group)) &&
|
||||
(g->zone == f->zone) && (g->net == f->net) &&
|
||||
(g->node == f->node) && (g->point == f->point)) {
|
||||
if (fi !=NULL){
|
||||
(g->zone == f->zone) && (g->net == f->net) && (g->node == f->node) && (g->point == f->point)) {
|
||||
MacroVars("gh", "ss", mgroup.Name, mgroup.Comment);
|
||||
fsetpos(fi, &fileptr);
|
||||
MacroRead(fi, fp);
|
||||
}else{
|
||||
fprintf(fp, "%-12s %s\r", mgroup.Name, mgroup.Comment);
|
||||
}
|
||||
Count++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (fi != NULL){
|
||||
|
||||
MacroVars("b", "d", Count);
|
||||
MacroRead(fi, fp);
|
||||
fclose(fi);
|
||||
}else{
|
||||
fprintf(fp, "--------------------------------------------------------------------\r");
|
||||
fprintf(fp, "%d group(s)\r\r\r", Count);
|
||||
}
|
||||
fclose(gp);
|
||||
free(temp);
|
||||
}
|
||||
@ -163,27 +150,23 @@ void WriteFileGroups(FILE *fp, faddr *f)
|
||||
faddr *g;
|
||||
fpos_t fileptr;
|
||||
|
||||
if ((fi = OpenMacro("filemgr.group", nodes.Language)) == NULL)
|
||||
return;
|
||||
|
||||
MacroRead(fi, fp);
|
||||
fgetpos(fi,&fileptr);
|
||||
|
||||
temp = calloc(128, sizeof(char));
|
||||
sprintf(temp, "%s/etc/fgroups.data", getenv("MBSE_ROOT"));
|
||||
|
||||
if ((fi = OpenMacro("filemgr.group", nodes.Language)) != NULL){
|
||||
MacroRead(fi, fp);
|
||||
fgetpos(fi,&fileptr);
|
||||
}else{
|
||||
fprintf(fp, "Dear %s\r\r", nodes.Sysop);
|
||||
fprintf(fp, "The following is a list of file groups at %s\r\r", ascfnode(f, 0x1f));
|
||||
}
|
||||
if ((gp = fopen(temp, "r")) == NULL) {
|
||||
WriteError("$Can't open %s", temp);
|
||||
free(temp);
|
||||
fclose(fi);
|
||||
return;
|
||||
}
|
||||
fread(&fgrouphdr, sizeof(fgrouphdr), 1, gp);
|
||||
|
||||
if (fi == NULL){
|
||||
fprintf(fp, "Group Description\r");
|
||||
fprintf(fp, "--------------------------------------------------------------------\r");
|
||||
}
|
||||
while (TRUE) {
|
||||
Group = GetNodeFileGrp(First);
|
||||
if (Group == NULL)
|
||||
@ -194,44 +177,25 @@ void WriteFileGroups(FILE *fp, faddr *f)
|
||||
while (fread(&fgroup, fgrouphdr.recsize, 1, gp) == 1) {
|
||||
g = bestaka_s(fido2faddr(fgroup.UseAka));
|
||||
if ((!strcmp(fgroup.Name, Group)) &&
|
||||
(g->zone == f->zone) && (g->net == f->net) &&
|
||||
(g->node == f->node) && (g->point == f->point)) {
|
||||
if (fi !=NULL){
|
||||
(g->zone == f->zone) && (g->net == f->net) && (g->node == f->node) && (g->point == f->point)) {
|
||||
MacroVars("gh", "ss", fgroup.Name, fgroup.Comment );
|
||||
fsetpos(fi,&fileptr);
|
||||
MacroRead(fi, fp);
|
||||
}else{
|
||||
fprintf(fp, "%-12s %s\r", fgroup.Name, fgroup.Comment);
|
||||
}
|
||||
Count++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (fi != NULL){
|
||||
|
||||
MacroVars("b", "d", Count );
|
||||
MacroRead(fi, fp);
|
||||
fclose(fi);
|
||||
}else{
|
||||
fprintf(fp, "--------------------------------------------------------------------\r");
|
||||
fprintf(fp, "%d group(s)\r\r\r", Count);
|
||||
}
|
||||
fclose(gp);
|
||||
free(temp);
|
||||
}
|
||||
|
||||
|
||||
|
||||
char *GetBool(int Flag)
|
||||
{
|
||||
if (Flag)
|
||||
return (char *)"Yes";
|
||||
else
|
||||
return (char *)"No";
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Shift all characters in Buf Cnt places to left
|
||||
*/
|
||||
@ -267,8 +231,7 @@ void MgrPasswd(faddr *t, char *Buf, FILE *tmp, int Len, int mgr)
|
||||
MacroVars("SsP", "sss", CFG.sysop_name, nodes.Sysop, mgr?(char *)"Filemgr":(char *)"Areamgr");
|
||||
if ((strlen(Buf) < 3) || (strlen(Buf) > 15)) {
|
||||
MacroVars("RABCDE", "ssssss",(char *)"ERR_PASS_LEN",(char *)"",(char *)"",(char *)"",(char *)"",(char *)"");
|
||||
if (!MsgResult(mgr?"filemgr.responses":"areamgr.responses",tmp))
|
||||
fprintf(tmp, "A new password must be between 3 and 15 characters in length\n");
|
||||
MsgResult(mgr?"filemgr.responses":"areamgr.responses",tmp);
|
||||
Syslog('+', "XxxxMgr: Password length %d, not changed", strlen(Buf));
|
||||
return;
|
||||
}
|
||||
@ -276,8 +239,7 @@ void MgrPasswd(faddr *t, char *Buf, FILE *tmp, int Len, int mgr)
|
||||
memset(&nodes.Apasswd, 0, sizeof(nodes.Apasswd));
|
||||
strncpy(nodes.Apasswd, tu(Buf), 15);
|
||||
MacroVars("RABCDE", "ssssss",(char *)"OK_PASS",nodes.Apasswd,(char *)"",(char *)"",(char *)"",(char *)"");
|
||||
if (!MsgResult(mgr?"filemgr.responses":"areamgr.responses",tmp))
|
||||
fprintf(tmp, "AreaMgr and FileMgr password is now \"%s\"\n", nodes.Apasswd);
|
||||
MsgResult(mgr?"filemgr.responses":"areamgr.responses",tmp);
|
||||
Syslog('+', "XxxxMgr: Password \"%s\" for node %s", nodes.Apasswd, ascfnode(t, 0x1f));
|
||||
MacroClear();
|
||||
UpdateNode();
|
||||
@ -306,11 +268,10 @@ void MgrNotify(faddr *t, char *Buf, FILE *tmp, int mgr)
|
||||
|
||||
UpdateNode();
|
||||
SearchNodeFaddr(t);
|
||||
Syslog('+', "XxxxMgr: Notify %s", GetBool(nodes.Notify));
|
||||
Syslog('+', "XxxxMgr: Notify %s", nodes.Notify?"Yes":"No");
|
||||
MacroVars("SsP", "sss", CFG.sysop_name, nodes.Sysop,mgr?(char *)"Filemgr":(char *)"Areamgr");
|
||||
MacroVars("RABCDE", "ssssss",(char *)"OK_PASS",nodes.Apasswd,(char *)"",(char *)"",(char *)"",(char *)"");
|
||||
if (!MsgResult(mgr?"filemgr.responses":"areamgr.responses",tmp))
|
||||
fprintf(tmp, "AreaMgr and FileMgr Notify is %s\n", GetBool(nodes.Notify));
|
||||
MsgResult(mgr?"filemgr.responses":"areamgr.responses",tmp);
|
||||
MacroClear();
|
||||
}
|
||||
|
||||
@ -486,6 +447,7 @@ int MsgResult(const char * report, FILE *fo)
|
||||
} else {
|
||||
res = 0;
|
||||
}
|
||||
|
||||
free(temp);
|
||||
return res;
|
||||
}
|
||||
|
@ -10,7 +10,6 @@ void GetRpSubject(const char *, char*);
|
||||
|
||||
void WriteMailGroups(FILE *, faddr *);
|
||||
void WriteFileGroups(FILE *, faddr *);
|
||||
char *GetBool(int);
|
||||
void CleanBuf(char *);
|
||||
void ShiftBuf(char *, int);
|
||||
void MgrPasswd(faddr *, char *, FILE *, int, int);
|
||||
|
@ -43,7 +43,6 @@
|
||||
#include "../lib/dbuser.h"
|
||||
#include "../lib/dbftn.h"
|
||||
#include "sendmail.h"
|
||||
#include "mgrutil.h"
|
||||
#include "postnetmail.h"
|
||||
#include "ping.h"
|
||||
|
||||
|
Reference in New Issue
Block a user