Archive of RubyForge sup-devel mailing list
 help / color / mirror / Atom feed
* [sup-devel] [PATCH] Decode messages according to their Content-Transfer-Encoding
@ 2010-06-04 22:17 Michael Stapelberg
  2010-06-05  2:54 ` Rich Lane
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Stapelberg @ 2010-06-04 22:17 UTC (permalink / raw)
  To: sup-devel

[-- Attachment #1: Type: text/plain, Size: 246 bytes --]

Hi,

quote of the commit message:
    Decode messages according to their Content-Transfer-Encoding
        
    This is necessary for MIME-messages (for example as part of multipart/signed)
    which are encoded in base64.

Best regards,
Michael

[-- Attachment #2: 0001-Decode-messages-according-to-their-Content-Transfer-.patch --]
[-- Type: application/octet-stream, Size: 1433 bytes --]

From bf86e61b22783776e8b9df4f31c59157f3222af1 Mon Sep 17 00:00:00 2001
From: Michael Stapelberg <michael@stapelberg.de>
Date: Sat, 5 Jun 2010 00:13:54 +0200
Subject: [PATCH] Decode messages according to their Content-Transfer-Encoding

This is necessary for MIME-messages (for example as part of multipart/signed)
which are encoded in base64.
---
 lib/sup/message.rb |   15 ++++++++++++++-
 1 files changed, 14 insertions(+), 1 deletions(-)

diff --git a/lib/sup/message.rb b/lib/sup/message.rb
index 396f01a..b70bc6b 100644
--- a/lib/sup/message.rb
+++ b/lib/sup/message.rb
@@ -459,8 +459,21 @@ private
 
       chunks
     elsif m.header.content_type && m.header.content_type.downcase == "message/rfc822"
+      encoding = m.header["Content-Transfer-Encoding"]
       if m.body
-        payload = RMail::Parser.read(m.body)
+        body =
+        case encoding
+        when "base64"
+          m.body.unpack("m")[0]
+        when "quoted-printable"
+          m.body.unpack("M")[0]
+        when "7bit", "8bit", nil
+          m.body
+        else
+          raise EncodingUnsupportedError, encoding.inspect
+        end
+        body = body.normalize_whitespace
+        payload = RMail::Parser.read(body)
         from = payload.header.from.first ? payload.header.from.first.format : ""
         to = payload.header.to.map { |p| p.format }.join(", ")
         cc = payload.header.cc.map { |p| p.format }.join(", ")
-- 
1.7.1


[-- Attachment #3: Type: text/plain, Size: 143 bytes --]

_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [sup-devel] [PATCH] Decode messages according to their Content-Transfer-Encoding
  2010-06-04 22:17 [sup-devel] [PATCH] Decode messages according to their Content-Transfer-Encoding Michael Stapelberg
@ 2010-06-05  2:54 ` Rich Lane
  2010-06-05 10:55   ` Michael Stapelberg
  0 siblings, 1 reply; 4+ messages in thread
From: Rich Lane @ 2010-06-05  2:54 UTC (permalink / raw)
  To: Michael Stapelberg; +Cc: sup-devel

Excerpts from Michael Stapelberg's message of 2010-06-04 18:17:54 -0400:
>     Decode messages according to their Content-Transfer-Encoding
>         
>     This is necessary for MIME-messages (for example as part of multipart/signed)
>     which are encoded in base64.

Do we need to do this in other places too?
_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [sup-devel] [PATCH] Decode messages according to their Content-Transfer-Encoding
  2010-06-05  2:54 ` Rich Lane
@ 2010-06-05 10:55   ` Michael Stapelberg
  2010-06-07 15:55     ` Rich Lane
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Stapelberg @ 2010-06-05 10:55 UTC (permalink / raw)
  To: Rich Lane; +Cc: sup-devel

Hi Rich,

Excerpts from Rich Lane's message of 2010-06-05 04:54:24 +0200:
> Do we need to do this in other places too?
Not sure, unfortunately. I’d guess only for MIME messages, for other
messages the Transfer-Encoding seems to work already.

Best regards,
Michael
_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [sup-devel] [PATCH] Decode messages according to their Content-Transfer-Encoding
  2010-06-05 10:55   ` Michael Stapelberg
@ 2010-06-07 15:55     ` Rich Lane
  0 siblings, 0 replies; 4+ messages in thread
From: Rich Lane @ 2010-06-07 15:55 UTC (permalink / raw)
  To: Michael Stapelberg; +Cc: sup-devel

Excerpts from Michael Stapelberg's message of 2010-06-05 06:55:39 -0400:
> Excerpts from Rich Lane's message of 2010-06-05 04:54:24 +0200:
> > Do we need to do this in other places too?
> Not sure, unfortunately. I’d guess only for MIME messages, for other
> messages the Transfer-Encoding seems to work already.

Ok, applied to master.
_______________________________________________
Sup-devel mailing list
Sup-devel@rubyforge.org
http://rubyforge.org/mailman/listinfo/sup-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-06-07 15:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-04 22:17 [sup-devel] [PATCH] Decode messages according to their Content-Transfer-Encoding Michael Stapelberg
2010-06-05  2:54 ` Rich Lane
2010-06-05 10:55   ` Michael Stapelberg
2010-06-07 15:55     ` Rich Lane

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox