Revision 958e72a0
Added by Marc Dequènes over 14 years ago
- ID 958e72a022e409f899c7569cbe092406211e9098
lib/cyborghood/mail.rb | ||
---|---|---|
tmail_reply.to_addrs = (@mail.reply_to_addrs_pretty || @mail.from_addrs_pretty).collect do |a|
|
||
TMail::Address.parse(@mail.class.header_value_smtp(a))
|
||
end
|
||
p tmail_reply.to_addrs
|
||
reply = self.class.new(tmail_reply.to_s)
|
||
reply.set_custom_headers
|
||
reply.user = self.user
|
||
reply.user = @user
|
||
reply
|
||
end
|
||
|
||
... | ... | |
@mail.to_s
|
||
end
|
||
|
||
def crypt(fingerprint)
|
||
@mail = @mail.create_encrypted(fingerprint)
|
||
def crypt(fingerprint = nil)
|
||
@mail = @mail.create_encrypted(fingerprint || @user.keyFingerPrint)
|
||
end
|
||
|
||
def sign
|
||
... | ... | |
end
|
||
end
|
||
|
||
def sign_and_crypt(fingerprint)
|
||
def sign_and_crypt(fingerprint = nil)
|
||
# not using sign_and_crypt(), to avoid repeating code
|
||
sign()
|
||
crypt(fingerprint)
|
||
crypt(fingerprint || @user.keyFingerPrint)
|
||
end
|
||
|
||
private
|
||
... | ... | |
return MailReport.new(:error => _("Mail is from an unknown person."), :warn_sender => true) if user.nil?
|
||
|
||
logger.info "Mail is from user #{user.uid} (#{user.cn})"
|
||
self.user = user
|
||
@user = user
|
||
|
||
drift = Time.new.to_i - sig_check.timestamp.to_i
|
||
logger.debug "Signature drift time: #{drift}"
|
||
... | ... | |
|
||
# create a fake mail and chain parsing operations
|
||
plain_mail = self.class.new(signed_content)
|
||
plain_mail.user = self.user
|
||
plain_mail.user = @user
|
||
plain_mail.signature_timestamp = sig_check.timestamp
|
||
# propagate message_id to be able to mark messages (replay protection)
|
||
plain_mail.message_id = @mail.message_id
|
||
... | ... | |
|
||
# create a fake mail and chain parsing operations
|
||
clear_mail = self.class.new(clear_message)
|
||
clear_mail.user = self.user
|
||
clear_mail.user = @user
|
||
# propagate message_id to be able to mark messages (replay protection)
|
||
clear_mail.message_id = @mail.message_id
|
||
return clear_mail.process
|
Also available in: Unified diff
[evol] Mail: use provided @user fingerprint unless overrided