Thread View: news.software.readers
1 messages
1 total messages
Started by Troy Piggins
Sat, 02 Apr 2005 23:40
[slrn,vim,slang] help with mimegpg macro
Author: Troy Piggins
Date: Sat, 02 Apr 2005 23:40
Date: Sat, 02 Apr 2005 23:40
111 lines
4972 bytes
4972 bytes
I am trying to write, or possibly hack an existing, macro that
detects a mime-gpg signed post and removes the lines that slrn
hasn't handled properly. Unfortunately I have never written slang
before.
My question has a couple of parts - one to do with vim, but mostly
slang and slrn (versions in sig).
Background is from this post on the n.s.r group :
http://tinyurl.com/627bl
I have tried Tomasz Sienicki's macros with no success. I thought I
would read his code, and try to use the parts of it that detect the
mime boundaries etc to serve my purposes. When I started going
through the code, I noticed something odd with the brackets around
line 68 of his code from here:
http://cvs.pld-linux.org/cgi-bin/cvsweb/slrn-pl/macros/tsca-mymime.sl?rev=1.11
If I put the cursor on the first of the curly braces on line 68
which begins :
%{{{ multipart message
and in vim hit the '%' key, which should move the cursor to the
matching closing brace, it actually moves to a closing curly brace
on line 136. Odd, because it isn't even a comment brace set.
On line 72 there appears to be an opening brace that is not closed,
and I thought this was the problem. I inserted a closing curly
brace, and '%' then correctly matched the brace sets as expected.
But when I run slrn with the macro modified by me with the extra
brace, it exits with syntax error. With the unmodified braces it
runs fine.
Any explanations?
So I started a macro of my own (refer below), commented so you
hopefully understand my intentions. The hide_mimegpg function is
the one I am having trouble with not knowing how to finish. In the
comments, for my own convenience, I have included while writing some
of the lines in posts that I want to remove so I know the format of
them. I would think this simple for someone competent in slang (I
am not). Note that I know this macro does not actually /treat/ the
mime correctly, simply removes it for my viewing pleasure.
Any help/comments appreciated.
% Refer RFC 2015, RFC 3156.
% This macro does note make slrn understand mime-gpg
% it just hides the boundary shit.
private variable c_type = extract_displayed_article_header
("Content-Type");
define hide_mimegpg ()
{
variable hvr,len,bndry;
% extract the boundary:
% Content-Type: multipart/signed;
% boundary="=_mimegpg-commodore.email-scan.com-31974-1112227567-0007";
% micalg=pgp-sha1;
% protocol="application/pgp-signature"
(hvr,len) = string_match_nth(1); % not sure if we need another
string_match
% here
bndry = substr(c_type,hvr+1,len);
% then locate the boundary in post, which is after the "--":
% --=_mimegpg-commodore.email-scan.com-31974-1112227567-0007
% then remove lines before the first boundary to just after
% headers:
% This is a MIME GnuPG-signed message. If you see this text, it
% means that
% your E-mail or Usenet software does not support MIME signed
% messages.
% is it right to remove stuff before the boundary?
% then remove the whole paragraph of all occurrences of the
% boundary:
% --=_mimegpg-commodore.email-scan.com-31974-1112227567-0007
% Content-Type: text/plain; format=flowed; charset="US-ASCII"
% Content-Disposition: inline
% Content-Transfer-Encoding: 7bit
% --=_mimegpg-commodore.email-scan.com-31974-1112227567-0007
% Content-Type: application/pgp-signature
% Content-Transfer-Encoding: 7bit
% then remove lines after the last boundary which also ends in
% "--":
% --=_mimegpg-commodore.email-scan.com-31974-1112227567-0007--
}
define read_article_hook ()
{
% determine if post contains mimegpg - header begins:
% Content-Type: multipart/signed; boundary......
if (string_match(c_type,"\\Cmultipart/signed",1))
hide_mimegpg ();
}
Thanks
--
T R O Y P I G G I N S
e : usenet@piggo.com
[slrn 0.9.8.1, slang and slang-devel 1.4.5-16.rpm, and vim 6.1]
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads