From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by 10.86.87.8 with SMTP id k8cs249718fgb; Wed, 17 Mar 2010 13:32:07 -0700 (PDT) Received: by 10.224.116.8 with SMTP id k8mr433301qaq.134.1268857920450; Wed, 17 Mar 2010 13:32:00 -0700 (PDT) Return-Path: Received: from rubyforge.org (rubyforge.org [205.234.109.19]) by mx.google.com with ESMTP id 28si13134690qyk.14.2010.03.17.13.32.00; Wed, 17 Mar 2010 13:32:00 -0700 (PDT) Received-SPF: pass (google.com: domain of sup-talk-bounces@rubyforge.org designates 205.234.109.19 as permitted sender) client-ip=205.234.109.19; Authentication-Results: mx.google.com; spf=pass (google.com: domain of sup-talk-bounces@rubyforge.org designates 205.234.109.19 as permitted sender) smtp.mail=sup-talk-bounces@rubyforge.org Received: from rubyforge.org (rubyforge.org [127.0.0.1]) by rubyforge.org (Postfix) with ESMTP id D35531D7949F; Wed, 17 Mar 2010 16:31:59 -0400 (EDT) Received: from proofpoint2.lanl.gov (proofpoint2.lanl.gov [204.121.3.26]) by rubyforge.org (Postfix) with ESMTP id 3CE1A18582BF for ; Wed, 17 Mar 2010 16:31:41 -0400 (EDT) Received: from mailrelay1.lanl.gov (mailrelay1.lanl.gov [128.165.4.101]) by proofpoint2.lanl.gov (8.14.3/8.14.3) with ESMTP id o2HKT9qh023340 for ; Wed, 17 Mar 2010 14:31:40 -0600 Received: from ccn-mail.lanl.gov (ccn-mail.lanl.gov [128.165.4.105]) by mailrelay1.lanl.gov (Postfix) with ESMTP id 4CB8E245EEF for ; Wed, 17 Mar 2010 14:31:32 -0600 (MDT) Received: from localhost (localhost.localdomain [127.0.0.1]) by ccn-mail.lanl.gov (Postfix) with ESMTP id 49C9241005B for ; Wed, 17 Mar 2010 14:31:32 -0600 (MDT) X-NIE-2-Virus-Scanner: amavisd-new at ccn-mail.lanl.gov Received: from guava.lanl.gov (guava.lanl.gov [128.165.229.10]) by ccn-mail.lanl.gov (Postfix) with ESMTP id 25B66410058 for ; Wed, 17 Mar 2010 14:31:32 -0600 (MDT) From: John Bent To: sup-talk In-reply-to: <1268853590-sup-9103@guava.lanl.gov> References: <1268341771-sup-2631@guava.lanl.gov> <1268853590-sup-9103@guava.lanl.gov> Date: Wed, 17 Mar 2010 14:31:31 -0600 Message-Id: <1268857847-sup-547@guava.lanl.gov> User-Agent: Sup/0.10.2 Content-Transfer-Encoding: 8bit Content-Type: multipart/mixed; boundary="=-1268857891-943992-89227-9007-2-=" MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=1.12.8161:2.4.5, 1.2.40, 4.0.166 definitions=2010-03-17_15:2010-02-06, 2010-03-17, 2010-03-17 signatures=0 Subject: Re: [sup-talk] printing emails (but not attachments) X-BeenThere: sup-talk@rubyforge.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: User & developer discussion of Sup List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: sup-talk-bounces@rubyforge.org Errors-To: sup-talk-bounces@rubyforge.org --=-1268857891-943992-89227-9007-2-= Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Excerpts from John Bent's message of Wed Mar 17 13:25:02 -0600 2010: > Excerpts from John Bent's message of Thu Mar 11 14:11:21 -0700 2010: > > I've been piping emails into muttprint which works well unless there's > > a binary attachment. When there's a binary attachment, muttprint > > prints it and it usually takes tens and tens of pages. Whoops. > > > > Anyone else figure out how to print emails but not attachments? > > > Well, I'm sure I've once again reinvented the wheel but I wrote my own > script to print emails without printing binary attachments. It reads an > email, pipes the headers to muttprint, then pipes text/plain and > text/html through w3m into muttprint, for everything else it pipes "# > Attachment: filename (type)." It requires w3m and muttprint to be in > the user's path. > > I'm sorry that it's horribly in violation of sup philosophy but I wrote > it in python. :( Sorry but my ruby is just barely good enough to do > 'if' statements in my hooks. > > It's attached in case anyone else wants it. I'm scared I really did > just reinvent the wheel, otherwise I'd add it to the wiki. To print an > email from sup using this, hit '|' in thread-view-mode to open a pipe > and then just type sup-print (assuming you've put this attachment in > your path). I believe all the python imports it uses come standard. > Sorry, it wasn't handling quoted-printable encodings. Patched version attached. -- Thanks, John --=-1268857891-943992-89227-9007-2-= Content-Disposition: attachment; filename="sup-print" Content-Type: application/octet-stream; name="sup-print" Content-Transfer-Encoding: base64 IyEgL3Vzci9iaW4vZW52IHB5dGhvbgoKaW1wb3J0IGVtYWlsCmltcG9ydCBz eXMKZnJvbSBzdWJwcm9jZXNzIGltcG9ydCBQb3BlbixQSVBFCgojIHJlYWQg aW4gdGhlIGVtYWlsIG1lc3NhZ2UgZnJvbSBhbiBhcmcgb3Igc3RkaW4KZGVm IGdldF9tZXNzYWdlKCk6CiAgICB0cnk6IAogICAgICAgIGZwID0gb3Blbihz eXMuYXJndlsxXSkKICAgIGV4Y2VwdCBJbmRleEVycm9yOgogICAgICAgIGZw ID0gc3lzLnN0ZGluIAogICAgcmV0dXJuIGVtYWlsLm1lc3NhZ2VfZnJvbV9m aWxlKGZwKQoKIyBvcGVuIGEgcGlwZSB0byBtdXR0cHJpbnQKZGVmIG9wZW5f bXV0dHByaW50KCk6CiAgICB0cnk6CiAgICAgICAgbXV0dCA9IFBvcGVuKCJt dXR0cHJpbnQiLHNoZWxsPVRydWUsc3RkaW49UElQRSkKICAgIGV4Y2VwdCBP U0Vycm9yLCBlOgogICAgICAgIHByaW50ICJwb3BlbiBtdXR0cHJpbnQgZmFp bGVkOiIsIGUKICAgICAgICBzeXMuZXhpdCgpCiAgICByZXR1cm4gbXV0dAoK IyB3cml0ZSBhbGwgdGhlIGhlYWRlcnMgdG8gbXV0dHByaW50CmRlZiB3cml0 ZV9oZWFkZXIoIG1zZywgbXV0dCApOgogICAgZm9yIGtleSBpbiBtc2cua2V5 cyggKToKICAgICAgICB2YWwgPSBtc2cuX19nZXRpdGVtX18oa2V5KQogICAg ICAgIHBpcGVfbXV0dCggIiVzOiAlc1xuIiAlICgga2V5LCB2YWwgKSwgbXV0 dCApCiAgICBwaXBlX211dHQoICJcbiIsIG11dHQgKSAjIG9uZSBleHRy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ogICAgICAgIGNo LndhaXQoKQogICAgICAgIGlmIGxlbihlcnIpOgogICAgICAgICAgICBwcmlu dCAiRXJyb3Igd2l0aCB3M206ICVzIiAlIGVycgogICAgICAgICAgICBzeXMu ZXhpdCgpCiAgICAgICAgcGlwZV9tdXR0KCBvdXQgKyAiXG4iLCBtdXR0ICkK ICAgIGVsaWYgcGFydC5nZXRfZmlsZW5hbWUoKSBpcyBub3QgTm9uZToKICAg ICAgICBwaXBlX211dHQoIiMgQXR0YWNobWVudDogJXMgKCVzKVxuIiAlIChw YXJ0LmdldF9maWxlbmFtZSgpLHR5cGUpLG11dHQpCgppZiBfX25hbWVfXyA9 PSAnX19tYWluX18nOgogICAgbXNnICA9IGdldF9tZXNzYWdlKCApCiAgICBt dXR0ID0gb3Blbl9tdXR0cHJpbnQoKQogICAgd3JpdGVfaGVhZGVyKCBtc2cs IG11dHQgKQogICAgZm9yIHBhcnQgaW4gbXNnLndhbGsoKTogd3JpdGVfcGFy dCggcGFydCwgbXV0dCApCiAgICBtdXR0LnN0ZGluLmNsb3NlKCkK --=-1268857891-943992-89227-9007-2-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ sup-talk mailing list sup-talk@rubyforge.org http://rubyforge.org/mailman/listinfo/sup-talk --=-1268857891-943992-89227-9007-2-=--