whimsical-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sam Ruby <ru...@apache.org>
Subject [whimsy.git] [2/5] Commit df47edd: add a link to show raw messages
Date Wed, 06 Jan 2016 20:17:44 GMT
Commit df47edda34e2f35799f3388d6c06ac04973d2ae0:
    add a link to show raw messages


Branch: refs/heads/secmail
Author: Sam Ruby <rubys@intertwingly.net>
Committer: Sam Ruby <rubys@intertwingly.net>
Pusher: rubys <rubys@apache.org>

------------------------------------------------------------
www/secmail/models/message.rb                                | ++++ 
www/secmail/server.rb                                        | +++++++ 
www/secmail/views/parts.html.rb                              | + 
------------------------------------------------------------
12 changes: 12 additions, 0 deletions.
------------------------------------------------------------


diff --git a/www/secmail/models/message.rb b/www/secmail/models/message.rb
index 8fe0d75..2335259 100644
--- a/www/secmail/models/message.rb
+++ b/www/secmail/models/message.rb
@@ -27,6 +27,10 @@ def mail
     @mail ||= Mail.new(@email)
   end
 
+  def raw
+    @email
+  end
+
   def from
     mail[:from]
   end
diff --git a/www/secmail/server.rb b/www/secmail/server.rb
index 9a0c096..1c55a7d 100644
--- a/www/secmail/server.rb
+++ b/www/secmail/server.rb
@@ -101,6 +101,13 @@
   _html :headers
 end
 
+# raw data for a single message
+get %r{^/(\d{6})/(\w+)/_raw_$} do |month, hash|
+  message = Mailbox.new(month).find(hash)
+  pass unless message
+  [200, {'Content-Type' => 'text/plain'}, message.raw]
+end
+
 # a specific attachment for a message
 get %r{^/(\d{6})/(\w+)/(.*?)$} do |month, hash, name|
   message = Mailbox.new(month).find(hash)
diff --git a/www/secmail/views/parts.html.rb b/www/secmail/views/parts.html.rb
index 4667d10..57ed1bd 100644
--- a/www/secmail/views/parts.html.rb
+++ b/www/secmail/views/parts.html.rb
@@ -8,6 +8,7 @@
   _ul_ do
     _li! {_a 'text', href: '_body_', target: 'content'}
     _li! {_a 'headers', href: '_headers_', target: 'content'}
+    _li! {_a 'raw', href: '_raw_', target: 'content'}
   end
 
   _div.attachments!

Mime
View raw message