Start adding support for *.msg

This commit is contained in:
Michiel Broek 2004-07-23 21:24:09 +00:00
parent 15c2e96616
commit 4c075a5a7d
6 changed files with 55 additions and 5 deletions

View File

@ -10,6 +10,7 @@ v0.61.2 11-Jul-2004
In mbsetup menu 1.14 update the TCP/IP connection details.
In the examples directory type "make macros" to update the
macro templates. Be carefull if you have personalized versions.
Check if /opt/mbse/var/msgs is empty before using this version.
general:
Added -fno-strict-aliasing switch to gcc to prevent some

View File

@ -138,7 +138,7 @@ addpkt.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h addpkt.h
bwrite.o: ../config.h ../lib/mbselib.h bwrite.h
forward.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h ../lib/diesel.h tic.h sendmail.h rollover.h mgrutil.h forward.h
lhash.o: ../config.h ../lib/mbselib.h lhash.h
mbfido.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h ../lib/nodelist.h ../lib/mbsedb.h ../lib/msg.h flock.h tosspkt.h unpack.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 mgrutil.h backalias.h rfc2ftn.h dirsession.h dirlock.h queue.h
mbfido.o: ../config.h ../lib/mbselib.h ../lib/mbse.h ../lib/users.h ../lib/nodelist.h ../lib/mbsedb.h ../lib/msg.h flock.h tosspkt.h unpack.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 mgrutil.h backalias.h rfc2ftn.h dirsession.h dirlock.h queue.h msg.h
mkftnhdr.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbsedb.h atoul.h hash.h msgflags.h aliasdb.h mkftnhdr.h
ping.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/msg.h ../lib/msgtext.h ../lib/mbsedb.h sendmail.h postnetmail.h ping.h
rfc2ftn.o: ../config.h ../lib/mbselib.h ../lib/users.h ../lib/mbinet.h ../lib/mbsedb.h ../lib/msg.h ../lib/msgtext.h mkftnhdr.h hash.h rollover.h postnetmail.h postecho.h msgflags.h rfc2ftn.h

View File

@ -57,6 +57,7 @@
#include "dirsession.h"
#include "dirlock.h"
#include "queue.h"
#include "msg.h"
#define UNPACK_FACTOR 300
@ -91,7 +92,7 @@ int packets = 0; /* Tossed packets */
int packets_ok = 0; /* Tossed packets Ok. */
char *envptr = NULL;
extern int net_in, net_imp, net_out, net_bad;
extern int net_in, net_imp, net_out, net_bad, net_msgs;
extern int echo_in, echo_imp, echo_out, echo_bad, echo_dupe;
extern int email_in, email_imp, email_out, email_bad;
extern int news_in, news_imp, news_out, news_bad, news_dupe;
@ -214,8 +215,8 @@ void die(int onsig)
if (tic_imp)
CreateSema((char *)"reqindex");
if (net_in + net_imp + net_out + net_bad)
Syslog('+', "Netmail [%4d] import [%4d] out [%4d] bad [%4d]", net_in, net_imp, net_out, net_bad);
if (net_in + net_imp + net_out + net_bad + net_msgs)
Syslog('+', "Netmail [%4d] import [%4d] out [%4d] bad [%4d] msgs [%4d]", net_in, net_imp, net_out, net_bad, net_msgs);
if (email_in + email_imp + email_out + email_bad)
Syslog('+', "Email [%4d] import [%4d] out [%4d] bad [%4d]", email_in, email_imp, email_out, email_bad);
if (echo_in + echo_imp + echo_out + echo_bad + echo_dupe)
@ -529,6 +530,7 @@ int main(int argc, char **argv)
*/
Loop = TRUE;
do {
toss_msgs();
Hatch();
switch (Tic()) {
case -1: die(MBERR_OK);
@ -544,11 +546,14 @@ int main(int argc, char **argv)
if (IsSema((char *)"newnews"))
RemoveSema((char *)"newnews");
}
if (do_scan)
if (do_scan) {
toss_msgs();
ScanMail(do_full);
}
if (do_toss) {
if (IsSema((char *)"mailin"))
RemoveSema((char *)"mailin");
toss_msgs();
if (TossMail() == FALSE)
die(MBERR_OK);
}
@ -564,6 +569,7 @@ int main(int argc, char **argv)
*/
Loop = TRUE;
do {
toss_msgs();
Hatch();
switch (Tic()) {
case -1: die(MBERR_OK);
@ -575,6 +581,7 @@ int main(int argc, char **argv)
} while (Loop);
}
if (do_toss) {
toss_msgs();
TossMail();
}
}

View File

@ -33,4 +33,43 @@
#include "msg.h"
extern int net_msgs;
int toss_msgs(void)
{
DIR *dp;
struct dirent *de;
int files = 0;
if ((dp = opendir(CFG.msgs_path)) == NULL) {
WriteError("$Can't opendir %s", CFG.msgs_path);
return -1;
}
Syslog('m', "Process *.msg in %s", CFG.msgs_path);
IsDoing("Get *.msgs");
while ((de = readdir(dp))) {
if ((de->d_name[0] != '.') && (strstr(de->d_name, ".msg"))) {
if (IsSema((char *)"upsalarm")) {
Syslog('+', "Detected upsalarm semafore, aborting toss");
break;
}
Syslog('m', "Process %s", de->d_name);
files++;
}
}
closedir(dp);
if (files) {
Syslog('+',"Processed %d msg messages", files);
}
net_msgs += files;
return files;
}

View File

@ -3,4 +3,6 @@
/* $Id$ */
int toss_msgs(void);
#endif

View File

@ -59,6 +59,7 @@ int net_in = 0; /* Netmails received */
int net_imp = 0; /* Netmails imported */
int net_out = 0; /* Netmails forwarded */
int net_bad = 0; /* Bad netmails (tracking errors */
int net_msgs = 0; /* *.msg files processed */
int echo_in = 0; /* Echomail received */
int echo_imp = 0; /* Echomail imported */
int echo_out = 0; /* Echomail forwarded */