summaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-03-25 00:27:09 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-03-25 00:27:09 +0800
commit5224c5f743a51cdb225020bfb7e44fee63d9d7ad (patch)
treebdbd2cce89783248b50797c9c78ed2977293f7b8 /util
parent64a7cb22fd3a7acd63a7dcdb44f7c0f8265233aa (diff)
downloadpttbbs-5224c5f743a51cdb225020bfb7e44fee63d9d7ad.tar
pttbbs-5224c5f743a51cdb225020bfb7e44fee63d9d7ad.tar.gz
pttbbs-5224c5f743a51cdb225020bfb7e44fee63d9d7ad.tar.bz2
pttbbs-5224c5f743a51cdb225020bfb7e44fee63d9d7ad.tar.lz
pttbbs-5224c5f743a51cdb225020bfb7e44fee63d9d7ad.tar.xz
pttbbs-5224c5f743a51cdb225020bfb7e44fee63d9d7ad.tar.zst
pttbbs-5224c5f743a51cdb225020bfb7e44fee63d9d7ad.zip
:)
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@63 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'util')
-rw-r--r--util/Makefile9
-rw-r--r--util/filtermail.pl43
2 files changed, 49 insertions, 3 deletions
diff --git a/util/Makefile b/util/Makefile
index 2b7aa690..c1cbf06c 100644
--- a/util/Makefile
+++ b/util/Makefile
@@ -1,7 +1,7 @@
-# $Id: Makefile,v 1.5 2002/03/23 13:19:40 in2 Exp $
+# $Id: Makefile,v 1.6 2002/03/24 16:27:09 in2 Exp $
BBSHOME?=$(HOME)
-OSTYPE=linux
+OSTYPE?=linux
# FreeBSD
CC_FreeBSD= gcc
@@ -34,7 +34,8 @@ CPROGS= bbsmail BM_money post account birth deluserfile expire mandex\
PROGS= $(CPROGS) BM_money.sh backpasswd.sh mailog.sh opendice.sh\
openticket.sh stock.sh topsong.sh weather.sh stock.perl weather.perl\
- toplazyBM.sh toplazyBBM.sh dailybackup.pl tarqueue.pl waterball.pl
+ toplazyBM.sh toplazyBBM.sh dailybackup.pl tarqueue.pl waterball.pl \
+ filtermail.pl
all: $(PROGS)
@@ -159,6 +160,8 @@ install: $(PROGS)
install -d $(BBSHOME)/bin/
install -c -m 755 $(PROGS) $(BBSHOME)/bin/
chmod 4755 $(BBSHOME)/bin/post
+ mv $(BBSHOME)/bin/bbsmail $(BBSHOME)/bin/realbbsmail
+ ln -s $(BBSHOME)/bin/filtermail.pl $(BBSHOME)/bin/bbsmail
clean:
rm -f *.o $(CPROGS)
diff --git a/util/filtermail.pl b/util/filtermail.pl
new file mode 100644
index 00000000..45c13c86
--- /dev/null
+++ b/util/filtermail.pl
@@ -0,0 +1,43 @@
+#!/usr/bin/perl
+if( -e '/usr/bin/mktemp' ){
+ $fn = `/usr/bin/mktemp -q /tmp/filtermail.XXXXXXXX`;
+}
+else{
+ $fn = `/bin/mktemp -q /tmp/filtermail.XXXXXXXX`;
+}
+chomp $fn;
+
+$bbsuid = $ARGV[0];
+undef @ARGV;
+
+open FH, ">$fn";
+$norelay = 0;
+while( <> ){
+ print FH $_;
+# if( ($bbsuid) = $_ =~ /for \<(\w+)\.bbs\@ptt/ ){
+# }
+ if( /^Content-Type:/i ){
+ $norelay = 1 if( (/multipart/i && !/report/i) || /html/ );
+ last;
+ }
+}
+while( <> ){
+ print FH $_;
+}
+close FH;
+
+if( !$norelay ){
+ open FH, "<$fn";
+ open OUT, "|/home/bbs/bin/realbbsmail $bbsuid";
+ while( <FH> ){
+ print OUT $_;
+ }
+ close FH;
+ close OUT;
+ unlink $fn;
+}
+else{
+ $to = substr($fn, rindex($fn, '/') + 1);
+ `/bin/mv $fn /tmp/norelay/$to`;
+}
+