diff options
Diffstat (limited to 'rt/lib/RT/Action')
-rw-r--r-- | rt/lib/RT/Action/EscalatePriority.pm | 7 | ||||
-rwxr-xr-x | rt/lib/RT/Action/SendEmail.pm | 36 |
2 files changed, 35 insertions, 8 deletions
diff --git a/rt/lib/RT/Action/EscalatePriority.pm b/rt/lib/RT/Action/EscalatePriority.pm index 7ed63ae01..e24e0541a 100644 --- a/rt/lib/RT/Action/EscalatePriority.pm +++ b/rt/lib/RT/Action/EscalatePriority.pm @@ -27,9 +27,10 @@ =head1 DESCRIPTION -EscalatePriority is a ScripAction which is NOT intended to be called per -transaction. It's intended to be called by an RT escalation daemon. -(The daemon is called escalator). +EscalatePriority is a ScripAction which is NOT intended to be called +per transaction. It's intended to be called by an RT escalation tool. +One such tool is called rt-crontool and is located in $RTHOME/bin (see +C<rt-crontool -h> for more details) EsclatePriority uses the following formula to change a ticket's priority: diff --git a/rt/lib/RT/Action/SendEmail.pm b/rt/lib/RT/Action/SendEmail.pm index 659238088..645c5d99d 100755 --- a/rt/lib/RT/Action/SendEmail.pm +++ b/rt/lib/RT/Action/SendEmail.pm @@ -239,7 +239,7 @@ sub Prepare { =head2 SendMessage MIMEObj sends the message using RT's preferred API. -TODO: Break this out to a seperate module +TODO: Break this out to a separate module =cut @@ -279,7 +279,7 @@ sub SendMessage { local $ENV{MAILADDRESS}; if ( $RT::MailCommand eq 'sendmail' ) { - push @mailer_args, $RT::SendmailArguments; + push @mailer_args, split(/\s+/, $RT::SendmailArguments); } elsif ( $RT::MailCommand eq 'smtp' ) { $ENV{MAILADDRESS} = $RT::SMTPFrom || $MIMEObj->head->get('From'); @@ -663,15 +663,41 @@ Takes a string and a possible encoding and returns the string wrapped in MIME go sub MIMEEncodeString { my $self = shift; my $value = shift; - my $enc = shift; + # using RFC2047 notation, sec 2. + # encoded-word = "=?" charset "?" encoding "?" encoded-text "?=" + my $charset = shift; + my $encoding = 'B'; + # An 'encoded-word' may not be more than 75 characters long + # + # MIME encoding increases 4/3*(number of bytes), and always in multiples + # of 4. Thus we have to find the best available value of bytes available + # for each chunk. + # + # First we get the integer max which max*4/3 would fit on space. + # Then we find the greater multiple of 3 lower or equal than $max. + my $max = int(((75-length('=?'.$charset.'?'.$encoding.'?'.'?='))*3)/4); + $max = int($max/3)*3; chomp $value; return ($value) unless $value =~ /[^\x20-\x7e]/; $value =~ s/\s*$//; Encode::_utf8_off($value); - my $res = Encode::from_to( $value, "utf-8", $enc ); - $value = encode_mimeword( $value, 'B', $enc ); + my $res = Encode::from_to( $value, "utf-8", $charset ); + + if ($max > 0) { + # copy value and split in chuncks + my $str=$value; + my @chunks = unpack("a$max" x int(length($str)/$max + + ((length($str) % $max) ? 1:0)), $str); + # encode an join chuncks + $value = join " ", + map encode_mimeword( $_, $encoding, $charset ), @chunks ; + return($value); + } else { + # gives an error... + $RT::Logger->crit("Can't encode! Charset or encoding too big.\n"); + } } # }}} |