;;; gnus-offline.el --- To process mail & news at offline environment.
-;;; $Id: gnus-offline.el,v 1.1.2.5.2.36.4.4 1999-08-27 16:56:16 czkmt Exp $
+;;; $Id: gnus-offline.el,v 1.1.2.5.2.36.4.5 1999-09-03 15:42:54 czkmt Exp $
;;; Copyright (C) 1998 Tatsuya Ichikawa
;;; Yukihiro Ito
(defgroup gnus-offline nil
"Offline backend utility for Gnus."
:prefix "gnus-offline-"
+ :group 'gnus
:group 'mail
:group 'news)
(defvar gnus-offline-mail-source nil
"*mail-sources save variable.")
+(defvar gnus-offline-lang)
+
+(defvar gnus-offline-resource-en
+ '((error-check-1
+ . "WARNING!!: gnus-agent.el or nnagent.el is not loaded.
+Please check your .emacs or .gnus.el to work gnus-agent fine.")
+ (error-check-2 ."WARNING!!: nnspool.el is not loaded.
+Please check your .emacs or .gnus.el to work nnspool fine.")
+ (connect-server-1 . "Dialing ...")
+ (connect-server-2 . "Dialing ... done.")
+ (get-new-news-function-1 . "Set to online status.")
+ (hangup-line-1 . "Hang up line ... ")
+ (hangup-line-2 . "Hang up line ... done.")
+ (after-jobs-done-1 . "All online jobs has done.")
+ (toggle-auto-hangup-1 . "Auto hang up logic")
+ (toggle-auto-hangup-2 . "disabled.")
+ (toggle-auto-hangup-3 . "enabled.")
+ (toggle-on/off-send-mail-1 . "Sending mail immidiately.")
+ (toggle-on/off-send-mail-2 . "Sending mail temporary to spool directory.")
+ (toggle-articles-to-fetch-1 . "Articles fetch from server.")
+ (toggle-articles-to-fetch-2 . "Only Mail")
+ (toggle-articles-to-fetch-3 . "Only News")
+ (toggle-articles-to-fetch-4 . "Mail/News both")
+ (empting-spool-1 . "Sending mails in spool ...")
+ (empting-spool-2 . "Sending mails in spool ... done.")
+ (empting-spool-3 . "Posting news in spool ...")
+ (empting-spool-4 . "Posting news in spool ... done.")
+ (empting-spool-5 . "Sending messages in spool ...")
+ (empting-spool-6 . "Sending messages in spool ... done.")
+ (interval-time-1 . "Interval time (now %d minutes) : ")
+ (interval-time-2 . "Retrieving message logic by timer is disabled.")
+ (interval-time-3 . "Interval time set to %d minutes")))
+
+(defvar gnus-offline-resource-ja
+ '((error-check-1
+ . "\e$B7Y9p\e(B!!: gnus-agent.el \e$B$^$?$O\e(B nnagent.el \e$B$,%m!<%I$5$l$F$$$^$;$s!#\e(B
+.emacs \e$B$^$?$O\e(B .gnus.el \e$B$N\e(B gnus-agent \e$B$N@_Dj$r@5$7$/$7$F$/$@$5$$!#\e(B")
+ (error-check-2 ."\e$B7Y9p\e(B!!: nnspool.el \e$B$,%m!<%I$5$l$F$$$^$;$s!#\e(B
+.emacs \e$B$^$?$O\e(B .gnus.el \e$B$N\e(B nnspool \e$B$N@_Dj$r@5$7$/$7$F$/$@$5$$!#\e(B")
+ (connect-server-1 . "\e$B%@%$%d%k$7$F$$$^$9\e(B...")
+ (connect-server-2 . "\e$B%@%$%d%k$7$F$$$^$9\e(B...\e$B40N;!#\e(B")
+ (get-new-news-function-1 . "\e$B%*%s%i%$%s>uBV$G$9!#\e(B")
+ (hangup-line-1 . "\e$B@ZCG$7$F$$$^$9\e(B...")
+ (hangup-line-2 . "\e$B@ZCG$7$F$$$^$9\e(B...\e$B40N;!#\e(B")
+ (after-jobs-done-1 . "\e$BA4$F$N%*%s%i%$%s=hM}$r40N;$7$^$7$?!#\e(B")
+ (toggle-auto-hangup-1 . "\e$B<+F0@ZCG5!G=$r\e(B ")
+ (toggle-auto-hangup-2 . "\e$B%*%U\e(B \e$B$K$7$^$7$?!#\e(B")
+ (toggle-auto-hangup-3 . "\e$B%*%s\e(B \e$B$K$7$^$7$?!#\e(B")
+ (toggle-on/off-send-mail-1 . "\e$B%a!<%k$rD>@\Aw?.$7$^$9!#\e(B")
+ (toggle-on/off-send-mail-2 . "\e$B%a!<%k$O%-%e!<$KAw$i$l$^$9!#\e(B")
+ (toggle-articles-to-fetch-1 . "\e$B<u?.$9$k%a%C%;!<%8$O\e(B... ")
+ (toggle-articles-to-fetch-2 . "\e$B%a!<%k$N$_$G$9!#\e(B")
+ (toggle-articles-to-fetch-3 . "\e$B%K%e!<%9$N$_$G$9!#\e(B")
+ (toggle-articles-to-fetch-4 . "\e$B%a!<%k$H%K%e!<%9$NN>J}$G$9!#\e(B")
+ (empting-spool-1 . "\e$B%-%e!<$N%a!<%k$rAw?.Cf\e(B...")
+ (empting-spool-2 . "\e$B%-%e!<$N%a!<%k$rAw?.Cf\e(B... \e$B40N;!#\e(B")
+ (empting-spool-3 . "\e$B%-%e!<$N%K%e!<%95-;v$rAw?.Cf\e(B...")
+ (empting-spool-4 . "\e$B%-%e!<$N%K%e!<%95-;v$rAw?.Cf\e(B... \e$B40N;!#\e(B")
+ (empting-spool-5 . "\e$B%-%e!<$N%a%C%;!<%8$rAw?.Cf\e(B...")
+ (empting-spool-6 . "\e$B%-%e!<$N%a%C%;!<%8$rAw?.Cf\e(B... \e$B40N;!#\e(B")
+ (interval-time-1 . "\e$BAw<u?.%8%g%V$N4V3V\e(B (\e$B8=:_$N@_Dj$O\e(B %d \e$BJ,$G$9\e(B) : ")
+ (interval-time-2 . "\e$B<+F0Aw<u?.5!G=$r\e(B \e$B%*%U\e(B \e$B$K$7$^$7$?!#\e(B")
+ (interval-time-3 . "\e$B<+F0Aw<u?.$N4V3V$r\e(B %d \e$BJ,$K@_Dj$7$^$7$?!#\e(B")))
+
+(defvar gnus-offline-resource-ja_complete gnus-offline-resource-ja)
+
;;; Functions
+
+(defun gnus-offline-get-message (symbol &optional lang)
+ (setq lang (or lang gnus-offline-lang))
+ (or
+ (cdr (assq symbol (symbol-value
+ (intern (format "gnus-offline-resource-%s" lang)))))
+ (cdr (assq symbol gnus-offline-resource-en))))
+
;;
;; Setting up...
;;
(featurep 'nnagent))
(set-buffer (gnus-get-buffer-create buffer))
(erase-buffer)
- (insert "WARNING!!: gnus-agent.el or nnagent.el is not loaded.
-Please check your .emacs or .gnus.el to work gnus-agent fine.")
+ (insert (gnus-offline-get-message 'error-check-1))
(pop-to-buffer buffer)))
((eq gnus-offline-news-fetch-method 'nnspool)
(unless (featurep 'nnspool)
(set-buffer (gnus-get-buffer-create buffer))
(erase-buffer)
- (insert "WARNING!!: nnspool.el is not loaded.
-Please check your .emacs or .gnus.el to work nnspool fine.")
+ (insert (gnus-offline-get-message 'error-check-2))
(pop-to-buffer buffer)))
(t
nil))))
;; Dialup if gnus-offline-dialup-program is specified
(if (stringp gnus-offline-dialup-program)
(progn
- (message "Dialing ...")
+ (message (gnus-offline-get-message 'connect-server-1))
(apply 'call-process gnus-offline-dialup-program nil nil nil
gnus-offline-dialup-program-arguments)
(sleep-for 1)
- (message "Dialing ... done."))))
+ (message (gnus-offline-get-message 'connect-server-2)))))
;;
;; Jobs before get new news , send mail and post news.
;; Set send mail/news functions to online functions.
(gnus-offline-set-online-sendmail-function)
(gnus-offline-set-online-post-news-function)
- (message "Set to online status.")
+ (message (gnus-offline-get-message 'get-new-news-function-1))
;; fetch only news
(if (eq gnus-offline-articles-to-fetch 'news)
;;
(defun gnus-offline-hangup-line ()
"*Hangup line function."
- (message "Hang up line ... ")
+ (message (gnus-offline-get-message 'hangup-line-1))
(if (stringp gnus-offline-hangup-program)
(apply 'start-process "hup" nil gnus-offline-hangup-program
gnus-offline-hangup-program-arguments))
- (message "Hang up line ... done."))
+ (message (gnus-offline-get-message 'hangup-line-2)))
;;
;; Hang Up line routine whe using nnspool
;;
(ding nil 'drum)
(ding))
(gnus-group-save-newsrc)
- (message "All online jobs has done."))
+ (message (gnus-offline-get-message 'after-jobs-done-1)))
\f
;;
(defun gnus-offline-toggle-auto-hangup ()
"*Toggle auto hangup flag."
(interactive)
- (let ((string "Auto hang up logic") str)
+ (let ((string (gnus-offline-get-message 'toggle-auto-hangup-1)) str)
(if gnus-offline-auto-hangup
(progn
(setq gnus-offline-auto-hangup nil
- str "disabled."))
+ str (gnus-offline-get-message 'toggle-auto-hangup-2)))
(setq gnus-offline-auto-hangup t
- str "enabled."))
+ str (gnus-offline-get-message 'toggle-auto-hangup-3)))
(message (format "%s %s" string str))))
;;
;; Toggle offline/online to send mail.
;; Sending mail under online environ.
(gnus-offline-set-online-sendmail-function)
(setq gnus-offline-mail-treat-environ 'online)
- (message "Sending mail immidiately."))
+ (message (gnus-offline-get-message 'toggle-on/off-send-mail-1)))
;; Sending mail under offline environ.
(gnus-offline-set-offline-sendmail-function)
(setq gnus-offline-mail-treat-environ 'offline)
- (message "Sending mail temporary to spool directory.")))
+ (message (gnus-offline-get-message 'toggle-on/off-send-mail-2))))
;;
;; Toggle articles to fetch ... both -> mail -> news -> both
;;
(defun gnus-offline-toggle-articles-to-fetch ()
"*Set articles to fetch... both(Mail/News) -> mail only -> News only -> both"
(interactive)
- (let ((string "Articles fetch from server.") str)
+ (let ((string (gnus-offline-get-message 'toggle-articles-to-fetch-1))
+ str)
(cond ((eq gnus-offline-articles-to-fetch 'both)
(setq gnus-offline-articles-to-fetch 'mail
- str "Only Mail"))
+ str (gnus-offline-get-message 'toggle-articles-to-fetch-2)))
((eq gnus-offline-articles-to-fetch 'mail)
(setq gnus-offline-articles-to-fetch 'news
- str "Only News"))
+ str (gnus-offline-get-message 'toggle-articles-to-fetch-3)))
(t
(setq gnus-offline-articles-to-fetch 'both
- str "Mail/News both")))
+ str (gnus-offline-get-message 'toggle-articles-to-fetch-4))))
(message (format "%s %s" string str))))
;;
;; Send mail and Post news using Miee or gnus-agent.
(progn
(if (eq gnus-offline-mail-treat-environ 'offline)
(progn
- (message "Sending mails in spool ...")
+ (message (gnus-offline-get-message 'empting-spool-1))
;; Using miee to send mail.
(mail-spool-send)
- (message "Sending mails in spool ... done.")))
- (message "Posting news in spool ...")
+ (message (gnus-offline-get-message 'empting-spool-2))))
+ (message (gnus-offline-get-message 'empting-spool-3))
;; Using miee to post news.
(if (and (not (stringp msspool-news-server))
(not msspool-news-service))
(setq msspool-news-server (nth 1 gnus-select-method))
(setq msspool-news-service 119)))
(news-spool-post)
- (message "Posting news in spool ... done."))
+ (message (gnus-offline-get-message 'empting-spool-4)))
;; Send queued message by gnus-agent
- (message "Sending messages in spool ...")
+ (message (gnus-offline-get-message 'empting-spool-5))
(gnus-group-send-drafts)
- (message "Sending messages in spool ... done."))
+ (message (gnus-offline-get-message 'empting-spool-6)))
;;
(run-hooks 'gnus-offline-after-empting-spool-hook))
;;
(interactive)
(setq gnus-offline-interval-time
(string-to-int (read-from-minibuffer
- (format "Interval time (now %s minutes) : "
+ (format (gnus-offline-get-message 'interval-time-1)
gnus-offline-interval-time)
nil)))
(if (< gnus-offline-interval-time 2)
(progn
- (message "Retrieving message logic by timer is disabled.")
+ (message (gnus-offline-get-message 'interval-time-2))
(setq gnus-offline-interval-time 0))
(message
- (format "Interval time set to %d minutes" gnus-offline-interval-time)))
+ (format (gnus-offline-get-message 'interval-time-3)
+ gnus-offline-interval-time)))
(gnus-offline-processed-by-timer))
;;
;; Expire articles using gnus-agent.
;;
(defun gnus-offline-define-menu-on-miee ()
"*Set and change menu bar on MIEE menu."
- (let (menu)
- (if (featurep 'meadow)
- (easy-menu-change
- nil
- "Miee"
- '(
- ["Spool \e$B$K$"$k5-;v$NAw?.\e(B" news-spool-post t]
- ["Spool \e$B$K$"$k\e(B Mail \e$B$NAw?.\e(B" mail-spool-send t]
- "----"
- ["Offline \e$B>uBV$X\e(B" message-offline-state (not message-offline-state)]
- ["Online \e$B>uBV$X\e(B" message-online-state message-offline-state]
- "----"
- ("Gnus Offline"
- ["\e$B<hF@5-;v<oN`$NJQ99\e(B" gnus-offline-toggle-articles-to-fetch t]
- ["Mail \e$BAw?.J}K!\e(B(On/Off)\e$B$N@ZBX$(\e(B"
- gnus-offline-toggle-on/off-send-mail t]
- ["\e$B<+F0@ZCG$N@ZBX$(\e(B" gnus-offline-toggle-auto-hangup t]
- "----"
- ["\e$B<hF@:Q5-;v$r>C$9\e(B" gnus-offline-agent-expire
- (eq gnus-offline-news-fetch-method 'nnagent)]
- ["\e$B5-;v<hF@4V3V;~4V$N@_Dj\e(B" gnus-offline-set-interval-time t]
- "----"
- ["\e$B2s@~$N@ZCG\e(B" gnus-offline-set-unplugged-state gnus-offline-connected]
- "----"
- ["\e$B%W%m%Q%F%#\e(B..." gnus-ofsetup-customize t])
- ))
- (setq menu
- (easy-menu-change
- nil
- "Miee"
- '(
- ["Post news in spool" news-spool-post t]
- ["Send mails in spool" mail-spool-send t]
- "----"
- ["Message Offline" message-offline-state
- (not message-offline-state)]
- ["Message Online" message-online-state message-offline-state]
- "----"
- ("Gnus Offline"
- ["Toggle articles to fetch"
- gnus-offline-toggle-articles-to-fetch t]
- ["Toggle online/offline send mail"
- gnus-offline-toggle-on/off-send-mail t]
- ["Toggle auto hangup" gnus-offline-toggle-auto-hangup t]
- "----"
- ["Expire articles" gnus-offline-agent-expire
- (eq gnus-offline-news-fetch-method 'nnagent)]
- ["Set interval time" gnus-offline-set-interval-time t]
+ (let ((menu
+ (if (string= gnus-offline-lang "ja_complete")
+ (easy-menu-change
+ nil
+ "Miee"
+ '(
+ ["Spool \e$B$K$"$k5-;v$NAw?.\e(B" news-spool-post t]
+ ["Spool \e$B$K$"$k\e(B Mail \e$B$NAw?.\e(B" mail-spool-send t]
"----"
- ["Hang up Line." gnus-offline-set-unplugged-state
- gnus-offline-connected]
+ ["Offline \e$B>uBV$X\e(B" message-offline-state
+ (not message-offline-state)]
+ ["Online \e$B>uBV$X\e(B" message-online-state message-offline-state]
"----"
- ["Customize options..." gnus-ofsetup-customize t]
- )))))
+ ("Gnus Offline"
+ ["\e$B<hF@5-;v<oN`$NJQ99\e(B" gnus-offline-toggle-articles-to-fetch t]
+ ["Mail \e$BAw?.J}K!\e(B(On/Off)\e$B$N@ZBX$(\e(B"
+ gnus-offline-toggle-on/off-send-mail t]
+ ["\e$B<+F0@ZCG$N@ZBX$(\e(B" gnus-offline-toggle-auto-hangup t]
+ "----"
+ ["\e$B<hF@:Q5-;v$r>C$9\e(B" gnus-offline-agent-expire
+ (eq gnus-offline-news-fetch-method 'nnagent)]
+ ["\e$B5-;v<hF@4V3V;~4V$N@_Dj\e(B" gnus-offline-set-interval-time t]
+ "----"
+ ["\e$B2s@~$N@ZCG\e(B" gnus-offline-set-unplugged-state
+ gnus-offline-connected]
+ "----"
+ ["\e$B%W%m%Q%F%#\e(B..." gnus-ofsetup-customize t])
+ ))
+ (easy-menu-change
+ nil
+ "Miee"
+ '(
+ ["Post news in spool" news-spool-post t]
+ ["Send mails in spool" mail-spool-send t]
+ "----"
+ ["Message Offline" message-offline-state
+ (not message-offline-state)]
+ ["Message Online" message-online-state message-offline-state]
+ "----"
+ ("Gnus Offline"
+ ["Toggle articles to fetch"
+ gnus-offline-toggle-articles-to-fetch t]
+ ["Toggle online/offline send mail"
+ gnus-offline-toggle-on/off-send-mail t]
+ ["Toggle auto hangup" gnus-offline-toggle-auto-hangup t]
+ "----"
+ ["Expire articles" gnus-offline-agent-expire
+ (eq gnus-offline-news-fetch-method 'nnagent)]
+ ["Set interval time" gnus-offline-set-interval-time t]
+ "----"
+ ["Hang up Line." gnus-offline-set-unplugged-state
+ gnus-offline-connected]
+ "----"
+ ["Customize options..." gnus-ofsetup-customize t]
+ ))))))
(and (featurep 'xemacs)
(easy-menu-add menu))))
;;
gnus-offline-menu-on-agent
gnus-group-mode-map
"Gnus offline Menu"
- (if (featurep 'meadow)
+ (if (string= gnus-offline-lang "ja_complete")
'("Offline"
["\e$B<hF@5-;v<oN`$NJQ99\e(B" gnus-offline-toggle-articles-to-fetch t]
["Mail \e$BAw?.J}K!\e(B(On/Off)\e$B$N@ZBX$(\e(B" gnus-offline-toggle-on/off-send-mail