;;; mail-source.el --- functions for fetching mail
;; Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004,
-;; 2005 Free Software Foundation, Inc.
+;; 2005, 2006 Free Software Foundation, Inc.
;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
;; Keywords: news, mail
(const :format "" :value :port)
(choice :tag "Port"
:value "pop3"
- (number :format "%v")
+ (integer :format "%v")
(string :format "%v")))
(group :inline t
(const :format "" :value :user)
(choice :tag "Prescript"
:value nil
(string :format "%v")
- (function :format "%v")))
+ (function :format "%v")
+ (const :tag "None" nil)))
(group :inline t
(const :format "" :value :postscript)
(choice :tag "Postscript"
:value nil
(string :format "%v")
- (function :format "%v")))
+ (function :format "%v")
+ (const :tag "None" nil)))
(group :inline t
(const :format "" :value :function)
(function :tag "Function"))
(const apop)))
(group :inline t
(const :format "" :value :plugged)
- (boolean :tag "Plugged"))))
+ (boolean :tag "Plugged"))
+ (group :inline t
+ (const :format "" :value :stream)
+ (choice :tag "Stream"
+ :value nil
+ (const :tag "Clear" nil)
+ (const starttls)
+ (const :tag "SSL/TLS" ssl)))))
(cons :tag "Maildir (qmail, postfix...)"
(const :format "" maildir)
(checklist :tag "Options" :greedy t
(const :format "" :value :port)
(choice :tag "Port"
:value 143
- number string))
+ integer string))
(group :inline t
(const :format "" :value :user)
(string :tag "User"))
(:program)
(:function)
(:password)
- (:authentication password))
+ (:authentication password)
+ (:stream nil))
(maildir
(:path (or (getenv "MAILDIR") "~/Maildir/"))
(:subdirs ("cur" "new"))
(sleep-for delay)))
(defun mail-source-call-script (script)
- (let ((background nil))
+ (let ((background nil)
+ (stderr (get-buffer-create " *mail-source-stderr*"))
+ result)
(when (string-match "& *$" script)
(setq script (substring script 0 (match-beginning 0))
background 0))
- (call-process shell-file-name nil background nil
- shell-command-switch script)))
+ (setq result
+ (call-process shell-file-name nil background nil
+ shell-command-switch script))
+ (when (and result
+ (not (zerop result)))
+ (set-buffer stderr)
+ (message "Mail source error: %s" (buffer-string)))
+ (kill-buffer stderr)))
;;;
;;; Different fetchers
(defun mail-source-fetch-pop (source callback)
"Fetcher for single-file sources."
(mail-source-bind (pop source)
+ ;; fixme: deal with stream type in format specs
(mail-source-run-script
prescript
(format-spec-make ?p password ?t mail-source-crash-box
(pop3-mailhost server)
(pop3-port port)
(pop3-authentication-scheme
- (if (eq authentication 'apop) 'apop 'pass)))
+ (if (eq authentication 'apop) 'apop 'pass))
+ (pop3-stream-type stream))
(if (or debug-on-quit debug-on-error)
(save-excursion (pop3-movemail mail-source-crash-box))
(condition-case err