X-Git-Url: https://git.deb.at/w?a=blobdiff_plain;f=contrib%2Ft-prot.sl;h=3548a9577c29a80e0d84acbda083189305889fa3;hb=c8ccc73dba899e9fdf86195394ce069b8daf1e15;hp=1fc1aad7bd64992c601d9243d025e241d33d01a6;hpb=3319969a89bb47afbd35da55d8c0d62a33be9ca7;p=pkg%2Ft-prot.git diff --git a/contrib/t-prot.sl b/contrib/t-prot.sl index 1fc1aad..3548a95 100644 --- a/contrib/t-prot.sl +++ b/contrib/t-prot.sl @@ -1,5 +1,5 @@ -% $Id: t-prot.sl,v 1.11 2005/01/07 18:15:36 jochen Exp $ -% Copyright (c) 2003 Jochen Striepe +% $Id: t-prot.sl,v 1.17 2006/05/16 11:33:32 jochen Exp $ +% Copyright (c) 2003-2005 Jochen Striepe % % This file is provided as an example implemention for articles to be % filtered through t-prot before displayed. They are still filtered if @@ -17,18 +17,23 @@ % variable t_prot_qp = ""; % into ~/.slrn/t-prot-cfg and add % interpret .slrn/t-prot-cfg -% to your ~/.slrnrc (after 'interpret t-prot.sl'). However, please keep -% in mind that the path of the temp directory should NOT be readable to -% other users -- otherwise it might reveal information on what you read, -% and probably even be a security hole. -% Please see t-prot's man page for details on command line parameters. +% to your ~/.slrnrc (after 'interpret t-prot.sl'). If "mimedecode" is +% installed on your system you might want to use +% variable t_prot_qp = "mimedecode"; +% You can get mimedecode at +% http://packages.debian.org/stable/mail/mimedecode.html +% +% However, please keep in mind that the path of the temp directory should +% NOT be readable to other users -- otherwise it might reveal information on +% what you read, and probably even be a security hole. Please see t-prot's +% man page for details on command line parameters. % % If you want to toggle t-prot filtering on/off without leaving slrn, % you may want to add something like -% setkey article register_t_prot "\e1" -% setkey article unregister_t_prot "\e0" -% to your ~/.slrnrc -- press ESC-1 to activate t-prot filtering, and -% ESC-0 to disable it (this will take effect on the next article you +% setkey article register_t_prot "\e6" +% setkey article unregister_t_prot "\e7" +% to your ~/.slrnrc -- press ESC-6 to activate t-prot filtering, and +% ESC-7 to disable it (this will take effect on the next article you % read, see the package's TODO file). % % Requirements/Bugs: tr(1) and rm(1) are POSIX and should be available @@ -36,8 +41,9 @@ % 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. As always, bug reports, patches (preferrably -% in unified diff format), comments and suggestions are welcome. +% fail with other versions (and will definitely fail with S-Lang v2.x). +% As always, bug reports, patches (preferrably in unified diff format), +% comments and suggestions are welcome. % % License: This file is part of the t-prot package and therefore % available under the same conditions. See t-prot's man page for @@ -46,7 +52,7 @@ % 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_tmpdir = "$HOME/tmp/slrn"; +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; };'"; define t_prot () { @@ -63,7 +69,15 @@ define t_prot () { if (t_prot_qp != "") { qp = t_prot_qp+"|"; } else { qp = ""; } - pipe_article (qp+"t-prot "+t_prot_params+" >"+fname); + + f = popen (qp+"t-prot "+t_prot_params+" >"+fname, "w"); + if (f == NULL) { + error ("Unable to filter article to "+fname); + return; + } + () = fputs (article_as_string(), f); + () = pclose (f); + f = fopen (fname, "r"); if (f == NULL) { @@ -75,9 +89,8 @@ define t_prot () { } fclose (f); - % The removal of the tmp file works this way but should be made a - % little more reliable. Any ideas? - system ("rm -f "+fname); + if (0 != remove(fname)) error ("Unable to remove "+fname); + replace_article (art); }