Revision 18970c0e
Added by Marc Dequènes about 14 years ago
- ID 18970c0ebd5ade1844f0d19d7a83f9b7fdc842cf
lib/cyborghood/mail_order.rb | ||
---|---|---|
order_txt = nil
|
||
if message.multipart?
|
||
if message.parts[0].content_type == "text/plain"
|
||
order_txt = message.parts[0].body
|
||
order_txt = message.parts[0].body_normalized
|
||
i = -1
|
||
message.parts.each do |part|
|
||
i += 1
|
||
next if i == 0
|
||
|
||
@shared_parameters[i] = CommandParameter.new(part.body, part.content_type)
|
||
@shared_parameters[i] = CommandParameter.new(part.body_normalized, part.content_type)
|
||
|
||
filename = part.header['content-disposition'].params['filename'] || part.header['content-type'].params['name']
|
||
@shared_parameters[filename] = CommandParameterRef.new(i) if filename
|
||
end
|
||
end
|
||
else
|
||
order_txt = message.body if message.content_type == "text/plain"
|
||
order_txt = message.body_normalized if message.content_type == "text/plain"
|
||
end
|
||
return Order.new(:error => _("Mail does not contain a proper text part for commands."), :user => @user) if order_txt.nil?
|
||
|
lib/tmail_extra.rb | ||
---|---|---|
self.body = [normalize_new_lines(txt)].pack("M")
|
||
end
|
||
|
||
def body_normalized
|
||
normalize_new_lines(self.body)
|
||
end
|
||
|
||
def self.header_value_pretty(v)
|
||
Unquoter.unquote_and_convert_to(v.to_s, "UTF-8")
|
||
end
|
Also available in: Unified diff
[fix] use normalized mail/parts body (UNIX EOL is much appreciated by UNIX tools)