Skip Menu |
 

This queue is for tickets about the RT-Extension-CommandByMail CPAN distribution.

Report information
The Basics
Id: 31795
Status: open
Priority: 0/
Queue: RT-Extension-CommandByMail

People
Owner: Nobody in particular
Requestors: francois [...] ctrlaltdel.ch
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: (no value)

Attachments
RT-Extension-CommandByMail-command-strip-out-0.16.diff
RT-Extension-CommandByMail-command-strip-out.diff



Subject: [Patch] New configuration option: CommandByMailStripOut
MIME-Version: 1.0
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Charset: utf8
X-RT-Original-Encoding: utf-8
Content-Type: multipart/mixed; boundary="----------=_1198235829-25646-4"
Content-Length: 0
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: binary
Content-Length: 132
Download (untitled) / with headers
text/plain 132b
Attached patch adds a new configuration option CommandByMailStripOut which allows commands to be stripped out from the mail content.
Subject: RT-Extension-CommandByMail-command-strip-out.diff
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="----------=_1198235828-25646-3"
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Charset: utf8
Content-Length: 0
Content-Type: text/plain
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: iso-8859-1
Content-Length: 0
Content-Type: text/x-diff; name="RT-Extension-CommandByMail-command-strip-out.diff"
Content-Disposition: inline; filename="RT-Extension-CommandByMail-command-strip-out.diff"
Content-Transfer-Encoding: binary
Content-Length: 1386
diff -ur RT-Extension-CommandByMail-0.05/lib/RT/Interface/Email/Filter/TakeAction.pm RT-Extension-CommandByMail/lib/RT/Interface/Email/Filter/TakeAction.pm =================================================================== --- RT-Extension-CommandByMail-0.05/lib/RT/Interface/Email/Filter/TakeAction.pm (revision 826) +++ RT-Extension-CommandByMail/lib/RT/Interface/Email/Filter/TakeAction.pm (revision 1105) @@ -172,9 +172,11 @@ } my @content; + my $body; my @parts = $args{'Message'}->parts_DFS; + foreach my $part (@parts) { - my $body = $part->bodyhandle or next; + $body = $part->bodyhandle or next; #if it looks like it has pseudoheaders, that's our content if ( $body->as_string =~ /^(?:\S+):/m ) { @@ -205,6 +207,23 @@ } } + # Strip out commands from content if configuration says so + if ($RT::CommandByMailStripOut) { + my @content = $body->as_lines; + my $io = $body->open("w") or die "Cannot open body"; + + my $body_top = 1; + foreach my $line (@content) { + # Strip out commands only at the top + next if ($body_top && $line =~ /^(?:(\S+)\s*?:\s*?(.*)\s*?|)$/); + $body_top = 0; + + $io->print($line); + } + + $io->close() or die "Cannot close body"; + } + my %results; foreach my $cmd ( keys %cmds ) {
From simonw [...] simonwilcox.co.uk Wed Mar 5 14: 15:12 2014
MIME-Version: 1.0
X-Spam-Status: No, score=-1.901 tagged_above=-99.9 required=10 tests=[BAYES_00=-1.9, SPF_HELO_PASS=-0.001] autolearn=ham
X-Spam-Flag: NO
X-RT-Interface: API
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
Message-ID: <531777AE.5070302 [...] simonwilcox.co.uk>
Content-Type: multipart/mixed; boundary="------------050801070504030508040804"
X-Spam-Score: -1.901
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id AB2272404E1 for <cpan-bug+RT-Extension-CommandByMail [...] hipster.bestpractical.com>; Wed, 5 Mar 2014 14:15:11 -0500 (EST)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0ZNBeHjaBKyZ for <cpan-bug+RT-Extension-CommandByMail [...] hipster.bestpractical.com>; Wed, 5 Mar 2014 14:15:08 -0500 (EST)
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by hipster.bestpractical.com (Postfix) with SMTP id EC5B7240358 for <bug-RT-Extension-CommandByMail [...] rt.cpan.org>; Wed, 5 Mar 2014 14:15:07 -0500 (EST)
Received: (qmail 6702 invoked by alias); 5 Mar 2014 19:15:06 -0000
Received: from kea.ourshack.com (HELO kea.ourshack.com) (194.106.223.201) by la.mx.develooper.com (qpsmtpd/0.28) with ESMTP; Wed, 05 Mar 2014 11:15:01 -0800
Received: from [37.157.33.162] (helo=[192.168.1.150]) by kea.ourshack.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.72) (envelope-from <simonw [...] simonwilcox.co.uk>) id 1WLHHN-0003bP-11 for bug-RT-Extension-CommandByMail [...] rt.cpan.org; Wed, 05 Mar 2014 19:14:57 +0000
Delivered-To: cpan-bug+RT-Extension-CommandByMail [...] hipster.bestpractical.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0
Subject: [rt.cpan.org #31795] patch against v0.16
Return-Path: <simonw [...] simonwilcox.co.uk>
X-Spam-Check-BY: la.mx.develooper.com
X-Original-To: cpan-bug+RT-Extension-CommandByMail [...] hipster.bestpractical.com
X-RT-Mail-Extension: rt-extension-commandbymail
Date: Wed, 05 Mar 2014 19:14:54 +0000
X-Spam-Level:
To: bug-RT-Extension-CommandByMail [...] rt.cpan.org
From: Simon Wilcox <simonw [...] simonwilcox.co.uk>
RT-Message-ID: <rt-4.0.18-7532-1394046913-1102.31795-0-0 [...] rt.cpan.org>
Content-Length: 0
content-type: text/plain; charset="utf-8"; format="flowed"
Content-Transfer-Encoding: 7bit
X-RT-Original-Encoding: utf-8
Content-Length: 143
Download (untitled) / with headers
text/plain 143b
Hi, Here's a slightly revised patch that applies cleanly against v0.16 (latest as of 05 March 2014) I hope someone finds it useful. Simon.
content-type: text/plain; charset="utf-8"; name="RT-Extension-CommandByMail-command-strip-out-0.16.diff"
Content-Disposition: attachment; filename="RT-Extension-CommandByMail-command-strip-out-0.16.diff"
Content-Transfer-Encoding: 7bit
X-RT-Original-Encoding: utf-8
Content-Length: 1465

Message body is not shown because sender requested not to inline it.



This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.