Revision 6ed10f49
Added by Marc Dequènes over 14 years ago
- ID 6ed10f493be6070b321fc83e82b024de5b150adb
bin/postman | ||
---|---|---|
reply_intro = report.user ? _("Hello %{cn},", :cn =>report.user.cn) : _("Hello,")
|
||
mail_reply = mail.create_simple_reject_reply(reply_intro.to_s + "\n\n" +
|
||
_("A message (ID: %{id}), apparently from you, was rejected for the following reason:",
|
||
:id => mail.message_id).to_s + "\n " + report.error.to_s + "\n" + mail_signature())
|
||
:id => mail.message_id).to_s + "\n " + report.error.to_s + "\n")
|
||
mail_reply.deliver
|
||
end
|
||
msg.delete
|
||
... | ... | |
logger.info "Sending reply for rejected order"
|
||
mail_reply = mail.create_simple_reject_reply(reply_intro.to_s + "\n\n" +
|
||
_("An order, in a message (ID: %{id}) from you, was rejected for the following reason:",
|
||
:id => mail.message_id).to_s + "\n " + order.error.to_s + "\n" + mail_signature())
|
||
:id => mail.message_id).to_s + "\n " + order.error.to_s + "\n")
|
||
mail_reply.sign_and_crypt(order.user.keyFingerPrint)
|
||
mail_reply.deliver
|
||
msg.delete
|
||
... | ... | |
logger.debug "Message accepted, processing orders..."
|
||
result_list = CommandRunner.run(order)
|
||
|
||
# create transcript
|
||
logger.debug "Preparing reply"
|
||
reply_txt = reply_intro.to_s + "\n\n"
|
||
reply_txt += _("Follows the transcript of your commands:").to_s + "\n"
|
||
reply_attachments = []
|
||
result_list.each do |result|
|
||
reply_txt += "> #{result.cmd}\n"
|
||
reply_txt += "#{result.message}\n"
|
||
reply_attachments += result.refs unless result.refs.nil?
|
||
end
|
||
reply_txt += "\n" + mail_signature()
|
||
|
||
# create mail
|
||
logger.debug "Preparing mail"
|
||
mail_reply = mail.create_reply
|
||
... | ... | |
mail_reply.parts << p
|
||
end
|
||
end
|
||
|
||
# create transcript
|
||
logger.debug "Preparing reply"
|
||
reply_txt = reply_intro.to_s + "\n\n"
|
||
reply_txt += _("Follows the transcript of your commands:").to_s + "\n"
|
||
reply_attachments = []
|
||
result_list.each do |result|
|
||
reply_txt += "> #{result.cmd}\n"
|
||
reply_txt += "#{result.message}\n"
|
||
reply_attachments += result.refs unless result.refs.nil?
|
||
end
|
||
reply_txt += "\n" + mail_reply.default_body_signature
|
||
|
||
# insert transcript
|
||
transcript_part.set_content_type("text", "plain", {'charset' => 'utf-8', 'format' => 'flowed'})
|
||
transcript_part.set_disposition("inline")
|
||
... | ... | |
|
||
true
|
||
end
|
||
|
||
def mail_signature
|
||
s = "\n" +
|
||
"-- \n" +
|
||
"#{CyborgHood::PRODUCT} v#{CyborgHood::VERSION}\n"
|
||
s += _("Contact eMail:").to_s + " \"#{@config.contact.name}\" <#{@config.contact.email}>\n" if @config.contact.email
|
||
s += _("Contact URL:").to_s + " #{@config.contact.url}\n" if @config.contact.url
|
||
s
|
||
end
|
||
end
|
||
end
|
||
end
|
Also available in: Unified diff
[evol] move default body signature in Mail class