Revision ebccdcc4
Added by Marc Dequènes almost 16 years ago
- ID ebccdcc4f5fdcb1309e648f8db5260a729afcdbd
lib/cyborghood/mail.rb | ||
---|---|---|
class Mail < Delegator
|
||
include ActionMailer::Quoting
|
||
include ActionMailer::Utils
|
||
include GetText
|
||
|
||
MAX_DRIFT_TIME = 600
|
||
|
||
attr_accessor :user
|
||
attr_accessor :user, :signature_timestamp
|
||
|
||
def initialize(msg = nil)
|
||
@config = Config.instance
|
||
... | ... | |
if msg.nil?
|
||
@mail = TMail::Mail.new
|
||
set_custom_headers
|
||
elsif msg.is_a? TMail::Mail
|
||
@mail = msg
|
||
else
|
||
# unquote headers and transform into TMail object
|
||
@mail = TMail::Mail.parse(TMail::Unquoter.unquote_and_convert_to(msg, "UTF-8"))
|
||
... | ... | |
def create_simple_reject_reply(msg)
|
||
reply = create_reply()
|
||
reply.set_content_type("text", "plain", {'charset' => "utf-8"})
|
||
relay.set_disposition("inline")
|
||
reply.set_disposition("inline")
|
||
reply.quoted_printable_body = msg
|
||
reply.sign
|
||
reply.crypt(reply.user.keyFingerPrint) unless reply.user.nil?
|
||
... | ... | |
end
|
||
|
||
logger.debug "Mail OK"
|
||
mark_processed(sig_check.timestamp)
|
||
mark_processed(self.signature_timestamp)
|
||
|
||
order = Order.new(true)
|
||
order.user = self.user
|
||
... | ... | |
# create a fake mail and chain parsing operations
|
||
plain_mail = self.class.new(signed_content)
|
||
plain_mail.user = self.user
|
||
plain_mail.signature_timestamp = sig_check.timestamp
|
||
# propagate message_id to be able to mark messages (replay protection)
|
||
plein_mail.message_id = @mail.message_id
|
||
plain_mail.message_id = @mail.message_id
|
||
return plain_mail.parse
|
||
end
|
||
|
postman | ||
---|---|---|
|
||
module CyborgHood
|
||
class CommandParser
|
||
include GetText
|
||
|
||
def self.run(order)
|
||
result_list = []
|
||
order.commands.each do |cmdstr|
|
||
... | ... | |
|
||
# not yet ready to be a real Cyborg
|
||
class Postman #< Cyborg
|
||
include GetText
|
||
|
||
def initialize
|
||
# load config
|
||
Config.load(self.human_name.downcase)
|
||
... | ... | |
logger.info "Extra processing information: " + order.system_message if order.system_message
|
||
|
||
if order.user and order.user.preferredLanguage
|
||
logger.debug "User preference for langage: " + order.user.preferredLanguage
|
||
locale = order.user.preferredLanguage
|
||
else
|
||
logger.debug "No user preference for langage, using english"
|
||
locale = "en"
|
||
end
|
||
|
Also available in: Unified diff
[fix] corrected mistakes introduced in the 4 previous blind commits