(eval-when-compile (require 'cl))
+(require 'read-passwd)
+
(eval-and-compile
(defvar gnus-offline-lang
(cond ((and (featurep 'meadow)
(insert "(setq gnus-offline-MTA-type '"
(prin1-to-string MTA-type) ")\n")
- ;; Offline setting for gnus-nntp-*
- (insert "(setq gnus-nntp-service nil)\n")
- (insert "(setq gnus-nntp-server nil)\n")
-
;; Write setting about hooks.
- (insert (format "%s %s %s\n"
- "(add-hook"
- "'gnus-group-mode-hook"
- "'gnus-offline-processed-by-timer t)"))
- (insert (format "%s %s %s\n"
- "(add-hook"
- "'gnus-group-mode-hook"
- "'gnus-offline-error-check t)"))
- (insert (format "%s %s %s\n"
- "(add-hook"
- "'gnus-after-getting-new-news-hook"
- "'gnus-offline-after-get-new-news)"))
(when (eq news-method 'nnspool)
(insert (format "%s %s %s\n"
"(add-hook"
"'gnus-before-startup-hook"
"(lambda () (setq nnmail-spool-file nil)
(setq mail-sources nil)))")))
- (insert (format "%s %s %s\n"
- "(add-hook"
- "'message-send-hook"
- "'gnus-offline-message-add-header)"))
;; Write stting about mail-source.el
(insert "(setq gnus-offline-mail-source '"
(prin1-to-string mail-source) ")\n")
(insert "(setq mail-sources gnus-offline-mail-source)\n")
- (insert "(require 'read-passwd)\n")
- (insert "(setq mail-source-read-passwd 'read-pw-read-passwd)\n")
- (insert (format "%s %s %s\n"
- "(add-hook"
- "'gnus-setup-news-hook"
- "'read-pw-set-mail-source-passwd-cache)"))
(if save-passwd
(insert "(add-hook 'gnus-setup-news-hook
(lambda ()
(setup-8 . "Use MIEE post/send message ")
(setup-9 . "News spool directory for sending: ")
(setup-10 . "Mail spool directory for sending: ")
- (setup-11 . "How many e-mail address do you have: ")
+ (setup-11 . "How many mail sources will get mails from? : ")
(setup-12 . "Mail Account name : ")
(setup-13 . "Mail server : ")
- (setup-14 . "Authentification Method (TAB to completion): ")
+ (setup-14 . "Authentification Method ")
(setup-15 . "Do you use pop3.el to fetch mail? ")
(setup-16 . "movemail program name: ")
(setup-17 . "movemail options: ")
(setup-18 . "Do you save password information to newsrc file? ")
+ (setup-19 . "What type of the mail source? ")
+ (setup-20 . "File: ")
+ (setup-21 . "Directory: ")
+ (setup-22 . "What network stream? ")
+ (setup-23 . "What authentication? ")
+
(param-news-method-1 . "News Method")
(param-news-method-2 . "Gnus Agent")
(param-news-method-3 . "nnspool")
(setup-8 . "\e$B%a%C%;!<%8$NAw?.$K\e(B MIEE \e$B$r;H$$$^$9$+\e(B? ")
(setup-9 . "\e$B%K%e!<%9$N%9%W!<%k%G%#%l%/%H%j\e(B: ")
(setup-10 . "\e$B%a!<%k$N%9%W!<%k%G%#%l%/%H%j\e(B: ")
- (setup-11 . "\e$B%a!<%k%"%+%&%s%H$N?t$rEz$($F$/$@$5$$\e(B: ")
+ (setup-11 . "\e$B@_Dj$9$k%a!<%k<hF@@h$N?t$O\e(B? (\e$B8e$GDI2C$G$-$^$9\e(B): ")
(setup-12 . "\e$B%a!<%k$N%"%+%&%s%HL>\e(B: ")
(setup-13 . "\e$B$=$N%"%+%&%s%H$N$"$k%a!<%k%5!<%PL>\e(B: ")
- (setup-14 . "\e$B$=$N%5!<%P$G$NG'>ZJ}<0$O\e(B? (TAB \e$B$GJd40$7$^$9\e(B): ")
+ (setup-14 . "\e$B$=$N%5!<%P$G$NG'>ZJ}<0$O\e(B? ")
(setup-15 . "\e$B%a!<%k$N<u?.$K$O\e(B pop3.el \e$B$r;H$$$^$9$+\e(B? ")
(setup-16 . "movemail \e$B%W%m%0%i%`$NL>A0\e(B: ")
(setup-17 . "movemail \e$B%W%m%0%i%`$KEO$90z?t\e(B: ")
(setup-18 . "newsrc \e$B%U%!%$%k$K\e(B POP \e$B%Q%9%o!<%I$rJ]B8$7$^$9$+\e(B? ")
+ (setup-19 . "\e$B%a!<%k<hF@@h$N%?%$%W$O\e(B? ")
+ (setup-20 . "\e$B%U%!%$%k\e(B: ")
+ (setup-21 . "\e$B%G%#%l%/%H%j\e(B: ")
+ (setup-22 . "\e$B@\B3J}<0$O\e(B? ")
+ (setup-23 . "\e$BG'>ZJ}<0$O\e(B? ")
(param-news-method-4 . "\
\e$B%K%e!<%95-;v$r<hF@$9$kJ}K!$G$9!#\e(B")
mail-method agent-directory drafts-queue-type news-spool mail-spool
use-miee MTA-type dialup-program dialup-program-arguments
hangup-program hangup-program-arguments interval
- num-of-address i mail-source save-passwd)
+ num-of-address i n mail-source save-passwd)
(setq news-method
(gnus-ofsetup-completing-read-symbol
(gnus-ofsetup-gettext 'setup-1)
(gnus-ofsetup-prepare gnus-ofsetup-prepare-for-miee))
;; Set drafts type gnus-agent.
(setq drafts-queue-type 'agent))
- ;; Set E-Mail Address and pop3 movemail type.
+ ;; Create a list of mail source specifiers.
(setq num-of-address
(read-from-minibuffer (gnus-ofsetup-gettext 'setup-11)))
- (setq i (string-to-int num-of-address))
+ (setq i (setq n (string-to-int num-of-address)))
+ ;;
(while (> i 0)
- (let ((user (read-from-minibuffer (gnus-ofsetup-gettext 'setup-12)))
- (server (read-from-minibuffer
- (gnus-ofsetup-gettext 'setup-13)))
- (auth (completing-read
- (gnus-ofsetup-gettext 'setup-14)
- '(("password") ("apop")) nil t nil))
- (islisp (y-or-n-p (gnus-ofsetup-gettext 'setup-15)))
- source)
- (if (not islisp)
- (let ((prog (read-file-name (gnus-ofsetup-gettext 'setup-16)
- exec-directory "movemail"))
- (args (read-from-minibuffer
- (gnus-ofsetup-gettext 'setup-17)
- "-pf")))
- (setq source `(pop
- :user ,user
- :server ,server
- :program ,(format "%s %s %s %s %s"
- prog
- args
- "po:%u"
- "%t"
- "%p"))))
- (setq source `(pop
- :user ,user
- :server ,server)))
- (setq mail-source
- (nconc mail-source
- (list
- (if (string-equal "apop" auth)
- (nconc source '(:authentication apop))
- source)))))
+ (let* ((j (- n (1- i)))
+ (type (gnus-ofsetup-completing-read-symbol
+ (format "<%d of %d> %s" j n
+ (gnus-ofsetup-gettext 'setup-19))
+ 'pop 'imap 'file 'directory 'maildir))
+ user server authentication stream islisp source
+ prog args program path)
+ ;; Prepare.
+ (when (or (string= type "pop") (string= type "imap"))
+ (setq user (read-from-minibuffer
+ (format "<%d of %d> %s" j n
+ (gnus-ofsetup-gettext 'setup-12))))
+ (setq server (read-from-minibuffer
+ (format "<%d of %d> %s" j n
+ (gnus-ofsetup-gettext 'setup-13)))))
+ (when (string= type "pop")
+ (setq authentication (gnus-ofsetup-completing-read-symbol
+ (format "<%d of %d> %s" j n
+ (gnus-ofsetup-gettext 'setup-14))
+ 'password 'apop))
+ (setq islisp (y-or-n-p
+ (format "<%d of %d> %s" j n
+ (gnus-ofsetup-gettext 'setup-15))))
+ (unless islisp
+ (setq prog (read-file-name
+ (format "<%d of %d> %s" j n
+ (gnus-ofsetup-gettext 'setup-16))
+ exec-directory "movemail"))
+ (setq args (read-from-minibuffer
+ (format "<%d of %d> %s" j n
+ (gnus-ofsetup-gettext 'setup-17) "-pf")))
+ (setq program (format "%s %s %s %s %s"
+ prog args "po:%u" "%t" "%p"))))
+ (when (string= type "imap")
+ (setq stream (gnus-ofsetup-completing-read-symbol
+ (format "<%d of %d> %s" j n
+ (gnus-ofsetup-gettext 'setup-22))
+ 'kerberos4 'ssl 'network))
+ (setq authentication (gnus-ofsetup-completing-read-symbol
+ (format "<%d of %d> %s" j n
+ (gnus-ofsetup-gettext 'setup-23))
+ 'kerberos4 'cram-md5 'anonymous 'login)))
+ (when (string= type "file")
+ (setq path (read-file-name
+ (format "<%d of %d> %s" j n
+ (gnus-ofsetup-gettext 'setup-20)))))
+ (when (or (string= type "directory") (string= type "maildir"))
+ (setq path (read-directory-name
+ (format "<%d of %d> %s" j n
+ (gnus-ofsetup-gettext 'setup-21)))))
+ ;; Now set a mail source specifier.
+ (setq source `(,type))
+ (mapc
+ #'(lambda (sym)
+ (unless (not (symbol-value sym))
+ (setq source
+ (nconc source
+ (list
+ (make-symbol
+ (format ":%s" (prin1-to-string sym)))
+ (symbol-value sym))))))
+ '(path user server authentication stream program))
+ (setq mail-source (nconc mail-source (list source))))
(setq i (1- i)))
(setq save-passwd
(y-or-n-p (gnus-ofsetup-gettext 'setup-18)))
;;; Code for making Gnus and Gnus Offline cooperate with each other.
-;; advice.
+;; Advice.
(defadvice gnus (around gnus-ofsetup-advice activate preactivate)
"Setup offline environment when Gnus is invoked."
(require 'gnus-offline) ad-do-it (gnus-offline-setup))
+;; Miscellaneous settings.
+
+(setq gnus-nntp-service nil)
+(setq gnus-nntp-server nil)
+(eval-after-load "gnus-start"
+ '(add-hook 'gnus-after-getting-new-news-hook 'gnus-offline-after-get-new-news))
+(eval-after-load "message"
+ '(add-hook 'message-send-hook 'gnus-offline-message-add-header))
+(setq mail-source-read-passwd 'read-pw-read-passwd)
+(add-hook 'gnus-setup-news-hook 'read-pw-set-mail-source-passwd-cache)
+
;; gnus-ofsetup.el Ends here.