[Bps-public-commit] RT-Extension-CommandByMail branch, ignore-unknown-commands, created. 2.01-3-g630c642

Dustin Graves dustin at bestpractical.com
Thu Sep 8 19:12:13 EDT 2016


The branch, ignore-unknown-commands has been created
        at  630c642cdeaad760e794fb6cf0f878f38abba214 (commit)

- Log -----------------------------------------------------------------
commit 810bdf4938d38b1d933755bb4e0852dc09064a18
Author: Dustin Graves <dustin at bestpractical.com>
Date:   Fri Aug 12 19:12:00 2016 +0000

    remove error for unknown commands and add config setting $CommandByMailErrorOnUnknown to restore default behavior

diff --git a/Changes b/Changes
index f60c7a9..b1c1d90 100644
--- a/Changes
+++ b/Changes
@@ -1,3 +1,10 @@
+3.00 2016-09-08
+ - Change default behavior for unknown commands: Unknown commands no longer
+   generate an unknown command email. There will be a warning in the logs
+   whenever an ignored command is encountered.
+ - Add new config option $CommandByMailErrorOnUnknown to restore previous
+   behavior before the above change
+
 2.01 2016-04-11
  - Recreate ParseCcAddressesFromHead to support create with
    ParseNewMessageForTicketCcs set
diff --git a/README b/README
index b2bfcdf..619a9e2 100644
--- a/README
+++ b/README
@@ -15,6 +15,14 @@ SYNOPSIS
 
         The comment/reply text goes here
 
+IMPORTANT
+    For users of versions of this extension prior to 3.0: Please note that
+    now you will not receive an unknown command error email for unknown
+    commands. There will be a warning in the logs whenever an unknown
+    command is encountered. A setting was added to restore the previous
+    behavior. See the setting $CommandByMailErrorOnUnknown under
+    "Configuration" for more information.
+
 INSTALLATION
     perl Makefile.PL
     make
@@ -75,6 +83,11 @@ CONFIGURATION
     If set, the body will not be examined, only the header defined by the
     previous configuration option.
 
+  $CommandByMailErrorOnUnknown
+    Prior to 2.02, this extension throws an error if it finds an unknown
+    command. This is no longer the case. Setting this option will restore
+    that legacy behavior.
+
 CAVEATS
     This extension is incompatible with UnsafeEmailCommands RT option.
 
diff --git a/lib/RT/Extension/CommandByMail.pm b/lib/RT/Extension/CommandByMail.pm
index cc20218..5911b23 100644
--- a/lib/RT/Extension/CommandByMail.pm
+++ b/lib/RT/Extension/CommandByMail.pm
@@ -33,6 +33,14 @@ Works with RT 4.0, 4.2, 4.4
 
     The comment/reply text goes here
 
+=head1 IMPORTANT
+
+For users of versions of this extension prior to 3.0: Please note that now you
+will not receive an unknown command error email for unknown commands. There
+will be a warning in the logs whenever an unknown command is encountered. A
+setting was added to restore the previous behavior. See the setting
+C<$CommandByMailErrorOnUnknown> under "Configuration" for more information.
+
 =head1 INSTALLATION
 
 =over
@@ -106,6 +114,12 @@ as well.  For example:
 If set, the body will not be examined, only the header defined by the previous
 configuration option.
 
+=head2 C<$CommandByMailErrorOnUnknown>
+
+Prior to 2.02, this extension throws an error if it finds an unknown command.
+This is no longer the case. Setting this option will restore that legacy
+behavior.
+
 =head1 CAVEATS
 
 This extension is incompatible with C<UnsafeEmailCommands> RT option.
@@ -376,6 +390,11 @@ sub ProcessCommands {
 
     foreach my $cmd ( keys %cmds ) {
         my ($val, $msg) = _CheckCommand( $cmd );
+        if ($val == 2) {
+            delete $cmds{$cmd};
+            warn "Skipping unknown command '$cmd'";
+            next;
+        }
         unless ( $val ) {
             $results{ $cmd } = {
                 value   => delete $cmds{ $cmd },
@@ -867,6 +886,7 @@ sub _CheckCommand {
         return 1 if grep $cmd eq lc $_, @LINK_ATTRIBUTES, @WATCHER_ATTRIBUTES;
     }
 
+    return 2 unless RT->Config->Get('CommandByMailErrorOnUnknown');
     return (0, "Command '$cmd' is unknown");
 }
 

commit 630c642cdeaad760e794fb6cf0f878f38abba214
Author: Dustin Graves <dustin at bestpractical.com>
Date:   Thu Sep 8 23:11:53 2016 +0000

    Prep for version 3.00

diff --git a/META.yml b/META.yml
index eab7825..07abf2a 100644
--- a/META.yml
+++ b/META.yml
@@ -27,6 +27,6 @@ requires:
   perl: 5.10.1
 resources:
   license: http://opensource.org/licenses/gpl-license.php
-version: '2.01'
+version: '3.00'
 x_module_install_rtx_version: '0.37'
 x_requires_rt: 4.0.0
diff --git a/lib/RT/Extension/CommandByMail.pm b/lib/RT/Extension/CommandByMail.pm
index 5911b23..72cafb5 100644
--- a/lib/RT/Extension/CommandByMail.pm
+++ b/lib/RT/Extension/CommandByMail.pm
@@ -11,7 +11,7 @@ our @LINK_ATTRIBUTES    = qw(MemberOf Parents Members Children
             HasMember RefersTo ReferredToBy DependsOn DependedOnBy);
 our @WATCHER_ATTRIBUTES = qw(Requestor Cc AdminCc);
 
-our $VERSION = '2.01';
+our $VERSION = '3.00';
 
 =head1 NAME
 

-----------------------------------------------------------------------


More information about the Bps-public-commit mailing list