Project

General

Profile

« Previous | Next » 

Revision f1ca78f5

Added by Marc Dequènes over 14 years ago

  • ID f1ca78f5fba9ae6e6fc9eb0a759ac6f3d0ccd511

[fix/evol] added new Mail helper methods for headers and use them to display received mail info properly

View differences:

bin/postman
end
mail = Mail.new(msg.content)
logger.info "Received mail with ID '#{mail.message_id}': #{mail.from_addrs} -> #{mail.to_addrs} (#{mail.subject})"
logger.info "Received mail with ID '#{mail.message_id}': #{mail.from_pretty} -> #{mail.to_pretty} (#{mail.subject_pretty})"
# ignore mails not signed or encrypted
unless mail.is_pgp_signed? or mail.is_pgp_encrypted?
lib/cyborghood/mail.rb
@mail
end
def self.header_value_pretty(v)
TMail::Unquoter.unquote_and_convert_to(v.to_s, "UTF-8")
end
def self.header_value_smtp(v)
quote_address_if_necessary(v, "UTF-8")
end
["from", "to", "cc", "bcc"].each do |h|
class_eval <<-EOF
def #{h}_addrs_pretty
@mail.#{h}_addrs.collect do |a|
self.class.header_value_pretty(a)
end
end
def #{h}_pretty
self.#{h}_addrs_pretty.join(", ")
end
EOF
end
def subject_pretty
self.class.header_value_pretty(self.subject)
end
def process
if is_marked?
return MailReport.new(:error => _("Replay detected."))

Also available in: Unified diff