[Jifty-commit] jifty branch, master, updated. 5691958578c4c2caf99ab3a0128bfd821dd20657

Jifty commits jifty-commit at lists.jifty.org
Tue Dec 29 16:17:36 EST 2009


The branch, master has been updated
       via  5691958578c4c2caf99ab3a0128bfd821dd20657 (commit)
       via  ba77dceaa7d526ed99d86aed8d08507ce00fe5f0 (commit)
       via  d59dabd7f7e82131bcaf208d9c58af4420e9376c (commit)
      from  92c94c643bab190b8c0831640f87bdc0a226dae5 (commit)

Summary of changes:
 lib/Jifty/Notification.pm |   69 +++++++++++++++++++++++++-------------------
 1 files changed, 39 insertions(+), 30 deletions(-)

- Log -----------------------------------------------------------------
commit d59dabd7f7e82131bcaf208d9c58af4420e9376c
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Dec 29 16:14:42 2009 -0500

    Factor out common Subject: and From: logic

diff --git a/lib/Jifty/Notification.pm b/lib/Jifty/Notification.pm
index e3d89e4..6f28604 100644
--- a/lib/Jifty/Notification.pm
+++ b/lib/Jifty/Notification.pm
@@ -102,6 +102,12 @@ sub send_one_message {
 
     my %attrs = ( charset => 'UTF-8' );
 
+    my $from = $self->from || _('%1 <%2>' , $appname, Jifty->config->framework('AdminEmail'));
+    my $subj = Encode::encode(
+        'MIME-Header',
+        $self->subject || _("A notification from %1!",$appname )
+    );
+
     if (defined $self->html_body) {
 
         # NOTICE: we should keep string in perl string (with utf8 flag)
@@ -109,9 +115,9 @@ sub send_one_message {
         # its create function.
         $message = Email::MIME->create_html(
 					     header => [
-							From    => ($self->from    || _('%1 <%2>' , $appname, Jifty->config->framework('AdminEmail'))) ,
+							From    => $from,
 							To      => $to,
-							Subject => Encode::encode('MIME-Header', $self->subject || _("A notification from %1!",$appname )),
+							Subject => $subj,
 						       ],
 					     attributes => \%attrs,
                          text_body_attributes => \%attrs,
@@ -126,9 +132,9 @@ sub send_one_message {
     } else {
             $message = Email::MIME->create(
 					     header => [
-							From    => ($self->from    || _('%1 <%2>' , $appname, Jifty->config->framework('AdminEmail'))) ,
+							From    => $from,
 							To      => $to,
-							Subject => Encode::encode('MIME-Header', $self->subject || _("A notification from %1!",$appname )),
+							Subject => $subj,
 						       ],
 					     attributes => \%attrs,
 					     

commit ba77dceaa7d526ed99d86aed8d08507ce00fe5f0
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Dec 29 16:15:16 2009 -0500

    MIME-Header encode the "From" field, as well

diff --git a/lib/Jifty/Notification.pm b/lib/Jifty/Notification.pm
index 6f28604..df92674 100644
--- a/lib/Jifty/Notification.pm
+++ b/lib/Jifty/Notification.pm
@@ -102,7 +102,10 @@ sub send_one_message {
 
     my %attrs = ( charset => 'UTF-8' );
 
-    my $from = $self->from || _('%1 <%2>' , $appname, Jifty->config->framework('AdminEmail'));
+    my $from = Encode::encode(
+        'MIME-Header',
+        $self->from || _('%1 <%2>' , $appname, Jifty->config->framework('AdminEmail'))
+    );
     my $subj = Encode::encode(
         'MIME-Header',
         $self->subject || _("A notification from %1!",$appname )

commit 5691958578c4c2caf99ab3a0128bfd821dd20657
Author: Alex Vandiver <alexmv at bestpractical.com>
Date:   Tue Dec 29 16:17:31 2009 -0500

    Perltidy to clean up indentation

diff --git a/lib/Jifty/Notification.pm b/lib/Jifty/Notification.pm
index df92674..f597dc6 100644
--- a/lib/Jifty/Notification.pm
+++ b/lib/Jifty/Notification.pm
@@ -111,41 +111,41 @@ sub send_one_message {
         $self->subject || _("A notification from %1!",$appname )
     );
 
-    if (defined $self->html_body) {
+    if ( defined $self->html_body ) {
 
-        # NOTICE: we should keep string in perl string (with utf8 flag)
-        # rather then encode it into octets. Email::MIME would call Encode::encode in 
-        # its create function.
+        # NOTICE: we should keep string in perl string (with utf8
+        # flag) rather then encode it into octets. Email::MIME would
+        # call Encode::encode in its create function.
         $message = Email::MIME->create_html(
-					     header => [
-							From    => $from,
-							To      => $to,
-							Subject => $subj,
-						       ],
-					     attributes => \%attrs,
-                         text_body_attributes => \%attrs,
-                         body_attributes => \%attrs,
-					     text_body => $self->full_body,
-					     body => $self->full_html,
-                         embed => 0,
-                         inline_css => 0
-					    );
+            header => [
+                From    => $from,
+                To      => $to,
+                Subject => $subj,
+            ],
+            attributes           => \%attrs,
+            text_body_attributes => \%attrs,
+            body_attributes      => \%attrs,
+            text_body            => $self->full_body,
+            body                 => $self->full_html,
+            embed                => 0,
+            inline_css           => 0,
+        );
+
         # Since the containing messsage will still be us-ascii otherwise
         $message->charset_set( $attrs{'charset'} );
     } else {
-            $message = Email::MIME->create(
-					     header => [
-							From    => $from,
-							To      => $to,
-							Subject => $subj,
-						       ],
-					     attributes => \%attrs,
-					     
-					     parts => $self->parts
-					    );
-	  }
+        $message = Email::MIME->create(
+            header => [
+                From    => $from,
+                To      => $to,
+                Subject => $subj,
+            ],
+            attributes => \%attrs,
+            parts      => $self->parts,
+        );
+    }
     $message->encoding_set('8bit')
-        if (scalar $message->parts == 1);
+        if ( scalar $message->parts == 1 );
     $self->set_headers($message);
 
     my $method   = Jifty->config->framework('Mailer');

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


More information about the Jifty-commit mailing list