Re: piping message thru demime

Christian Ebert <[email protected]>
Newsgroups gmane.network.slrn.user
Organization Black Trash Productions <http://www.blacktrash.org/>
Message-ID <[email protected]>
* Troy Piggins on Thursday, February 16, 2006 at 15:37:48 +1000:
> I'm working on a macro to convert MIME messages not handled
> correctly by slrn.
> 
> I'm using the perl script 'demime' if anyone knows it.  When I have
> the macro working I'll post it so others can use, along with demime
> installation instructions etc.
> 
> The macro below works:
> 
> define pipe_thru_demime ()
> {
>   pipe_article ("/usr/local/bin/demime - |
>     /usr/local/share/vim/vim64/macros/less.sh '+set ft=mail' -");
> }
> 
> 
> but it just pipes the message to 'less' - what I want is to use
> slrn's 'replace_article' function instead, but can't get that
> working.
> 
> Below is my what I was thinking about doing, but keep getting
> "S-Lang Error: Type Mismatch: Unable to typecast Integer_Type to
> String_Type" error.
> 
> define demime ()
> {
>   replace_article (system (sprintf ("echo %s |
>     /usr/local/bin/demime -", article_as_string ())));
> }

I don't know 'demime' so the following is completely untested and
perhaps broken, but I use something along this structure with a
python script, so perhaps it gives you some ideas:

define demime ()
{
  variable art_as_string = article_as_string ();
  variable fp = popen ("echo '"+art_as_string+"' | /usr/local/bin/demime", "r");
  variable art_demime = strjoin (fgetslines (fp), "");
  pclose (fp);
  if (art_demime != "") replace_article (art_demime);
  else error (_function_name () +": failed");
}

c
-- 
_B A U S T E L L E N_ lesen!  --->> <http://www.blacktrash.org/baustellen.html>


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=103432&bid=230486&dat=121642
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.