Re: piping message thru demime
Troy Piggins <[email protected]>
| Newsgroups | gmane.network.slrn.user |
|---|---|
| Message-ID | <[email protected]> |
* Christian Ebert <[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. [snip] > 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"); > } Oh you little beauty! I got it working with one slight modification to the above. 'demime' complains if you don't tell it where to output, so I just changed the second line to : variable fp = popen ("echo '"+art_as_string+"' | /usr/local/bin/demime -", "r"); and it works. The "-" tells demime to send to stdout. Thankyou! -- Troy Piggins Ubuntu 5.10 pkgs : kernel 2.6.12-9-386, postfix 2.2.4, procmail 3.22 Compiled from src : slrn 0.9.8.1/rt (score_color patch), mutt 1.5.11i vim 6.4 ------------------------------------------------------- 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