1 ;;; gnus-offline.el --- To process mail & news at offline environment.
2 ;;; $Id: gnus-offline.el,v 1.1.2.5.2.15 1998-12-10 09:58:13 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))
86 (unless (and (condition-case ()
92 (defmacro defgroup (&rest args))
93 (defmacro defcustom (symbol value &optional doc &rest args)
94 (` (defvar (, symbol) (, value) (, doc))))
96 (defgroup gnus-offline nil
97 "Offline backend utility for Gnus."
98 :prefix "gnus-offline-"
102 (defconst gnus-offline-version-number "2.00")
103 (defconst gnus-offline-codename
105 "This is the time" ; 2.00
106 ;; "A matter of trust"
111 (defconst gnus-offline-version (format "Gnus offline backend utiliy v%s"
112 gnus-offline-version-number))
114 (defcustom gnus-offline-dialup-program-arguments nil
115 "*Program arguments of gnus-offline-dialup-program."
117 :type '(repeat (string :tag "Argument")))
119 (defcustom gnus-offline-hangup-program-arguments nil
120 "*Program arguments of gnus-offline-hangup-program."
122 :type '(repeat (string :tag "Argument")))
124 (defcustom gnus-offline-auto-hangup t
125 "*Whether dialup-network automatically hang up when all online jobs has done."
129 (defcustom gnus-offline-load-hook nil
130 "*Hook to be run after the gnus-offline package has been loaded."
134 (defcustom gnus-offline-before-online-hook nil
135 "*Hook to be run before all online jobs."
139 (defcustom gnus-offline-after-online-hook nil
140 "*Hook to be run after all online jobs."
144 (defcustom gnus-offline-mail-treat-environ 'offline
145 "*If online , gnus-offline send all mail under online environ.
146 If offline , gnus-offline send all mail temporary to spool dir."
148 :type '(choice (const offline)
151 (defcustom gnus-offline-articles-to-fetch 'both
152 "*If both , gnus-offline fetch mail and news articles.
153 If mail , gnus-offline only fetch mail articles.
154 If news , gnus-offline only fetch news articles."
156 :type '(choice (const both)
160 (defcustom gnus-offline-interval-time 0
161 "*Interval time(minutes) to do online jobs.
162 If set to 0 , timer call is disabled."
166 (defcustom gnus-offline-mail-group-level 1
167 "*Group level for mail group."
171 (defcustom gnus-offline-after-empting-spool-hook nil
172 "*Hook to be run before empting spool."
176 (defcustom gnus-offline-before-empting-spool-hook nil
177 "*Hook to be run after empting spool."
181 (defcustom gnus-offline-dialup-function 'gnus-offline-connect-server
182 "*Function to dialup."
186 (defcustom gnus-offline-hangup-function 'gnus-offline-hangup-line
187 "*Function to hangup."
191 ;;; Internal variables.
192 (defvar gnus-offline-connected nil
193 "*If value is t , dialup line is connected status.
194 If value is nil , dialup line is disconnected status.")
196 (defvar gnus-offline-news-fetch-method nil
197 "*Method to fetch news articles.")
199 (defvar gnus-offline-mail-fetch-method nil
200 "*Method to fetch mail articles.")
202 (defvar gnus-offline-header-string
203 (format "%s - \"%s\""
205 gnus-offline-codename)
206 "*Header string for gnus-offline.")
208 (defvar gnus-offline-stored-group-level nil
209 "*Mail Group level before changing.")
211 (defvar gnus-offline-movemail-arguments nil
212 "*All command line arguments of exec-directory/movemail.")
214 ;;; Temporary variable:
221 (defvar gnus-offline-error-buffer " *Error*")
222 (defvar gnus-offline-map (make-sparse-keymap))
224 ;;; To silence byte compiler
226 (fboundp 'eval-when-compile)
230 (eval-region (point-min) (point)))
231 (let (case-fold-search)
235 (unless (boundp symbol)
236 (make-local-variable symbol)
237 (eval (list 'setq symbol nil)))))
240 sendmail-to-spool-directory
241 news-spool-request-post-directory
249 gnus-agent-handle-level
251 (make-local-variable 'byte-compile-warnings)
252 (setq byte-compile-warnings nil))))
254 (put 'gnus-offline-set-unplugged-state 'menu-enable 'gnus-offline-connected)
255 (if (eq system-type 'windows-nt)
256 (define-process-argument-editing "/hang\\.exe\\'"
257 (lambda (x) (general-process-argument-editing-function
258 x nil t t nil t t))))
263 (defun gnus-offline-setup ()
264 "*Initialize gnus-offline function"
266 ;; Load setting file - required.
267 (load gnus-offline-setting-file)
270 (gnus-offline-define-menu-and-key)
272 ;; To transfer Mail/News function.
273 (cond ((eq gnus-offline-mail-treat-environ 'offline)
274 ;; send mail under offline environ.
275 (gnus-offline-set-offline-sendmail-function))
276 ((eq gnus-offline-mail-treat-environ 'online)
277 ;; send mail under offline environ.
278 (gnus-offline-set-online-sendmail-function))))
279 ;; (add-hook 'gnus-group-mode-hook 'gnus-offline-setup))
282 ;; Setting Error check.
283 (defun gnus-offline-error-check ()
284 ;; Check gnus-agent and nnspool setting.
285 (cond ((eq gnus-offline-news-fetch-method 'nnagent)
286 ;; nnagent and gnus-agent loaded ??
287 (if (not (and (featurep 'gnus-agent)
288 (featurep 'nnagent)))
290 (get-buffer-create gnus-offline-error-buffer)
291 (set-buffer gnus-offline-error-buffer)
293 (insert "WARNING!!: gnus-agent.el or nnagent.el is not loaded.\n")
294 (insert "Please check your .emacs or .gnus.el to work gnus-agent fine.")
295 (pop-to-buffer gnus-offline-error-buffer))))
297 ((eq gnus-offline-news-fetch-method 'nnspool)
298 (if (not (featurep 'nnspool))
300 (get-buffer-create gnus-offline-error-buffer)
301 (set-buffer gnus-offline-error-buffer)
303 (insert "WARNING!!: nnspool.el is not loaded.\n")
304 (insert "Please check your .emacs or .gnus.el to work nnspool fine.")
305 (pop-to-buffer gnus-offline-error-buffer))))))
308 (defun gnus-offline-set-offline-sendmail-function ()
309 "*Initialize sendmail-function when unplugged status."
310 (if (eq gnus-offline-drafts-queue-type 'miee)
311 (if (eq gnus-offline-news-fetch-method 'nnagent)
312 (setq gnus-agent-send-mail-function 'sendmail-to-spool-in-gnspool-format))
313 (setq message-send-mail-function 'sendmail-to-spool-in-gnspool-format)
314 (setq gnus-agent-send-mail-function message-send-mail-function
315 message-send-mail-function 'gnus-agent-send-mail)))
317 (defun gnus-offline-set-online-sendmail-function ()
318 "*Initialize sendmail-function when plugged status."
319 (if (eq gnus-offline-MTA-type 'smtp)
320 (setq message-send-mail-function 'message-send-mail-with-smtp)
321 (setq message-send-mail-function 'message-send-mail-with-sendmail)))
323 (defun gnus-offline-set-offline-post-news-function ()
324 "*Initialize sendnews-function when unplugged status."
325 (if (eq gnus-offline-drafts-queue-type 'miee)
326 (setq message-send-news-function 'gnspool-request-post)))
328 (defun gnus-offline-set-online-post-news-function ()
329 "*Initialize sendnews-function when plugged status."
330 (setq message-send-news-function 'message-send-news-with-gnus))
332 ;; Get new news jobs. (gnus-agent and nnspool)
334 (defun gnus-offline-gnus-get-new-news (&optional arg)
335 "*Override function \"gnus-group-get-new-news\"."
337 (run-hooks 'gnus-offline-before-online-hook)
338 (if (functionp gnus-offline-dialup-function)
339 (funcall gnus-offline-dialup-function))
340 (gnus-offline-get-new-news-function)
341 (gnus-group-get-new-news arg))
346 (defun gnus-offline-connect-server ()
348 ;; Dialup if gnus-offline-dialup-program is specified
349 (if (stringp gnus-offline-dialup-program)
351 (message "Dialing ...")
352 (apply 'call-process gnus-offline-dialup-program nil nil nil
353 gnus-offline-dialup-program-arguments)
355 (message "Dialing ... done."))))
358 ;; Jobs before get new news , send mail and post news.
360 (defun gnus-offline-get-new-news-function ()
361 "*Prepare to get new news/mail."
362 ;; Set mail group level
363 (if (eq gnus-offline-articles-to-fetch 'mail)
364 (gnus-offline-set-mail-group-level gnus-offline-mail-group-level))
366 ;; Set to online environ.
367 (setq gnus-offline-connected t)
369 ;; Set send mail/news functions to online functions.
370 (gnus-offline-set-online-sendmail-function)
371 (gnus-offline-set-online-post-news-function)
372 (message "Set to online status.")
375 (if (eq gnus-offline-articles-to-fetch 'news)
376 (gnus-offline-disable-fetch-mail))
378 ;; fetch both mail and news. or Only mail.
379 (gnus-offline-enable-fetch-news)
380 (if (memq gnus-offline-articles-to-fetch '(both mail))
381 (gnus-offline-enable-fetch-mail))
383 ;; fetch only mail for gnus-agent
384 (if (and (eq gnus-offline-news-fetch-method 'nnagent)
385 (eq gnus-offline-articles-to-fetch 'mail))
386 (setq gnus-agent-handle-level gnus-offline-mail-group-level)))
389 ;; Change mail group level to handle only mail.
391 (defun gnus-offline-set-mail-group-level (level)
392 "*Set nnm* group level."
393 (switch-to-buffer gnus-group-buffer)
394 (goto-char (point-min))
396 ;; Save current level
397 (if (not gnus-offline-stored-group-level)
398 (while (re-search-forward " nnm" nil t)
399 (setq gnus-offline-stored-group-level
400 (append gnus-offline-stored-group-level
401 (list (gnus-group-group-level)))))
405 (goto-char (point-min))
406 (while (re-search-forward " nnm" nil t)
407 (gnus-group-set-current-level 1 level)
412 ;; Restore mail group level
414 (defun gnus-offline-restore-mail-group-level ()
415 "*Restore nnm* group level."
416 (switch-to-buffer gnus-group-buffer)
417 (goto-char (point-min))
419 (while (re-search-forward " nnm" nil t)
420 (gnus-group-set-current-level 1 (nth num gnus-offline-stored-group-level))
423 (beginning-of-line)))
425 ;; Jobs after getting new news.
427 (defun gnus-offline-after-get-new-news ()
428 "*After getting news and mail jobs."
429 (if (memq gnus-offline-articles-to-fetch '(both mail))
432 ;; send mail/news in spool
433 (gnus-offline-empting-spool)
434 (if (eq gnus-offline-articles-to-fetch 'mail)
436 ;; Send only mail and hang up...
437 (if (and gnus-offline-connected
438 gnus-offline-auto-hangup)
439 (gnus-offline-set-unplugged-state))
440 ;; Disable fetch mail.
441 (gnus-offline-disable-fetch-mail)
442 (gnus-offline-after-jobs-done)))))
445 (if (memq gnus-offline-articles-to-fetch '(both news))
447 (if gnus-offline-connected
448 (cond ((eq gnus-offline-news-fetch-method 'nnagent)
449 ;; Get New News (gnus-agent)
450 (gnus-agent-toggle-plugged t)
453 (gnus-agent-fetch-session)
455 ;; Hang Up line. then set to offline status.
456 (if (and gnus-offline-connected
457 gnus-offline-auto-hangup)
458 (gnus-offline-set-unplugged-state))
460 ;; All online jobs has done.
461 (gnus-offline-after-jobs-done))
463 (if (eq gnus-offline-news-fetch-method 'nnspool)
464 ;; Get New News (nnspool)
465 (gnspool-get-news))))))))
467 ;; Disable fetch mail
469 (defun gnus-offline-disable-fetch-mail ()
470 "*Set do not fetch mail."
471 (setq nnmail-spool-file nil))
475 (defun gnus-offline-enable-fetch-mail ()
476 "*Set to fetch mail."
477 (setq gnus-offline-mail-fetch-method 'nnmail)
478 (setq nnmail-movemail-program 'pop3-fma-movemail)
479 (setq nnmail-spool-file (append
480 pop3-fma-local-spool-file-alist
484 pop3-fma-spool-file-alist))))
488 (defun gnus-offline-enable-fetch-news ()
489 "*Set to fetch news."
490 (if (eq gnus-offline-news-fetch-method 'nnagent)
492 (setq gnus-agent-handle-level gnus-level-subscribed)
493 (gnus-agent-toggle-plugged t))))
496 ;; Add your custom header.
498 (defun gnus-offline-add-custom-header (header string)
499 "*Add X-Gnus-Offline-Backend header to Mail/News message."
501 (progn (goto-char (point-min))
503 (concat "^" (regexp-quote mail-header-separator) "\n"))
505 (goto-char (point-min))
506 (or (re-search-forward (concat "^" header) delimline t)
508 (goto-char delimline)
511 (setq hdr (concat header " "))
512 (setq str (concat hdr string))
513 (setq hdr (concat str "\n"))
514 (insert-string hdr)))))
516 ;; Add X-Offline-Backend header.
518 (defun gnus-offline-message-add-header ()
519 "*Add X-Gnus-Offline-Backend header to Mail/News message."
520 (if (eq gnus-offline-mail-treat-environ 'offline)
522 (if (eq gnus-offline-news-fetch-method 'nnagent)
523 (setq ver nnagent-version)
524 (setq ver nnspool-version))
525 (setq str (format "\n with %s" ver)
526 string (concat gnus-offline-header-string str))
527 (gnus-offline-add-custom-header "X-Gnus-Offline-Backend:" string))))
531 ;; Toggle plugged/unplugged
533 (defun gnus-offline-toggle-plugged (plugged)
534 "*Override function \"Jj\" - gnus-agent-toggle-plugged."
535 (interactive (list (not gnus-offline-connected)))
538 (setq gnus-offline-connected plugged)
539 (gnus-agent-toggle-plugged plugged)
540 ;; Set send mail/news function to offline functions.
541 (gnus-offline-set-online-sendmail-function)
542 (gnus-offline-set-online-post-news-function))
543 ;; Set to offline status
544 (gnus-offline-set-unplugged-state)))
546 ;; Function of hang up line.
548 (defun gnus-offline-set-unplugged-state ()
549 "*Set to unplugged state."
552 (if (functionp gnus-offline-hangup-function)
553 (funcall gnus-offline-hangup-function))
554 (setq gnus-offline-connected nil)
555 (if (eq gnus-offline-news-fetch-method 'nnagent)
556 (gnus-agent-toggle-plugged nil))
558 ;; Set send mail/news function to offline functions.
559 (gnus-offline-set-offline-sendmail-function)
560 (gnus-offline-set-offline-post-news-function)
562 (setenv "MAILHOST" nil))
564 ;; Hangup line function
566 (defun gnus-offline-hangup-line ()
567 "*Hangup line function."
568 (message "Hang up line ... ")
569 (if (stringp gnus-offline-hangup-program)
570 (apply 'start-process "hup" nil gnus-offline-hangup-program
571 gnus-offline-hangup-program-arguments))
572 (message "Hang up line ... done."))
574 ;; Hang Up line routine whe using nnspool
576 (defun gnus-offline-nnspool-hangup-line ()
577 (if (and gnus-offline-connected
578 gnus-offline-auto-hangup)
579 (gnus-offline-set-unplugged-state))
580 (gnus-offline-after-jobs-done))
582 ;; Function of all jobs has done.
584 (defun gnus-offline-after-jobs-done ()
585 "*Jobs after all online jobs."
586 (run-hooks 'gnus-offline-after-online-hook)
587 (if (eq gnus-offline-articles-to-fetch 'mail)
588 (gnus-offline-restore-mail-group-level))
589 (if (eq gnus-offline-news-fetch-method 'nnagent)
590 (or (featurep 'xemacs)
591 (gnus-offline-agent-expire)))
592 (if (and (featurep 'xemacs)
593 (fboundp 'play-sound-file))
596 (gnus-group-save-newsrc)
597 (message "All online jobs has done."))
601 ;; Toggle auto hang up
603 (defun gnus-offline-toggle-auto-hangup ()
604 "*Toggle auto hangup flag."
606 (setq string "Auto hang up logic")
607 (if gnus-offline-auto-hangup
609 (setq gnus-offline-auto-hangup nil
611 (setq gnus-offline-auto-hangup t
613 (message (format "%s %s" string str)))
615 ;; Toggle offline/online to send mail.
617 (defun gnus-offline-toggle-on/off-send-mail ()
618 "*Toggel online/offline sendmail."
620 (if (eq gnus-offline-mail-treat-environ 'offline)
622 ;; Sending mail under online environ.
623 (gnus-offline-set-online-sendmail-function)
624 (setq gnus-offline-mail-treat-environ 'online)
625 (message "Sending mail immidiately."))
626 ;; Sending mail under offline environ.
627 (gnus-offline-set-offline-sendmail-function)
628 (setq gnus-offline-mail-treat-environ 'offline)
629 (message "Sending mail temporary to spool directory.")))
631 ;; Toggle articles to fetch ... both -> mail -> news -> both
633 (defun gnus-offline-toggle-articles-to-fetch ()
634 "*Set articles to fetch... both(Mail/News) -> mail only -> News only -> both"
636 (setq string "Articles fetch from server.")
637 (cond ((eq gnus-offline-articles-to-fetch 'both)
638 (setq gnus-offline-articles-to-fetch 'mail
640 ((eq gnus-offline-articles-to-fetch 'mail)
641 (setq gnus-offline-articles-to-fetch 'news
644 (setq gnus-offline-articles-to-fetch 'both
645 str "Mail/News both")))
646 (message (format "%s %s" string str)))
648 ;; Toggle movemail program pop3.el -> movemail -> pop3.el
650 (defun gnus-offline-toggle-movemail-program ()
651 "*Toggle movemail program movemail -> pop3.el -> movemail ->..."
653 (setq string "Set nnmail-movemail-program")
654 (cond ((eq pop3-fma-movemail-type 'lisp)
655 (setq pop3-fma-movemail-type 'exe
658 (setq pop3-fma-movemail-type 'lisp
660 (message (format "%s %s" string str)))
662 ;; Send mail and Post news using Miee or gnus-agent.
664 (defun gnus-offline-empting-spool ()
665 "*Send all drafts on queue."
666 (run-hooks 'gnus-offline-before-empting-spool-hook)
667 (if (eq gnus-offline-drafts-queue-type 'miee)
668 ;; Send queued message by miee.el.
670 (if (eq gnus-offline-mail-treat-environ 'offline)
672 (message "Sending mails in spool ...")
673 ;; Using miee to send mail.
675 (message "Sending mails in spool ... done.")))
676 (message "Posting news in spool ...")
677 ;; Using miee to post news.
678 (if (and (not (stringp msspool-news-server))
679 (not msspool-news-service))
681 (setq msspool-news-server (nth 1 gnus-select-method))
682 (setq msspool-news-service 119)))
684 (message "Posting news in spool ... done."))
685 ;; Send queued message by gnus-agent
686 (message "Sending messages in spool ...")
687 (gnus-group-send-drafts)
688 (message "Sending messages in spool ... done."))
690 (run-hooks 'gnus-offline-after-empting-spool-hook))
694 (defun gnus-offline-set-interval-time ()
695 "*Set interval time for gnus-daemon."
697 (setq gnus-offline-interval-time
698 (string-to-int (read-from-minibuffer
699 (format "Interval time (now %s minutes) : "
700 gnus-offline-interval-time)
702 (if (< gnus-offline-interval-time 2)
704 (message "Retrieving message logic by timer is disabled.")
705 (setq gnus-offline-interval-time 0))
706 (message (format "Interval time set to %d minutes" gnus-offline-interval-time)))
707 (gnus-offline-processed-by-timer))
709 ;; Expire articles using gnus-agent.
711 (defun gnus-offline-agent-expire ()
712 "*Expire expirable article on News group."
718 (defun gnus-offline-define-menu-and-key ()
720 (if (eq gnus-offline-drafts-queue-type 'miee)
721 (add-hook 'gnus-group-mode-hook 'gnus-offline-define-menu-on-miee)
722 (add-hook 'gnus-group-mode-hook 'gnus-offline-define-menu-on-agent))
723 (add-hook 'gnus-group-mode-hook
725 (local-set-key "\C-coh" 'gnus-offline-set-unplugged-state)
726 (local-set-key "\C-com" 'gnus-offline-toggle-movemail-program)
727 (local-set-key "\C-cof" 'gnus-offline-toggle-articles-to-fetch)
728 (local-set-key "\C-coo" 'gnus-offline-toggle-on/off-send-mail)
729 (local-set-key "\C-cox" 'gnus-offline-toggle-auto-hangup)
730 (local-set-key "\C-cos" 'gnus-offline-set-interval-time)
731 (substitute-key-definition
732 'gnus-group-get-new-news 'gnus-offline-gnus-get-new-news
734 (if (eq gnus-offline-news-fetch-method 'nnagent)
736 (substitute-key-definition
737 'gnus-agent-toggle-plugged 'gnus-offline-toggle-plugged
738 gnus-agent-group-mode-map)
739 (local-set-key "\C-coe" 'gnus-offline-agent-expire)))))
740 (if (eq gnus-offline-news-fetch-method 'nnagent)
741 (add-hook 'gnus-summary-mode-hook
743 (substitute-key-definition
744 'gnus-agent-toggle-plugged 'gnus-offline-toggle-plugged
745 gnus-agent-summary-mode-map)))))
748 (defun gnus-offline-define-menu-on-miee ()
749 "*Set menu bar on MIEE menu."
751 gnus-offline-menu-on-miee gnus-group-mode-map "Gnus offline menu on Miee"
753 ["Post news in spool" news-spool-post t]
754 ["Send mails in spool" mail-spool-send t]
756 ["Message Offline" message-offline-state (not message-offline-state)]
757 ["Message Online" message-online-state message-online-state]
760 ["Toggle movemail program" gnus-offline-toggle-movemail-program t]
761 ["Toggle articles to fetch" gnus-offline-toggle-articles-to-fetch t]
762 ["Toggle online/offline send mail" gnus-offline-toggle-on/off-send-mail t]
763 ["Toggle auto hangup" gnus-offline-toggle-auto-hangup t]
765 ["Expire articles" gnus-offline-agent-expire (eq gnus-offline-news-fetch-method 'nnagent)]
766 ["Set interval time" gnus-offline-set-interval-time t]
768 ["Hang up Line." gnus-offline-set-unplugged-state (gnus-offline-connected)]
771 ;; define menu without miee.
773 (defun gnus-offline-define-menu-on-agent ()
774 "*Set menu bar on OFFLINE menu."
776 gnus-offline-menu-on-agent gnus-group-mode-map "Gnus offline Menu"
778 ["Toggle movemail program" gnus-offline-toggle-movemail-program t]
779 ["Toggle articles to fetch" gnus-offline-toggle-articles-to-fetch t]
780 ["Toggle online/offline send mail" gnus-offline-toggle-on/off-send-mail t]
781 ["Toggle auto hangup" gnus-offline-toggle-auto-hangup t]
783 ["Expire articles" gnus-offline-agent-expire (eq gnus-offline-news-fetch-method 'nnagent)]
784 ["Set interval time" gnus-offline-set-interval-time t]
786 ["Hang up Line." gnus-offline-set-unplugged-state (gnus-offline-connected)]))
787 (and (featurep 'xemacs)
788 (easy-menu-add gnus-offline-menu-on-agent)))
792 (defun gnus-offline-processed-by-timer ()
793 "*Set timer interval."
794 (if (and (> gnus-offline-interval-time 0)
795 (not gnus-offline-connected))
797 (gnus-demon-add-handler 'gnus-offline-gnus-get-new-news
798 gnus-offline-interval-time
799 gnus-offline-interval-time))
800 (if (= gnus-offline-interval-time 0)
801 (gnus-demon-remove-handler 'gnus-offline-gnus-get-new-news t)))
804 (provide 'gnus-offline)
805 ;;; gnus-offline.el ends here