[Bps-public-commit] RT-Extension-CommandByMail branch, master, updated. 0.10-22-g0ef6098
Thomas Sibley
trs at bestpractical.com
Mon Jul 22 14:07:27 EDT 2013
The branch, master has been updated
via 0ef609828ad9f0618220e486767d893b16aa1f02 (commit)
via 27e32c89f1db00c408969b9ac0afae64b78b2f21 (commit)
via ea04c376e3d349b5e5e298f778c9fcafb7d8fb71 (commit)
from 2865df92e3ed4c9ea40db36c336e70d8fe83eefa (commit)
Summary of changes:
INSTALL | 5 +++++
README | 4 ++--
lib/RT/Interface/Email/Filter/TakeAction.pm | 15 ++++++++++++---
3 files changed, 19 insertions(+), 5 deletions(-)
- Log -----------------------------------------------------------------
commit ea04c376e3d349b5e5e298f778c9fcafb7d8fb71
Author: Tollef Fog Heen <tfheen at err.no>
Date: Thu Jul 12 14:23:37 2012 +0200
Look for commands in headers too
This allows us to parse a configurable header for commands too, by
setting the CommandByMailHeader setting.
diff --git a/INSTALL b/INSTALL
index 78f777f..d8fdaeb 100644
--- a/INSTALL
+++ b/INSTALL
@@ -52,5 +52,10 @@ There is an optional configuration option CommandByMailGroup
Set($CommandByMailGroup, group_id);
You can find the id by browsing to Configuration -> Groups
+You can get it to look for commands in headers as well by setting
+CommandByMailHeader like:
+
+ Set($CommandByMailHeader, "X-RT-Command");
+
Enjoy.
diff --git a/README b/README
index 2745ed2..c6c404d 100644
--- a/README
+++ b/README
@@ -10,8 +10,8 @@ This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.
DESCRIPTION
- This extension parse content of incoming messages for list commands.
- Format of commands is:
+ This extension parses the body and headers of incoming messages
+ for list commands. Format of commands is:
Command: value
Command: value
diff --git a/lib/RT/Interface/Email/Filter/TakeAction.pm b/lib/RT/Interface/Email/Filter/TakeAction.pm
index 7e4030e..dd9f60a 100644
--- a/lib/RT/Interface/Email/Filter/TakeAction.pm
+++ b/lib/RT/Interface/Email/Filter/TakeAction.pm
@@ -18,8 +18,8 @@ RT::Interface::Email::Filter::TakeAction - Change metadata of ticket via email
=head1 DESCRIPTION
-This extension parse content of incomming messages for list commands. Format
-of commands is:
+This extension parses the body and headers of incoming messages for
+list commands. Format of commands is:
Command: value
Command: value
@@ -183,6 +183,10 @@ sub GetCurrentUser {
$RT::Logger->debug("Running CommandByMail as ".$args{'CurrentUser'}->UserObj->Name);
+ my $headername = $new_config
+ ? RT->Config->Get('CommandByMailHeader')
+ : $RT::CommandByMailHeader;
+
# find the content
my @content;
my @parts = $args{'Message'}->parts_DFS;
@@ -196,6 +200,10 @@ sub GetCurrentUser {
}
}
+ if (defined $headername) {
+ unshift @content, $args{'Message'}->head->get_all($headername);
+ }
+
my @items;
my $found_pseudoheaders = 0;
foreach my $line (@content) {
commit 27e32c89f1db00c408969b9ac0afae64b78b2f21
Merge: 2865df9 ea04c37
Author: Thomas Sibley <trs at bestpractical.com>
Date: Mon Jul 22 10:40:34 2013 -0700
Merge remote-tracking branch 'github/pr/2'
commit 0ef609828ad9f0618220e486767d893b16aa1f02
Author: Thomas Sibley <trs at bestpractical.com>
Date: Mon Jul 22 11:02:33 2013 -0700
Stop parsing headers when we stop finding them
Fixes a regression introduced by 33d0239 which caused t/create.t to
start failing (on line 88).
diff --git a/lib/RT/Interface/Email/Filter/TakeAction.pm b/lib/RT/Interface/Email/Filter/TakeAction.pm
index 0646494..d099556 100644
--- a/lib/RT/Interface/Email/Filter/TakeAction.pm
+++ b/lib/RT/Interface/Email/Filter/TakeAction.pm
@@ -222,7 +222,8 @@ sub GetCurrentUser {
foreach my $line (@content) {
next if $line =~ /^\s*$/ && ! $found_pseudoheaders;
last if $line !~ /^(?:(\S+(?:{.*})?)\s*?:\s*?(.*)\s*?|)$/;
- next unless defined $1;
+ last if not defined $1 and $found_pseudoheaders;
+ next if not defined $1;
$found_pseudoheaders = 1;
push( @items, $1 => $2 );
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list