:link '(custom-manual "(message)News Headers")
:type 'string)
-(defcustom message-use-idna 'ask
+(defcustom message-use-idna (and (condition-case nil (require 'idna)
+ (file-error))
+ (fboundp 'coding-system-p)
+ (coding-system-p 'utf-8)
+ 'ask)
"Whether to encode non-ASCII in domain names into ASCII according to IDNA."
+ :group 'message-headers
:type '(choice (const :tag "Ask" ask)
(const :tag "Never" nil)
(const :tag "Always" t)))
;; Check "Shoot me".
(message-check 'shoot
(if (re-search-forward
- "Message-ID.*.i-did-not-set--mail-host-address--so-shoot-me" nil t)
+ "Message-ID.*.i-did-not-set--mail-host-address--so-tickle-me" nil t)
(y-or-n-p "You appear to have a misconfigured system. Really post? ")
t))
;; Check for Approved.
(incf paren))
(and (= (% dquote 2) 1) (= (% paren 2) 1)))))
+(autoload 'idna-to-ascii "idna")
+
(defun message-idna-to-ascii-rhs-1 (header)
"Interactively potentially IDNA encode domain names in HEADER."
- (let (rhs ace start end startpos endpos)
+ (let (rhs ace start end startpos endpos ovl)
(goto-char (point-min))
(setq start (re-search-forward (concat "^" header) nil t)
end (or (save-excursion (re-search-forward "^[ \t]" nil t))
(if (eq message-use-idna 'ask)
(unwind-protect
(progn
- (replace-highlight startpos endpos)
+ (setq ovl (message-make-overlay startpos
+ endpos))
+ (message-overlay-put ovl 'face 'highlight)
(y-or-n-p
(format "Replace with `%s'? " ace)))
(message "")
- (replace-dehighlight))
+ (message-delete-overlay ovl))
message-use-idna)))
(replace-match (concat "@" ace)))))))
"Possibly IDNA encode non-ASCII domain names in From:, To: and Cc: headers.
See `message-idna-encode'."
(interactive)
- (when (condition-case nil (require 'idna) (file-error))
+ (when message-use-idna
(save-excursion
(save-restriction
(message-narrow-to-head)
(delete-char -2))))))
(defalias 'message-exchange-point-and-mark 'exchange-point-and-mark)
+(defalias 'message-make-overlay 'make-overlay)
+(defalias 'message-delete-overlay 'delete-overlay)
+(defalias 'message-overlay-put 'overlay-put)
;; Support for toolbar
(eval-when-compile