(eval '(run-hooks 'gnus-offline-load-hook))
(eval-when-compile (require 'cl))
+(eval-when-compile (require 'gnus-clfns))
+
(eval-when-compile
(require 'static)
(require 'gnus-agent)
miee-popup-menu
gnus-group-toolbar)))
-(if (eq system-type 'windows-nt)
+(if (featurep 'meadow)
(define-process-argument-editing "/hang\\.exe\\'"
(lambda (x)
(general-process-argument-editing-function
:group 'gnus-offline
:type 'function)
-(defcustom gnus-offline-agent-automatic-expire t
+(defcustom gnus-offline-auto-expire t
"*Non-nil means expire articles on every session."
:group 'gnus-offline
:type 'boolean)
(setq gnus-agent-handle-level gnus-level-subscribed)
(gnus-agent-toggle-plugged t))))
-;; Advice to Gnus functions.
-(defadvice gnus-group-get-new-news (before gnus-offline-advice
- activate preactivate)
- "When called interactively, dial up and get online automatically."
- (when (interactive-p)
- (run-hooks 'gnus-offline-before-online-hook)
- (if (and (memq 'connect gnus-offline-auto-ppp)
- (functionp gnus-offline-dialup-function))
- (funcall gnus-offline-dialup-function))
- (gnus-offline-get-new-news-function)))
-
-(defadvice gnus-agent-toggle-plugged (around gnus-offline-advice
+(when (featurep 'gnus-ofsetup)
+ ;; Advice to Gnus functions.
+ (defadvice gnus-group-get-new-news (before gnus-offline-advice
activate preactivate)
- "Also toggle gnus-offline `connected--disconnected' status."
- (interactive (list (not gnus-offline-connected)))
- (cond ((ad-get-arg 0)
- (setq gnus-offline-connected (ad-get-arg 0))
- ad-do-it
- ;; Set send mail/news function to offline functions.
- (gnus-offline-set-online-sendmail-function)
- (gnus-offline-set-online-post-news-function))
- (t
- ;; Set to offline status
- (gnus-offline-set-unplugged-state))))
+ "When called interactively, dial up and get online automatically."
+ (when (interactive-p)
+ (run-hooks 'gnus-offline-before-online-hook)
+ (if (and (memq 'connect gnus-offline-auto-ppp)
+ (functionp gnus-offline-dialup-function))
+ (funcall gnus-offline-dialup-function))
+ (gnus-offline-get-new-news-function)))
+
+ (defadvice gnus-agent-toggle-plugged (around gnus-offline-advice
+ activate preactivate)
+ "Also toggle gnus-offline `connected--disconnected' status."
+ (interactive (list (not gnus-offline-connected)))
+ (cond ((ad-get-arg 0)
+ (setq gnus-offline-connected (ad-get-arg 0))
+ ad-do-it
+ ;; Set send mail/news function to offline functions.
+ (gnus-offline-set-online-sendmail-function)
+ (gnus-offline-set-online-post-news-function))
+ (t
+ ;; Set to offline status
+ (gnus-offline-set-unplugged-state))))
-(defadvice gnus-agent-expire (around gnus-offline-advice activate preactivate)
- "Advice not to delete new articles."
- (and gnus-offline-agent-automatic-expire
- (if (eq 0 gnus-agent-expire-days)
+ (defadvice gnus-agent-expire (around gnus-offline-advice activate preactivate)
+ "Advice not to delete new articles."
+ (cond ((eq 0 gnus-agent-expire-days)
(let (gnus-agent-expire-all)
- ad-do-it)
- ad-do-it)))
+ ad-do-it))
+ (t
+ ad-do-it)))
+
+ (defadvice gnus-agent-mode (around gnus-offline-advice activate preactivate)
+ "Advice not to close PPP connection."
+ (let (gnus-offline-hangup-function)
+ ad-do-it)))
;;
;; Setting up...
;; Dialup if gnus-offline-dialup-program is specified
(if (stringp gnus-offline-dialup-program)
(progn
- (message (gnus-offline-gettext 'connect-server-1))
+ (message "%s" (gnus-offline-gettext 'connect-server-1))
(apply 'call-process gnus-offline-dialup-program nil nil nil
gnus-offline-dialup-program-arguments)
(sleep-for 1)
- (message (gnus-offline-gettext 'connect-server-2)))))
+ (message "%s" (gnus-offline-gettext '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 (gnus-offline-gettext 'get-new-news-function-1))
+ (message "%s" (gnus-offline-gettext 'get-new-news-function-1))
;; fetch only news
(if (eq gnus-offline-articles-to-fetch 'news)
;;
(defun gnus-offline-after-get-new-news ()
"*After getting news and mail jobs."
- (when gnus-plugged
- (if (memq gnus-offline-articles-to-fetch '(both mail))
- (progn
- ;; Mail/both
- ;; send mail/news in spool
- (gnus-offline-empting-spool)
- (if (eq gnus-offline-articles-to-fetch 'mail)
- (progn
- ;; Send only mail and hang up...
- (if gnus-offline-connected
- (gnus-offline-set-unplugged-state))
- ;; Disable fetch mail.
- (gnus-offline-disable-fetch-mail)
- (gnus-offline-after-jobs-done)))))
-
- ;; News/Both
- (if (memq gnus-offline-articles-to-fetch '(both news))
- (progn
- (if gnus-offline-connected
- (cond ((eq gnus-offline-news-fetch-method 'nnagent)
- ;; Get New News (gnus-agent)
- (gnus-agent-toggle-plugged t)
- ;; fetch articles
- (gnus-agent-fetch-session)
- ;; Hang Up line. then set to offline status.
- (gnus-offline-set-unplugged-state)
- ;; All online jobs has done.
- (gnus-offline-after-jobs-done))
- (t
- (if (eq gnus-offline-news-fetch-method 'nnspool)
- ;; Get New News (nnspool)
- (gnspool-get-news)))))))))
+ (cond (gnus-offline-connected
+ (when (memq gnus-offline-articles-to-fetch '(both mail))
+ ;; Mail/both
+ ;; send mail/news in spool
+ (gnus-offline-empting-spool)
+ (when (eq gnus-offline-articles-to-fetch 'mail)
+ ;; Send only mail and hang up...
+ (if gnus-offline-connected
+ (gnus-offline-set-unplugged-state))
+ ;; Disable fetch mail.
+ (gnus-offline-disable-fetch-mail)
+ (gnus-offline-after-jobs-done)))
+ (when (memq gnus-offline-articles-to-fetch '(both news))
+ ;; News/Both
+ (cond ((eq gnus-offline-news-fetch-method 'nnagent)
+ ;; Get New News (gnus-agent)
+ (gnus-agent-toggle-plugged t)
+ ;; fetch articles
+ (gnus-agent-fetch-session)
+ ;; Hang Up line. then set to offline status.
+ (gnus-offline-set-unplugged-state)
+ ;; All online jobs has done.
+ (gnus-offline-after-jobs-done))
+ (t
+ (if (eq gnus-offline-news-fetch-method 'nnspool)
+ ;; Get New News (nnspool)
+ (gnspool-get-news))))))
+ (t
+ nil)))
\f
;;
;; Add your custom header.
;;
(defun gnus-offline-hangup-line ()
"*Hangup line function."
- (message (gnus-offline-gettext 'hangup-line-1))
+ (message "%s" (gnus-offline-gettext 'hangup-line-1))
(if (stringp gnus-offline-hangup-program)
(apply 'start-process "hup" nil gnus-offline-hangup-program
gnus-offline-hangup-program-arguments))
- (message (gnus-offline-gettext 'hangup-line-2)))
+ (message "%s" (gnus-offline-gettext 'hangup-line-2)))
;;
;; Hang Up line routine whe using nnspool
;;
(run-hooks 'gnus-offline-after-online-hook)
(if (eq gnus-offline-articles-to-fetch 'mail)
(gnus-offline-restore-mail-group-level))
- (if (eq gnus-offline-news-fetch-method 'nnagent)
+ (if (and (eq gnus-offline-news-fetch-method 'nnagent)
+ gnus-offline-auto-expire)
(gnus-agent-expire))
- (if (and (featurep 'xemacs)
- (fboundp 'play-sound-file))
- (ding nil 'drum)
+ (static-if (featurep 'xemacs)
+ (if (fboundp 'play-sound-file)
+ (ding nil 'drum)
+ (ding))
(ding))
(gnus-group-save-newsrc)
- (message (gnus-offline-gettext 'after-jobs-done-1)))
+ (message "%s" (gnus-offline-gettext 'after-jobs-done-1)))
\f
;;
(let ((keys (key-description (this-command-keys)))
menu title str)
(cond ((or (string= "misc-user" keys)
+ (string= "S-mouse-2" keys)
(string-match "^menu-bar" keys)
(string-match "^mouse" keys))
(setq title (gnus-offline-gettext 'menu-3))
'((set-auto-ppp-menu-1
(progn
(setq gnus-offline-auto-ppp '(connect disconnect))
- (message (gnus-offline-gettext 'set-auto-ppp-1)))
+ (message "%s"
+ (gnus-offline-gettext 'set-auto-ppp-1)))
t)
(set-auto-ppp-menu-2
(progn
(setq gnus-offline-auto-ppp '(connect))
- (message (gnus-offline-gettext 'set-auto-ppp-2)))
+ (message "%s"
+ (gnus-offline-gettext 'set-auto-ppp-2)))
t)
(set-auto-ppp-menu-3
(progn
(setq gnus-offline-auto-ppp nil)
- (message (gnus-offline-gettext 'set-auto-ppp-3)))
+ (message "%s"
+ (gnus-offline-gettext 'set-auto-ppp-3)))
t)))))
(gnus-offline-popup menu title))
(t
(setq gnus-offline-auto-ppp nil)
(setq str
(gnus-offline-gettext 'set-auto-ppp-3))))))
- (message str)))))
+ (message "%s" 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 (gnus-offline-gettext 'toggle-on/off-send-mail-1)))
+ (message "%s" (gnus-offline-gettext '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 (gnus-offline-gettext 'toggle-on/off-send-mail-2))))
+ (message "%s" (gnus-offline-gettext 'toggle-on/off-send-mail-2))))
;;
;; Toggle articles to fetch ... both -> mail -> news -> both
;;
(t
(setq gnus-offline-articles-to-fetch 'both
str (gnus-offline-gettext 'toggle-articles-to-fetch-4))))
- (message (format "%s %s" string str))))
+ (message "%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 (gnus-offline-gettext 'empting-spool-1))
+ (message "%s" (gnus-offline-gettext 'empting-spool-1))
;; Using miee to send mail.
(mail-spool-send)
- (message (gnus-offline-gettext 'empting-spool-2))))
- (message (gnus-offline-gettext 'empting-spool-3))
+ (message "%s" (gnus-offline-gettext 'empting-spool-2))))
+ (message "%s" (gnus-offline-gettext '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 (gnus-offline-gettext 'empting-spool-4)))
+ (message "%s" (gnus-offline-gettext 'empting-spool-4)))
;; Send queued message by gnus-agent
- (message (gnus-offline-gettext 'empting-spool-5))
+ (message "%s" (gnus-offline-gettext 'empting-spool-5))
(gnus-group-send-drafts)
- (message (gnus-offline-gettext 'empting-spool-6)))
+ (message "%s" (gnus-offline-gettext 'empting-spool-6)))
;;
(run-hooks 'gnus-offline-after-empting-spool-hook))
;;
nil)))
(if (< gnus-offline-interval-time 2)
(progn
- (message (gnus-offline-gettext 'interval-time-2))
+ (message "%s" (gnus-offline-gettext 'interval-time-2))
(setq gnus-offline-interval-time 0))
(message
(format (gnus-offline-gettext 'interval-time-3)