commit eaa3c22d870b8c066aa7ce0449960b4c7aa8d5b7
parent 2334f8a1146b1bd478507682ef152c83cd54789e
Author: wmorgan <wmorgan@5c8cc53c-5e98-4d25-b20a-d8db53a31250>
Date: Mon, 20 Aug 2007 02:05:00 +0000
check for missing attachments and top-posting
git-svn-id: svn://rubyforge.org/var/svn/sup/trunk@534 5c8cc53c-5e98-4d25-b20a-d8db53a31250
Diffstat:
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/lib/sup.rb b/lib/sup.rb
@@ -195,7 +195,9 @@ else
:thread_by_subject => false,
:edit_signature => false,
:ask_for_cc => true,
- :ask_for_bcc => false
+ :ask_for_bcc => false,
+ :confirm_no_attachments => true,
+ :confirm_top_posting => true,
}
begin
FileUtils.mkdir_p Redwood::BASE_DIR
diff --git a/lib/sup/modes/edit-message-mode.rb b/lib/sup/modes/edit-message-mode.rb
@@ -188,6 +188,8 @@ protected
def send_message
return unless edited? || BufferManager.ask_yes_or_no("Message unedited. Really send?")
+ return unless $config[:confirm_no_attachments] && mentions_attachments? && @attachments.size == 0 && BufferManager.ask_yes_or_no("You haven't added any attachments. Really send?")#" stupid ruby-mode
+ return unless $config[:confirm_top_posting] && top_posting? && BufferManager.ask_yes_or_no("You're top posting. That makes you a bad person. Really send?") #" stupid ruby-mode
date = Time.now
from_email =
@@ -276,6 +278,14 @@ EOS
private
+ def mentions_attachments?
+ @body.any? { |l| l =~ /^[^>]/ && l =~ /\battach(ment|ed|ing|)\b/i }
+ end
+
+ def top_posting?
+ @body.join =~ /(\S+)\s*Excerpts from /
+ end
+
def sig_lines
p = PersonManager.person_for @header["From"]
sigfn = (AccountManager.account_for(p.email) ||