#
#   This filter mech is to allow experimentation with things like:
#     Naughty word filters.
#     7PLUS auto decode and validity checking.
#     Dare I say it, but killing off 7PLUS completely (hopefully to be
#       used with some moderation, e.g. extract the number of parts and
#       total size/estimated total size to see if its a reasonable size
#       file for your particular network speed).
#     Choking 7PLUS propagation, to allow an even spead of traffic, e.g.
#       put parts on slow forwarding release if a BBS decides to upload
#       all 100 parts simultaneously, or if they all get held up somewhere
#       and appear in one go on this BBS (e.g. M0DEM link).  This BBS
#       could then be setup to slow release them into the network.
#     Converting 7PLUS to UUENCODE to pass through a IP network, and
#       post to a binary group, either UUENCODE the 7PLUS part or
#       auto-decode and post it to *.binary.* or make it available for FTP
#       and send out a marker article to tell everyone it has arrived.
#     Halting 7PLUS for forwarding until all parts arrive and are intact.
#     /ACK will be implemented through a filter.
#     AUTO7P/REQDIR/REQFIL/REQCFG/REQFOO/CLIVE/GOPHER *could* be implemented
#       through a filter.
#     Holding messages for review will be implemented through a filter.
#     Message statistics.
#     PGP singature verification.
#
#
#     Things for me to thing about, bit mask in return code so signify if
#	an ID should be added to the history db or not.  Bit mask to allow
#	the filter to change the message contents (head,body,subject) etc...
#	Bit mask to not pass it thru this particular filter again, or do.
#
#
#   FORMAT:
#   <to> <at> <from>   <type_of_filter>	<apply_to_mask>	<prog>	[[<args...>] <args...>]
#
#
#   <to> = To field	(* = ANY)
#
#   <at> = At field	(* = ANY, ! = $MySystemHa)
#
#   <fm> = From field	(* = ANY)
#
#   <type_of_filter> is setup with letter flags:
#      (setting 'J' is same as setting 'HBRT', the default will not pipe anything)
#      J = Send it job format only
#      H = Send it the job header only
#      B = Send it the body (this does not include R: or T: lines, but the
#                            top line is the Subject)
#      R = Send it R: lines
#      T = Send it T: lines
#      (format is <JobHdr><BLANK><Subject><R:><T:><Body> depending on what
#       has been selected, the <BLANK> goes with <JobHdr>)
#      
#      A = Async (default is SYNC, the return code is discarded so setting
#                 '1' or '2' as well is meaningless)
#
#
#      These return codes might change at short/no notice, so please check
#         this file supplied with your distribution each time while
#         Alpha/Beta testing.
#                
#      1 = Return codes are type 1	(default)
#          rtn = :
#                   0 - Ok carry on
#                   1 - Halt, filter had a problem in running,
#                       so retry lata.
#                   2 - Don't forward elsewhere, only process localy
#                   3 - Don't process locally but forward on
#                   4 - ????
#                 254 - DUMP IT NOW!!!
#                 255 - INTERNAL ERROR, IN PROCESSING FILTER, A FILTER ITSELF
#			SHOULDN'T USE THIS CODE.
#           (unknown) - has the same effect as 254
#      2 = Return codes are type 2
#          rtn = :
#                   0 - Ok carry on
#		    1 - Filter has changed header(s) and/or body
#                 254 - DUMP IT NOW!!!
#           (unknown) - has the same effect as 0
#
#   <apply_to_mask> is a bit mask (value to be written in decimal):
#  P         :  0 :    1 : Personal
#  B         :  1 :    2 : Bulletins
#  BIN       :  2 :    4 : Binary files (uploaded as BINARY type!, e.g. FB when [..BF..])
#  A         :  4 :    8 : Ack (type)
#
#  Allowed, but not implemented yet:
#  NOBBS     :  8 :  256 : Don't check systems with BBS status
#  NOBBSAUTH :  9 :  512 : Don't check systems with BBS status that did use some form
#                            of authentication to forward it to me
#  NOAUTH    : 10 : 1024 : Anyone who use did NOT use some form of authentication
#                            to upload the message
#
#  NOIN      : 12 : 4096 : Don't check Incoming items.
#  NOOUT     : 13 : 8192 : Don't check Outgoing items (as in originating from this BBS,
#                            this includes all items gated from the IP side going out).
#  MINE      : 14 : 16738 : Only check if this message will be taken locally.
#  NOTMINE   : 15 : 32768 : Only check if this message will not be taken locally. 
#
#   If a *funny* message type ever crops up, it will follow as if being a Personal.
#
#   If <prog> has no leading '/' it will be taken relative to $BinDir.
#
#   <args...> are optional arguments with some special tokens:
#	%A = At
#	%B = At up to first '.'
#	%C = Last Rline HA
#	%D = Last Rline HA up to first '.'
#	%F = From
#	%H = SystemNameHA (in uppercase)
#	%I = Id
#	%L = Local number
#	%N = SystemName (in uppercase)
#	%P = Peer it came from
#	%R = Last rline, in rlines
#	%S = Subject
#	%T = To
#	%U = Unix time of date of article
#	%V = Type by ASCII
#	%Z = Size of msg
#
#   CASE convertion modifiers
#
#  %T  will leave alone
#  %+T will convert to uppercase
#  %-T will convert to lowercase
#
#
#     
#   ALL entried by have ALL fields present (expect optional args...),
#     otherwise it'll be ignored.
#
#   Should a problem occur where a filter can be run then if the machine
#     is unable to fork() or the filter program does not exist it'll abort
#     processing the article, and assign it back to the $BatchSpool.
#
#   First section as ever is global.
#
#
#   NOTE:   These are merely examples of how you go about it.  Please
#           examine and test each filter program/script as some/many might
#           not do anything at all. 
#
*	*	*	JA	P	/usr/lbbs/contrib/acker/acker.pl -f "%C" -m "%N" -a "%B"
*	*	*	RA	15	/usr/lbbs/contrib/icao/iaruscan.pl
*	*	*	RA	15	/usr/lbbs/contrib/rstats/bin/rstats.pl
*	*	*	JA	15	/usr/lbbs/contrib/7plus-rx/bin/7plus-rx.pl
#*	*	*	J	15	/usr/lbbs/contrib/mfilter/mfilter.pl
#
#
#   This is system specific filters, when spooling OUT to.
#
[GB7MIP]
*	*	*	JA	P,B,BIN,A	gb7mip/filter.tst
#*	*	*	HA	15	tpk-beacon -p 3 -T TEST -t %+T -f %+F -a %+A -l %L -d %U -y %V -z %Z -s "%S"
#
#
#   The local system is denoted by an asterisk in the system hdr
#
[*]
#
#*	*	*	HA	15	tpk-beacon -P G7LED-8 -T FBB -t %+T -f %+F -a %+A -l %L -d %U -y %V -z %Z -s "%S"
*	*	*	HA	B,BIN	tpk-beacon -p 1 -t %+T -f %+F -a %+A -l %L -d %U -y %V -z %Z -s "%S"
*	*	*	HA	B,BIN	tpk-beacon -p 2 -t %+T -f %+F -a %+A -l %L -d %U -y %V -z %Z -s "%S"
*	*	*	HA	B,BIN	tpk-beacon -p 3 -t %+T -f %+F -a %+A -l %L -d %U -y %V -z %Z -s "%S"
# Hmm... will TPK work with this?  No... ho ho ho...
# Maybe a it should recognise some kind of R: line, but this makes it a
#  little less obvious to someone little critter listening whose mail could
#  be prone for attack/deletion.
*	*	*	HA	P,A	tpk-beacon -p 1 -t "USER" -f "CALL" -a "BBS" -l %L -d %U -y %V -z %Z -s "(Personal)"
*	*	*	HA	P,A	tpk-beacon -p 2 -t "USER" -f "CALL" -a "BBS" -l %L -d %U -y %V -z %Z -s "(Personal)"
*	*	*	HA	P,A	tpk-beacon -p 3 -t "USER" -f "CALL" -a "BBS" -l %L -d %U -y %V -z %Z -s "(Personal)"
#
WP	!	*	J1	1	serv/wpserv
#  The only on which really half works...
REQDIR	!	*	H1	P	serv/reqdir %-F@%-D.nts "%S"
REQFIL	!	*	J1	1	serv/reqfil
REQCFG	!	*	J1	1	serv/reqcfg
AUTO7P	!	*	J1	1	serv/auto7p
#  Auto 7plus correction file server... ???
#AUTO7C	!	*	J1	1	serv/auto7c
AUTOUU	!	*	J1	1	serv/autouu
GOPHER	!	*	J1	1	serv/gopher
CLIVE	!	*	J1	1	serv/clive
#  PGP Key (trusted - cough, cough) server
KEYSRV	!	*	J1	1	serv/keysrv
#
#
#   IMPORTANT MARKER FOLLOWS, LEAVE ALONE
#
! THE END
