2001-08-19 Simon Josefsson <jas@extundo.com>
[gnus] / lisp / message.el
index 997f783..e08d4ff 100644 (file)
@@ -40,6 +40,7 @@
     (require 'mail-abbrevs))
 (require 'mail-parse)
 (require 'mml)
+(require 'rfc822)
 
 (defgroup message '((user-mail-address custom-variable)
                    (user-full-name custom-variable))
@@ -190,7 +191,7 @@ header, remove it from this list."
   '(From Subject Date (optional . In-Reply-To) Message-ID Lines
         (optional . User-Agent))
   "*Headers to be generated or prompted for when mailing a message.
-RFC822 required that From, Date, To, Subject and Message-ID be
+It is recommended that From, Date, To, Subject and Message-ID be
 included.  Organization, Lines and User-Agent are optional."
   :group 'message-mail
   :group 'message-headers
@@ -1114,6 +1115,9 @@ no, only reply back to the author."
 (defvar message-send-mail-real-function nil
   "Internal send mail function.")
 
+(defvar message-bogus-system-names "^localhost\\."
+  "The regexp of bogus system names.")
+
 (eval-and-compile
   (autoload 'message-setup-toolbar "messagexmas")
   (autoload 'mh-new-draft-name "mh-comp")
@@ -1512,14 +1516,11 @@ Point is left at the beginning of the narrowed-to region."
     ["Spellcheck" ispell-message
      ,@(if (featurep 'xemacs) '(t)
         '(:help "Spellcheck this message"))]
-    ["Attach file as MIME" mml-attach-file
-     ,@(if (featurep 'xemacs) '(t)
-        '(:help "Attach a file at point"))]
     "----"
     ["Send Message" message-send-and-exit
      ,@(if (featurep 'xemacs) '(t)
         '(:help "Send this message"))]
-    ["Abort Message" message-dont-send
+    ["Postpone Message" message-dont-send
      ,@(if (featurep 'xemacs) '(t)
         '(:help "File this draft message and exit"))]
     ["Kill Message" message-kill-buffer
@@ -3011,6 +3012,14 @@ to find out how to use this."
         (message
          "Denied posting -- the From looks strange: \"%s\"." from)
         nil)
+       ((let ((addresses (rfc822-addresses from)))
+          (while (and addresses
+                      (not (eq (string-to-char (car addresses)) ?\()))
+            (setq addresses (cdr addresses)))
+          addresses)
+        (message
+         "Denied posting -- bad From address: \"%s\"." from)
+        nil)
        (t t))))
    ;; Check the Reply-To header.
    (message-check 'reply-to
@@ -3464,7 +3473,8 @@ give as trustworthy answer as possible."
   (let ((system-name (system-name))
        (user-mail (message-user-mail-address)))
     (cond
-     ((string-match "[^.]\\.[^.]" system-name)
+     ((and (string-match "[^.]\\.[^.]" system-name)
+          (not (string-match message-bogus-system-names system-name)))
       ;; `system-name' returned the right result.
       system-name)
      ;; Try `mail-host-address'.