1 ;;; gnus-offline.el --- To process mail & news at offline environment.
2 ;;; $Id: gnus-offline.el,v 1.1.2.5.2.9 1998-11-20 12:20:35 ichikawa Exp $
4 ;;; Copyright (C) 1998 Tatsuya Ichikawa
6 ;;; Author: Tatsuya Ichikawa <t-ichi@po.shiojiri.ne.jp>
7 ;;; Yukihiro Ito <ito@rs.civil.tohoku.ac.jp>
8 ;;; Hidekazu Nakamura <u90121@uis-inf.co.jp>
11 ;;; Keywords: news , mail , offline , gnus
14 ;;; Keiichi Suzuki <kei-suzu@mail.wbs.or.jp>
15 ;;; KORIYAMA Naohiro <kory@ba2.so-net.or.jp>
16 ;;; Katsumi Yamaoka <yamaoka@jpl.org>
18 ;;; This file is part of Semi-gnus.
20 ;;; GNU Emacs is free software; you can redistribute it and/or modify
21 ;;; it under the terms of the GNU General Public License as published by
22 ;;; the Free Software Foundation; either version 2, or (at your option)
23 ;;; any later version.
25 ;;; GNU Emacs is distributed in the hope that it will be useful,
26 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
27 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 ;;; GNU General Public License for more details.
30 ;;; You should have received a copy of the GNU General Public License
31 ;;; along with GNU Emacs; see the file COPYING. If not, write to the
32 ;;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
33 ;;; Boston, MA 02111-1307, USA.
37 ;;; This file works only with after version of Emacs 19.30.
38 ;;; This file needs miee.el and SEMI.
39 ;;; If you set gnus-offline-drafts-queue-type to 'agent , you don't need
41 ;;; You must use Semi-gnus 6.X.X.
45 ;;; Add following code at the end in your .emacs
47 ;;; (load "gnus-ofsetup")
48 ;;; (gnus-setup-for-offline)
49 ;;; (load gnus-offline-setting-file)
51 ;;; If you use gnus-agent as souper , put gnus-agent setup code in you .gnus.el
53 ;;; If you use nnspool as souper , put following code in your .emacs before
54 ;;; gnus-offline setting.
56 ;;; Then , put hang.exe in exec-path directory.
58 ;;; In Gnus group buffer , type g to get all news and mail.
59 ;;; Then send mail and news in spool directory.
62 ;;; gnus-offline-dialup-program-arguments
63 ;;; ... List of dialup program arguments.
64 ;;; gnus-offline-hangup-program-arguments
65 ;;; ... List of hangup program arguments.
66 ;;; gnus-offline-mail-treat-environ ... toggle sending mail online/offline.
67 ;;; gnus-offline-articles-to-fetch ... toggle fetch articles.
68 ;;; both->mail->news->both...
69 ;;; gnus-offline-load-hook ... hook before gnus-offline load.
70 ;;; gnus-offline-before-online-hook ... hook before all online jobs.
71 ;;; gnus-offline-after-online-hook ... hook after all online jobs.
72 ;;; gnus-offline-interval-time ... Interval time to do all online jobs.
74 ;;; gnus-offline-dialup-function ... Function to diualup.
75 ;;; gnus-offline-hangup-function ... Function to hangup.
79 (eval '(run-hooks 'gnus-offline-load-hook))
85 (unless (and (condition-case ()
91 (defmacro defgroup (&rest args))
92 (defmacro defcustom (symbol value &optional doc &rest args)
93 (` (defvar (, symbol) (, value) (, doc))))
95 (defgroup gnus-offline nil
96 "Offline backend utility for Gnus."
97 :prefix "gnus-offline-"
101 (defconst gnus-offline-version-number "2.00b5")
102 (defconst gnus-offline-codename
104 ;; "This is the time" ; 2.00
105 ;; "A matter of trust"
110 (defconst gnus-offline-version (format "Gnus offline backend utiliy v%s"
111 gnus-offline-version-number))
113 (defcustom gnus-offline-dialup-program-arguments nil
114 "*Program arguments of gnus-offline-dialup-program."
116 :type '(repeat (string :tag "Argument")))
118 (defcustom gnus-offline-hangup-program-arguments nil
119 "*Program arguments of gnus-offline-hangup-program."
121 :type '(repeat (string :tag "Argument")))
123 (defcustom gnus-offline-auto-hangup t
124 "*Whether dialup-network automatically hang up when all online jobs has done."
128 (defcustom gnus-offline-load-hook nil
129 "*Hook to be run after the gnus-offline package has been loaded."
133 (defcustom gnus-offline-before-online-hook nil
134 "*Hook to be run before all online jobs."
138 (defcustom gnus-offline-after-online-hook nil
139 "*Hook to be run after all online jobs."
143 (defcustom gnus-offline-mail-treat-environ 'offline
144 "*If online , gnus-offline send all mail under online environ.
145 If offline , gnus-offline send all mail temporary to spool dir."
147 :type '(choice (const offline)
150 (defcustom gnus-offline-articles-to-fetch 'both
151 "*If both , gnus-offline fetch mail and news articles.
152 If mail , gnus-offline only fetch mail articles.
153 If news , gnus-offline only fetch news articles."
155 :type '(choice (const both)
159 (defcustom gnus-offline-interval-time 0
160 "*Interval time(minutes) to do online jobs.
161 If set to 0 , timer call is disabled."
165 (defcustom gnus-offline-mail-group-level 1
166 "*Group level for mail group."
170 (defcustom gnus-offline-after-empting-spool-hook nil
171 "*Hook to be run before empting spool."
175 (defcustom gnus-offline-before-empting-spool-hook nil
176 "*Hook to be run after empting spool."
180 (defcustom gnus-offline-dialup-function 'gnus-offline-connect-server
181 "*Function to dialup."
185 (defcustom gnus-offline-hangup-function 'gnus-offline-hangup-line
186 "*Function to hangup."
190 ;;; Internal variables.
191 (defvar gnus-offline-connected nil
192 "*If value is t , dialup line is connected status.
193 If value is nil , dialup line is disconnected status.")
195 (defvar gnus-offline-news-fetch-method nil
196 "*Method to fetch news articles.")
198 (defvar gnus-offline-mail-fetch-method nil
199 "*Method to fetch mail articles.")
201 (defvar gnus-offline-header-string
202 (format "%s - \"%s\""
204 gnus-offline-codename)
205 "*Header string for gnus-offline.")
207 (defvar gnus-offline-stored-group-level nil
208 "*Mail Group level before changing.")
210 (defvar gnus-offline-movemail-arguments nil
211 "*All command line arguments of exec-directory/movemail.")
213 ;;; Temporary variable:
220 (defvar gnus-offline-error-buffer " *Error*")
221 (defvar gnus-offline-map (make-sparse-keymap))
223 ;;; To silence byte compiler
225 (fboundp 'eval-when-compile)
229 (eval-region (point-min) (point)))
230 (let (case-fold-search)
234 (unless (boundp symbol)
235 (make-local-variable symbol)
236 (eval (list 'setq symbol nil)))))
239 sendmail-to-spool-directory
240 news-spool-request-post-directory
248 gnus-agent-handle-level
250 (make-local-variable 'byte-compile-warnings)
251 (setq byte-compile-warnings nil))))
253 (put 'gnus-offline-set-unplugged-state 'menu-enable 'gnus-offline-connected)
254 (if (eq system-type 'windows-nt)
255 (define-process-argument-editing "/hang\\.exe\\'"
256 (lambda (x) (general-process-argument-editing-function
257 x nil t t nil t t))))
262 (defun gnus-offline-setup ()
263 "*Initialize gnus-offline function"
265 ;; Load setting file - required.
266 (load gnus-offline-setting-file)
269 (gnus-offline-define-menu-and-key)
271 ;; To transfer Mail/News function.
272 (cond ((eq gnus-offline-mail-treat-environ 'offline)
273 ;; send mail under online environ.
274 (gnus-offline-set-offline-sendmail-function))
275 ((eq gnus-offline-mail-treat-environ 'online)
276 ;; send mail under offline environ.
277 (gnus-offline-set-online-sendmail-function))))
280 ;; Setting Error check.
281 (defun gnus-offline-error-check ()
282 ;; Check gnus-agent and nnspool setting.
283 (cond ((eq gnus-offline-news-fetch-method 'nnagent)
284 ;; nnagent and gnus-agent loaded ??
285 (if (not (and (featurep 'gnus-agent)
286 (featurep 'nnagent)))
288 (get-buffer-create gnus-offline-error-buffer)
289 (set-buffer gnus-offline-error-buffer)
291 (insert "WARNING!!: gnus-agent.el or nnagent.el is not loaded.\n")
292 (insert "Please check your .emacs or .gnus.el to work gnus-agent fine.")
293 (pop-to-buffer gnus-offline-error-buffer))))
295 ((eq gnus-offline-news-fetch-method 'nnspool)
296 (if (not (featurep 'nnspool))
298 (get-buffer-create gnus-offline-error-buffer)
299 (set-buffer gnus-offline-error-buffer)
301 (insert "WARNING!!: nnspool.el is not loaded.\n")
302 (insert "Please check your .emacs or .gnus.el to work nnspool fine.")
303 (pop-to-buffer gnus-offline-error-buffer))))))
306 (defun gnus-offline-set-offline-sendmail-function ()
307 "*Initialize sendmail-function when unplugged status."
308 (if (eq gnus-offline-drafts-queue-type 'miee)
309 (setq message-send-mail-function 'sendmail-to-spool-in-gnspool-format)
310 (setq message-send-mail-function 'gnus-agent-send-mail)))
312 (defun gnus-offline-set-online-sendmail-function ()
313 "*Initialize sendmail-function when plugged status."
314 (if (eq gnus-offline-MTA-type 'smtp)
315 (setq message-send-mail-function 'message-send-mail-with-smtp)
316 (setq message-send-mail-function 'message-send-mail-with-sendmail)))
318 (defun gnus-offline-set-offline-post-news-function ()
319 "*Initialize sendnews-function when unplugged status."
320 (if (eq gnus-offline-drafts-queue-type 'miee)
321 (setq message-send-news-function 'gnspool-request-post)))
323 (defun gnus-offline-set-online-post-news-function ()
324 "*Initialize sendnews-function when plugged status."
325 (setq message-send-news-function 'message-send-news-with-gnus))
327 ;; Get new news jobs. (gnus-agent and nnspool)
329 (defun gnus-offline-gnus-get-new-news (&optional arg)
330 "*Override function \"gnus-grou-get-new-news\"."
332 (run-hooks 'gnus-offline-before-online-hook)
333 (if (functionp gnus-offline-dialup-function)
334 (funcall gnus-offline-dialup-function))
335 (gnus-offline-get-new-news-function)
336 (gnus-group-get-new-news arg))
341 (defun gnus-offline-connect-server ()
343 ;; Dialup if gnus-offline-dialup-program is specified
344 (if (stringp gnus-offline-dialup-program)
346 (message "Dialing ...")
347 (apply 'call-process gnus-offline-dialup-program nil nil nil
348 gnus-offline-dialup-program-arguments)
350 (message "Dialing ... done."))))
353 ;; Jobs before get new news , send mail and post news.
355 (defun gnus-offline-get-new-news-function ()
356 "*Prepare to get new news/mail."
357 ;; Set mail group level
358 (if (eq gnus-offline-articles-to-fetch 'mail)
359 (gnus-offline-set-mail-group-level gnus-offline-mail-group-level))
361 ;; Set to online environ.
362 (setq gnus-offline-connected t)
364 ;; Set send mail/news functions to online functions.
365 (gnus-offline-set-online-sendmail-function)
366 (gnus-offline-set-online-post-news-function)
367 (message "Set to online status.")
370 (if (eq gnus-offline-articles-to-fetch 'news)
371 (gnus-offline-disable-fetch-mail))
373 ;; fetch both mail and news. or Only mail.
374 (gnus-offline-enable-fetch-news)
375 (if (memq gnus-offline-articles-to-fetch '(both mail))
376 (gnus-offline-enable-fetch-mail))
378 ;; fetch only mail for gnus-agent
379 (if (and (eq gnus-offline-news-fetch-method 'nnagent)
380 (eq gnus-offline-articles-to-fetch 'mail))
381 (setq gnus-agent-handle-level gnus-offline-mail-group-level)))
384 ;; Change mail group level to handle only mail.
386 (defun gnus-offline-set-mail-group-level (level)
387 "*Set nnm* group level."
388 (switch-to-buffer gnus-group-buffer)
389 (goto-char (point-min))
391 ;; Save current level
392 (if (not gnus-offline-stored-group-level)
393 (while (re-search-forward " nnm" nil t)
394 (setq gnus-offline-stored-group-level
395 (append gnus-offline-stored-group-level
396 (list (gnus-group-group-level)))))
400 (goto-char (point-min))
401 (while (re-search-forward " nnm" nil t)
402 (gnus-group-set-current-level 1 level)
407 ;; Restore mail group level
409 (defun gnus-offline-restore-mail-group-level ()
410 "*Restore nnm* group level."
411 (switch-to-buffer gnus-group-buffer)
412 (goto-char (point-min))
414 (while (re-search-forward " nnm" nil t)
415 (gnus-group-set-current-level 1 (nth num gnus-offline-stored-group-level))
418 (beginning-of-line)))
420 ;; Jobs after getting new news.
422 (defun gnus-offline-after-get-new-news ()
423 "*After getting news and mail jobs."
424 (if (memq gnus-offline-articles-to-fetch '(both mail))
427 ;; send mail/news in spool
428 (gnus-offline-empting-spool)
429 (if (eq gnus-offline-articles-to-fetch 'mail)
431 ;; Send only mail and hang up...
432 (if (and gnus-offline-connected
433 gnus-offline-auto-hangup)
434 (gnus-offline-set-unplugged-state))
435 ;; Disable fetch mail.
436 (gnus-offline-disable-fetch-mail)
437 (gnus-offline-after-jobs-done)))))
440 (if (memq gnus-offline-articles-to-fetch '(both news))
442 (if gnus-offline-connected
443 (cond ((eq gnus-offline-news-fetch-method 'nnagent)
444 ;; Get New News (gnus-agent)
445 (gnus-agent-toggle-plugged t)
448 (gnus-agent-fetch-session)
450 ;; Hang Up line. then set to offline status.
451 (if (and gnus-offline-connected
452 gnus-offline-auto-hangup)
453 (gnus-offline-set-unplugged-state))
455 ;; All online jobs has done.
456 (gnus-offline-after-jobs-done))
458 (if (eq gnus-offline-news-fetch-method 'nnspool)
459 ;; Get New News (nnspool)
460 (gnspool-get-news))))))))
462 ;; Disable fetch mail
464 (defun gnus-offline-disable-fetch-mail ()
465 "*Set do not fetch mail."
466 (setq nnmail-spool-file nil))
470 (defun gnus-offline-enable-fetch-mail ()
471 "*Set to fetch mail."
472 (setq gnus-offline-mail-fetch-method 'nnmail)
473 (setq nnmail-movemail-program 'pop3-fma-movemail)
474 (setq nnmail-spool-file (append
475 pop3-fma-local-spool-file-alist
479 pop3-fma-spool-file-alist))))
483 (defun gnus-offline-enable-fetch-news ()
484 "*Set to fetch news."
485 (if (eq gnus-offline-news-fetch-method 'nnagent)
487 (setq gnus-agent-handle-level gnus-level-subscribed)
488 (gnus-agent-toggle-plugged t))))
491 ;; Add your custom header.
493 (defun gnus-offline-add-custom-header (header string)
494 "*Add X-Gnus-Offline-Backend header to Mail/News message."
496 (progn (goto-char (point-min))
498 (concat "^" (regexp-quote mail-header-separator) "\n"))
500 (goto-char (point-min))
501 (or (re-search-forward (concat "^" header) delimline t)
503 (goto-char delimline)
506 (setq hdr (concat header " "))
507 (setq str (concat hdr string))
508 (setq hdr (concat str "\n"))
509 (insert-string hdr)))))
511 ;; Add X-Offline-Backend header.
513 (defun gnus-offline-message-add-header ()
514 "*Add X-Gnus-Offline-Backend header to Mail/News message."
515 (if (eq gnus-offline-mail-treat-environ 'offline)
517 (if (eq gnus-offline-news-fetch-method 'nnagent)
518 (setq ver nnagent-version)
519 (setq ver nnspool-version))
520 (setq str (format "\n with %s" ver)
521 string (concat gnus-offline-header-string str))
522 (gnus-offline-add-custom-header "X-Gnus-Offline-Backend:" string))))
526 ;; Toggle plugged/unplugged
528 (defun gnus-offline-toggle-plugged (plugged)
529 "*Override function \"Jj\" - gnus-agent-toggle-plugged."
530 (interactive (list (not gnus-offline-connected)))
533 (setq gnus-offline-connected plugged)
534 (gnus-agent-toggle-plugged plugged)
535 ;; Set send mail/news function to offline functions.
536 (gnus-offline-set-online-sendmail-function)
537 (gnus-offline-set-online-post-news-function))
538 ;; Set to offline status
539 (gnus-offline-set-unplugged-state)))
541 ;; Function of hang up line.
543 (defun gnus-offline-set-unplugged-state ()
544 "*Set to unplugged state."
547 (if (functionp gnus-offline-hangup-function)
548 (funcall gnus-offline-hangup-function))
549 (setq gnus-offline-connected nil)
550 (if (eq gnus-offline-news-fetch-method 'nnagent)
551 (gnus-agent-toggle-plugged nil))
553 ;; Set send mail/news function to offline functions.
554 (gnus-offline-set-offline-sendmail-function)
555 (gnus-offline-set-offline-post-news-function)
557 (setenv "MAILHOST" nil))
559 ;; Hangup line function
561 (defun gnus-offline-hangup-line ()
562 "*Hangup line function."
563 (message "Hang up line ... ")
564 (if (stringp gnus-offline-hangup-program)
565 (apply 'start-process "hup" nil gnus-offline-hangup-program
566 gnus-offline-hangup-program-arguments))
567 (message "Hang up line ... done."))
569 ;; Hang Up line routine whe using nnspool
571 (defun gnus-offline-nnspool-hangup-line ()
572 (if (and gnus-offline-connected
573 gnus-offline-auto-hangup)
574 (gnus-offline-set-unplugged-state))
575 (gnus-offline-after-jobs-done))
577 ;; Function of all jobs has done.
579 (defun gnus-offline-after-jobs-done ()
580 "*Jobs after all online jobs."
581 (run-hooks 'gnus-offline-after-online-hook)
582 (if (eq gnus-offline-articles-to-fetch 'mail)
583 (gnus-offline-restore-mail-group-level))
584 (if (eq gnus-offline-news-fetch-method 'nnagent)
585 (gnus-offline-agent-expire))
587 (gnus-group-save-newsrc)
588 (message "All online jobs has done."))
592 ;; Toggle auto hang up
594 (defun gnus-offline-toggle-auto-hangup ()
595 "*Toggle auto hangup flag."
597 (setq string "Auto hang up logic")
598 (if gnus-offline-auto-hangup
600 (setq gnus-offline-auto-hangup nil
602 (setq gnus-offline-auto-hangup t
604 (message (format "%s %s" string str)))
606 ;; Toggle offline/online to send mail.
608 (defun gnus-offline-toggle-on/off-send-mail ()
609 "*Toggel online/offline sendmail."
611 (if (eq gnus-offline-mail-treat-environ 'offline)
613 ;; Sending mail under online environ.
614 (gnus-offline-set-online-sendmail-function)
615 (setq gnus-offline-mail-treat-environ 'online)
616 (message "Sending mail immidiately."))
617 ;; Sending mail under offline environ.
618 (gnus-offline-set-offline-sendmail-function)
619 (setq gnus-offline-mail-treat-environ 'offline)
620 (message "Sending mail temporary to spool directory.")))
622 ;; Toggle articles to fetch ... both -> mail -> news -> both
624 (defun gnus-offline-toggle-articles-to-fetch ()
625 "*Set articles to fetch... both(Mail/News) -> mail only -> News only -> both"
627 (setq string "Articles fetch from server.")
628 (cond ((eq gnus-offline-articles-to-fetch 'both)
629 (setq gnus-offline-articles-to-fetch 'mail
631 ((eq gnus-offline-articles-to-fetch 'mail)
632 (setq gnus-offline-articles-to-fetch 'news
635 (setq gnus-offline-articles-to-fetch 'both
636 str "Mail/News both")))
637 (message (format "%s %s" string str)))
639 ;; Toggle movemail program pop3.el -> movemail -> pop3.el
641 (defun gnus-offline-toggle-movemail-program ()
642 "*Toggle movemail program movemail -> pop3.el -> movemail ->..."
644 (setq string "Set nnmail-movemail-program")
645 (cond ((eq pop3-fma-movemail-type 'lisp)
646 (setq pop3-fma-movemail-type 'exe
649 (setq pop3-fma-movemail-type 'lisp
651 (message (format "%s %s" string str)))
653 ;; Send mail and Post news using Miee or gnus-agent.
655 (defun gnus-offline-empting-spool ()
656 "*Send all drafts on queue."
657 (run-hooks 'gnus-offline-before-empting-spool-hook)
658 (if (eq gnus-offline-drafts-queue-type 'miee)
659 ;; Send queued message by miee.el.
661 (if (eq gnus-offline-mail-treat-environ 'offline)
663 (message "Sending mails in spool ...")
664 ;; Using miee to send mail.
666 (message "Sending mails in spool ... done.")))
667 (message "Posting news in spool ...")
668 ;; Using miee to post news.
669 (if (and (not (stringp msspool-news-server))
670 (not msspool-news-service))
672 (setq msspool-news-server (nth 1 gnus-select-method))
673 (setq msspool-news-service 119)))
675 (message "Posting news in spool ... done."))
676 ;; Send queued message by gnus-agent
677 (message "Sending messages in spool ...")
678 (gnus-group-send-drafts)
679 (message "Sending messages in spool ... done."))
681 (run-hooks 'gnus-offline-after-empting-spool-hook))
685 (defun gnus-offline-set-interval-time ()
686 "*Set interval time for gnus-daemon."
688 (setq gnus-offline-interval-time
689 (string-to-int (read-from-minibuffer
690 (format "Interval time (now %s minutes) : "
691 gnus-offline-interval-time)
693 (if (< gnus-offline-interval-time 2)
695 (message "Retrieving message logic by timer is disabled.")
696 (setq gnus-offline-interval-time 0))
697 (message (format "Interval time set to %d minutes" gnus-offline-interval-time)))
698 (gnus-offline-processed-by-timer))
700 ;; Expire articles using gnus-agent.
702 (defun gnus-offline-agent-expire ()
703 "*Expire expirable article on News group."
709 (defun gnus-offline-define-menu-and-key ()
711 (if (eq gnus-offline-drafts-queue-type 'miee)
712 (add-hook 'gnus-group-mode-hook 'gnus-offline-define-menu-on-miee)
713 (add-hook 'gnus-group-mode-hook 'gnus-offline-define-menu-on-agent))
714 (add-hook 'gnus-group-mode-hook
716 (local-set-key "\C-coh" 'gnus-offline-set-unplugged-state)
717 (local-set-key "\C-com" 'gnus-offline-toggle-movemail-program)
718 (local-set-key "\C-cof" 'gnus-offline-toggle-articles-to-fetch)
719 (local-set-key "\C-coo" 'gnus-offline-toggle-on/off-send-mail)
720 (local-set-key "\C-cox" 'gnus-offline-toggle-auto-hangup)
721 (local-set-key "\C-cos" 'gnus-offline-set-interval-time)
722 (substitute-key-definition
723 'gnus-group-get-new-news 'gnus-offline-gnus-get-new-news
725 (if (eq gnus-offline-news-fetch-method 'nnagent)
727 (substitute-key-definition
728 'gnus-agent-toggle-plugged 'gnus-offline-toggle-plugged
729 gnus-agent-group-mode-map)
730 (local-set-key "\C-coe" 'gnus-offline-agent-expire)))))
731 (if (eq gnus-offline-news-fetch-method 'nnagent)
732 (add-hook 'gnus-summary-mode-hook
734 (substitute-key-definition
735 'gnus-agent-toggle-plugged 'gnus-offline-toggle-plugged
736 gnus-agent-summary-mode-map)))))
738 (defun gnus-offline-define-menu-on-miee ()
739 "*Set menu bar on MIEE menu."
743 gnus-offline-hup-separator]
750 (cons "Gnus Offline Utility"
751 (make-sparse-keymap "Gnus Offline Utiliry")))
757 gnus-offline-toggle-movemail-program]
758 '("Toggle movemail program" .
759 gnus-offline-toggle-movemail-program))
765 gnus-offline-toggle-articles-to-fetch]
766 '("Toggle articles to fetch" .
767 gnus-offline-toggle-articles-to-fetch))
773 gnus-offline-toggle-on/off-send-mail]
774 '("Toggle online/offline send mail" .
775 gnus-offline-toggle-on/off-send-mail))
781 gnus-offline-toggle-auto-hangup]
782 '("Toggle auto hang up" . gnus-offline-toggle-auto-hangup))
788 gnus-offline-expire-separator]
791 (if (eq gnus-offline-news-fetch-method 'nnagent)
796 gnus-offline-agent-expire]
797 '("Expire articles" . gnus-offline-agent-expire)))
803 gnus-offline-set-interval-time]
804 '("Set interval time." . gnus-offline-set-interval-time))
810 gnus-offline-hup-separator]
817 gnus-offline-set-unplugged-state]
818 '("Hang Up Line." . gnus-offline-set-unplugged-state)))
820 ;; define menu without miee.
822 (defun gnus-offline-define-menu-on-agent ()
823 "*Set menu bar on OFFLINE menu."
825 (lookup-key global-map [menu-bar])
827 (cons "Offline" (make-sparse-keymap "Offline"))
828 'help) ;; Actually this adds before "Help".
833 gnus-offline-toggle-movemail-program]
834 '("Toggle movemail program" . gnus-offline-toggle-movemail-program))
839 gnus-offline-toggle-articles-to-fetch]
840 '("Toggle articles to fetch" . gnus-offline-toggle-articles-to-fetch))
845 gnus-offline-toggle-on/off-send-mail]
846 '("Toggle online/offline send mail" . gnus-offline-toggle-on/off-send-mail))
851 gnus-offline-toggle-auto-hangup]
852 '("Toggle auto hang up" . gnus-offline-toggle-auto-hangup))
857 gnus-offline-separator]
860 (if (eq gnus-offline-news-fetch-method 'nnagent)
865 gnus-offline-agent-expire]
866 '("Expire articles" . gnus-offline-agent-expire))))
871 gnus-offline-set-interval-time]
872 '("Set interval time." . gnus-offline-set-interval-time))
877 gnus-offline-hup-separator]
883 gnus-offline-set-unplugged-state]
884 '("Hang Up Line." . gnus-offline-set-unplugged-state)))
888 (defun gnus-offline-processed-by-timer ()
889 "*Set timer interval."
890 (if (and (> gnus-offline-interval-time 0)
891 (not gnus-offline-connected))
893 (gnus-demon-add-handler 'gnus-offline-gnus-get-new-news
894 gnus-offline-interval-time
895 gnus-offline-interval-time))
896 (if (= gnus-offline-interval-time 0)
897 (gnus-demon-remove-handler 'gnus-offline-gnus-get-new-news t)))
900 (provide 'gnus-offline)
901 ;;; gnus-offline.el ends here