-% $Id: t-prot.sl,v 1.17 2006/05/16 11:33:32 jochen Exp $
+% $Id: t-prot.sl,v 1.20 2012/02/07 11:19:57 jochen Exp $
% Copyright (c) 2003-2005 Jochen Striepe <t-prot@tolot.escape.de>
%
% This file is provided as an example implemention for articles to be
%
% If you are not happy with the suggested t-prot default parameters,
% put something like
-% variable t_prot_params = "-cemtS";
+% variable t_prot_params = "-c -emtS";
% variable t_prot_tmpdir = "$HOME/.tmpdir";
% variable t_prot_qp = "";
% into ~/.slrn/t-prot-cfg and add
% on any Unix-like system, mktemp(1) should be available on any recent
% OpenBSD or Debian Linux system -- you can get the sources there
% if your system happens to lack this program. This macro has been
-% tested with slrn-0.9.7.4 to slrn-0.9.8.0 and S-Lang v1.4.5, it might
-% fail with other versions (and will definitely fail with S-Lang v2.x).
+% written for S-Lang v2.x (and will definitely fail with S-Lang v1.x).
% As always, bug reports, patches (preferrably in unified diff format),
% comments and suggestions are welcome.
%
% these should be reasonable defaults (they work fine for me, SCNR):
-variable t_prot_params = "-aceklmtS --diff --bigq -L$HOME/.slrn/mlfooters -A$HOME/.slrn/adfooters";
+variable t_prot_params = "-aeklmtc -S --diff --bigq -L$HOME/.slrn/mlfooters -A$HOME/.slrn/adfooters";
variable t_prot_tmpdir = "$HOME/tmp/slrn"; % you better make sure it exists
variable t_prot_qp = "perl -i -p -e '$p=1 if /^Content-Transfer-Encoding: quoted-printable/i; if ($p==1) { s/=([0-9a-f][0-9a-f])/chr(hex($1))/egi; s/=\n//eg; };'";
f = popen (qp+"t-prot "+t_prot_params+" >"+fname, "w");
if (f == NULL) {
- error ("Unable to filter article to "+fname);
+ message ("Unable to filter article to "+fname);
return;
}
() = fputs (article_as_string(), f);
f = fopen (fname, "r");
if (f == NULL) {
- error (fname+" could not be opened.");
+ message (fname+" could not be opened.");
return;
}
while (-1 != fgets (&line, f)) {
}
fclose (f);
- if (0 != remove(fname)) error ("Unable to remove "+fname);
+ if (0 != remove(fname)) message ("Unable to remove "+fname);
replace_article (art);
}
define register_t_prot () {
if (1 == register_hook("read_article_hook", "t_prot")) {
- error("t-prot filtering activated");
+ message ("t-prot filtering activated");
}
else {
- error("t-prot filtering NOT activated");
+ message ("t-prot filtering NOT activated");
}
}
define unregister_t_prot () {
if (1 == unregister_hook("read_article_hook", "t_prot")) {
- error("t-prot filtering deactivated");
+ message ("t-prot filtering deactivated");
}
else {
- error("t-prot filtering NOT deactivated");
+ message ("t-prot filtering NOT deactivated");
}
}