[Rt-commit] r4291 - in RT-Extension-Redacted: . lib lib/RT
lib/RT/Action lib/RT/Extension
alexmv at bestpractical.com
alexmv at bestpractical.com
Mon Dec 12 15:44:14 EST 2005
Author: alexmv
Date: Mon Dec 12 15:44:14 2005
New Revision: 4291
Added:
RT-Extension-Redacted/MANIFEST
RT-Extension-Redacted/Makefile.PL
RT-Extension-Redacted/lib/
RT-Extension-Redacted/lib/RT/
RT-Extension-Redacted/lib/RT/Action/
RT-Extension-Redacted/lib/RT/Action/SendEmail_Vendor.pm
RT-Extension-Redacted/lib/RT/Extension/
RT-Extension-Redacted/lib/RT/Extension/Redacted.pm
Modified:
RT-Extension-Redacted/ (props changed)
Log:
r7692 at zoq-fot-pik: chmrr | 2005-12-12 15:43:44 -0500
* First pass
Added: RT-Extension-Redacted/MANIFEST
==============================================================================
--- (empty file)
+++ RT-Extension-Redacted/MANIFEST Mon Dec 12 15:44:14 2005
@@ -0,0 +1,14 @@
+inc/Module/Install.pm
+inc/Module/Install/Base.pm
+inc/Module/Install/Can.pm
+inc/Module/Install/Fetch.pm
+inc/Module/Install/Makefile.pm
+inc/Module/Install/Metadata.pm
+inc/Module/Install/RTx.pm
+inc/Module/Install/Win32.pm
+inc/Module/Install/WriteAll.pm
+lib/RT/Action/SendEmail_Vendor.pm
+lib/RT/Extension/Redacted.pm
+Makefile.PL
+MANIFEST This list of files
+META.yml
Added: RT-Extension-Redacted/Makefile.PL
==============================================================================
--- (empty file)
+++ RT-Extension-Redacted/Makefile.PL Mon Dec 12 15:44:14 2005
@@ -0,0 +1,6 @@
+use inc::Module::Install;
+
+RTx('RT-Extension-Redacted');
+license('perl');
+author('Jesse Vincent <jesse at bestpractical.com>');
+&WriteAll;
Added: RT-Extension-Redacted/lib/RT/Action/SendEmail_Vendor.pm
==============================================================================
--- (empty file)
+++ RT-Extension-Redacted/lib/RT/Action/SendEmail_Vendor.pm Mon Dec 12 15:44:14 2005
@@ -0,0 +1,78 @@
+# BEGIN BPS TAGGED BLOCK {{{
+#
+# COPYRIGHT:
+#
+# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC
+# <jesse at bestpractical.com>
+#
+# (Except where explicitly superseded by other copyright notices)
+#
+#
+# LICENSE:
+#
+# This work is made available to you under the terms of Version 2 of
+# the GNU General Public License. A copy of that license should have
+# been provided with this software, but in any event can be snarfed
+# from www.gnu.org.
+#
+# This work is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+#
+# CONTRIBUTION SUBMISSION POLICY:
+#
+# (The following paragraph is not intended to limit the rights granted
+# to you to modify and distribute this software under the terms of
+# the GNU General Public License and is only of importance to you if
+# you choose to contribute your changes and enhancements to the
+# community by submitting them to Best Practical Solutions, LLC.)
+#
+# By intentionally submitting any modifications, corrections or
+# derivatives to this work, or any other work intended for use with
+# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+# you are the copyright holder for those contributions and you grant
+# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
+# royalty-free, perpetual, license to use, copy, create derivative
+# works based on those contributions, and sublicense and distribute
+# those contributions and any derivatives thereof.
+#
+# END BPS TAGGED BLOCK }}}
+
+no warnings qw(redefine);
+
+package RT::Action::SendEmail;
+
+sub Commit {
+ my $self = shift;
+
+ # Find the text/* parts of the email
+ my $MIMEObj = $self->TemplateObj->MIMEObj;
+ my @parts = grep {$_->mime_type =~ m!^text/!} $MIMEObj->parts_DFS;
+
+ for my $p (@parts) {
+ # For each part, grab the body handle (if any)
+ my $body = $p->bodyhandle;
+ next unless $body;
+
+ # Do the replacement on it
+ my $str = $body->as_string;
+ # We special case to deal with embedded newlines in the redaction tag
+ $str =~ s/\[REDACT(?:ED)?(.*?)\](\S*)( ?)/"[REDACTED]" .(index($1, "\n") >= 0 ? "$2\n" : "$2$3")/seg;
+
+ # Write it back
+ my $IO = $body->open("w");
+ $IO->print($str);
+ $IO->close;
+ }
+
+ # Now go ahead and send the mail
+ return($self->SendMessage($self->TemplateObj->MIMEObj));
+}
+
+1;
Added: RT-Extension-Redacted/lib/RT/Extension/Redacted.pm
==============================================================================
--- (empty file)
+++ RT-Extension-Redacted/lib/RT/Extension/Redacted.pm Mon Dec 12 15:44:14 2005
@@ -0,0 +1,3 @@
+package RT::Extension::Redacted;
+
+our $VERSION = '0.1';
More information about the Rt-commit
mailing list