mirror of
https://github.com/moparisthebest/mailcatcher
synced 2024-11-14 05:05:01 -05:00
Some syntax bits
This commit is contained in:
parent
d74b700216
commit
a2f9808c75
@ -185,7 +185,7 @@ module_function
|
|||||||
rescue RuntimeError
|
rescue RuntimeError
|
||||||
if $!.to_s =~ /\bno acceptor\b/
|
if $!.to_s =~ /\bno acceptor\b/
|
||||||
puts "~~> ERROR: Something's using port #{port}. Are you already running MailCatcher?"
|
puts "~~> ERROR: Something's using port #{port}. Are you already running MailCatcher?"
|
||||||
exit -1
|
exit(-1)
|
||||||
else
|
else
|
||||||
raise
|
raise
|
||||||
end
|
end
|
||||||
|
@ -43,7 +43,7 @@ module_function
|
|||||||
@@add_message_query ||= db.prepare("INSERT INTO message (sender, recipients, subject, source, type, size, created_at) VALUES (?, ?, ?, ?, ?, ?, datetime('now'))")
|
@@add_message_query ||= db.prepare("INSERT INTO message (sender, recipients, subject, source, type, size, created_at) VALUES (?, ?, ?, ?, ?, ?, datetime('now'))")
|
||||||
|
|
||||||
mail = Mail.new(message[:source])
|
mail = Mail.new(message[:source])
|
||||||
result = @@add_message_query.execute(message[:sender], message[:recipients].to_json, mail.subject, message[:source], mail.mime_type || 'text/plain', message[:source].length)
|
@@add_message_query.execute(message[:sender], message[:recipients].to_json, mail.subject, message[:source], mail.mime_type || 'text/plain', message[:source].length)
|
||||||
message_id = db.last_insert_row_id
|
message_id = db.last_insert_row_id
|
||||||
parts = mail.all_parts
|
parts = mail.all_parts
|
||||||
parts = [mail] if parts.empty?
|
parts = [mail] if parts.empty?
|
||||||
@ -139,7 +139,7 @@ module_function
|
|||||||
def message_part_cid(message_id, cid)
|
def message_part_cid(message_id, cid)
|
||||||
@@message_part_cid_query ||= db.prepare 'SELECT * FROM message_part WHERE message_id = ?'
|
@@message_part_cid_query ||= db.prepare 'SELECT * FROM message_part WHERE message_id = ?'
|
||||||
@@message_part_cid_query.execute(message_id).map do |row|
|
@@message_part_cid_query.execute(message_id).map do |row|
|
||||||
part = Hash[row.fields.zip(row)]
|
Hash[row.fields.zip(row)]
|
||||||
end.find do |part|
|
end.find do |part|
|
||||||
part["cid"] == cid
|
part["cid"] == cid
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user