commit 927b6bae94fcb2b460d7b8e10d248fb49d92a5aa
parent 1bafcf6c8f710c3625260e425b899cebb7247c3d
Author: Rich Lane <rlane@club.cc.cmu.edu>
Date: Wed, 20 Oct 2010 14:26:40 -0700
Merge branch 'master' into next
Diffstat:
2 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/lib/sup/crypto.rb b/lib/sup/crypto.rb
@@ -108,6 +108,9 @@ EOS
else
Chunk::CryptoNotice.new :invalid, $1, output_lines
end
+ elsif output_lines.length == 0 && rc == 0
+ # the message wasn't signed
+ Chunk::CryptoNotice.new :valid, "Encrypted message wasn't signed", output_lines
else
unknown_status output_lines
end
@@ -139,7 +142,7 @@ EOS
def decrypt payload, armor=false # a RubyMail::Message object
return unknown_status(cant_find_binary) unless @cmd
- payload_fn = Tempfile.new "redwood.payload"
+ payload_fn = Tempfile.new(["redwood.payload", ".asc"])
payload_fn.write payload.to_s
payload_fn.close
@@ -170,6 +173,10 @@ EOS
end
msg.body = output
else
+ # It appears that some clients use Windows new lines - CRLF - but RMail
+ # splits the body and header on "\n\n". So to allow the parse below to
+ # succeed, we will convert the newlines to what RMail expects
+ output = output.gsub(/\r\n/, "\n")
# This is gross. This decrypted payload could very well be a multipart
# element itself, as opposed to a simple payload. For example, a
# multipart/signed element, like those generated by Mutt when encrypting
diff --git a/lib/sup/poll.rb b/lib/sup/poll.rb
@@ -166,7 +166,13 @@ EOS
HookManager.run "before-add-message", :message => m
yield :add, m, old_m if block_given?
Index.sync_message m, true
- UpdateManager.relay self, :added, m
+
+ ## We need to add or unhide the message when it either did not exist
+ ## before at all or when it was updated. We do *not* add/unhide when
+ ## the same message was found at a different location
+ if !old_m or not old_m.locations.member? m.location
+ UpdateManager.relay self, :added, m
+ end
when :delete
Index.each_message :location => [source.id, args[:info]] do |m|
m.locations.delete Location.new(source, args[:info])