* lisp/gnus.el (gnus-revision-number): Increment to 03.
[elisp/gnus.git-] / lisp / gnus-offline.el
index 0b5e4b3..e0d16be 100644 (file)
@@ -1,5 +1,5 @@
 ;;; gnus-offline.el --- To process mail & news at offline environment.
-;;; $Id: gnus-offline.el,v 1.1.2.5.2.30 1999-02-01 05:39:42 ichikawa Exp $
+;;; $Id: gnus-offline.el,v 1.1.2.5.2.34 1999-03-22 18:13:31 czkmt Exp $
 
 ;;; Copyright (C) 1998 Tatsuya Ichikawa
 ;;;                    Yukihiro Ito
 ;;; In Gnus group buffer , type g to get all news and mail.
 ;;; Then send mail and news in spool directory.
 ;;;
-;;; Security Notice. (This is available before version 2.02)
-;;;
-;;; You can set the variable gnus-offline-pop-password-file to save your POP
-;;; passwords. But TAKE CARE. Use it at your own risk.
-;;; If you decide to use it, then write in .emacs or .gnus-offline.el 
-;;; something like:
-;;;
-;;;  (setq gnus-offline-pop-password-file "~/.pop.passwd")
-;;;
-;;; and write in this file something like:
-;;;
-;;;  (setq pop3-fma-password
-;;;     '(("SERVER1" "ACCOUNT1" "PASSWORD1")
-;;;       ("SERVER2" "ACCOUNT2" "PASSWORD2")
-;;;        ............................
-;;;        ))
-;;;
-;;; If you want to encode the file with base64, try:
-;;;
-;;;    M-: (base64-encode-region (point-min) (point-max))
-;;;
 ;;; Variables.
 ;;;  gnus-offline-dialup-program-arguments
 ;;;                                   ... List of dialup program arguments.
@@ -95,9 +74,6 @@
 ;;;                                        (minutes)
 ;;;  gnus-offline-dialup-function     ... Function to diualup.
 ;;;  gnus-offline-hangup-function     ... Function to hangup.
-;;;  gnus-offline-pop-password-file   ... File to keep the POP password info.
-;;;  gnus-offline-pop-password-decoding-function
-;;;                                   ... Function to decode the password info.
 
 ;;; Code:
 
 (require 'cl)
 (require 'custom)
 (require 'easymenu)
+(provide 'gnus-offline)
 
 (unless (and (condition-case ()
                 (require 'custom)
@@ -213,23 +190,6 @@ If set to 0 , timer call is disabled."
   :group 'gnus-offline
   :type 'function)
 
-(defcustom gnus-offline-pop-password-file nil
-  "*File name for saving one's POP password information.
-This variable should be nil if there's some possibility that
-your passwords be stolen."
-  :group 'gnus-offline
-  :type '(choice (file :tag "File")
-                (const nil)))
-
-(defcustom gnus-offline-pop-password-decoding-function 
-  (function (lambda () (base64-decode-region (point-min) (point-max))))
-  "*Function for decoding one's password information.
-The value has no effect when `gnus-offline-pop-password-file'
-is nil.
-This variable might be nil if you don't need to encode your passwords."
-  :group 'gnus-offline
-  :type 'function)
-
 ;;; Internal variables.
 (defvar gnus-offline-connected nil
   "*If value is t , dialup line is connected status.
@@ -384,26 +344,7 @@ If value is nil , dialup line is disconnected status.")
   (if (functionp gnus-offline-dialup-function)
       (funcall gnus-offline-dialup-function))
   (gnus-offline-get-new-news-function)
-  (if (featurep 'running-pterodactyl-gnus-0_73-or-later)
-      (gnus-group-get-new-news arg)
-    (let ((buffer (get-buffer-create "*offline-temp*")))
-      (unwind-protect
-         (progn
-           (if (boundp 'pop3-fma-password)
-               (setq pop3-fma-save-password-information t))
-           (save-excursion
-             (set-buffer buffer)
-             (erase-buffer)
-             (insert-file-contents-as-binary gnus-offline-pop-password-file)
-             (and gnus-offline-pop-password-decoding-function
-                  (funcall gnus-offline-pop-password-decoding-function))
-             (eval-buffer))
-           (gnus-group-get-new-news arg))
-       (if (boundp 'pop3-fma-password)
-           (setq pop3-fma-password nil
-                 pop3-fma-save-password-information nil)
-         (setq mail-source-password-cache nil))
-       (kill-buffer buffer)))))
+  (gnus-group-get-new-news arg))
 
 ;;
 ;; dialup...
@@ -822,12 +763,12 @@ If value is nil , dialup line is disconnected status.")
       ;; Overwrite the toolbar spec for gnus-group-mode.
       (add-hook 'gnus-startup-hook
                (lambda ()
-                 (let ((i 0) (stat t) but)
-                   (while (and stat (setq but (nth i gnus-group-toolbar)))
-                     (and (equal 'gnus-group-get-new-news (aref but 1))
-                          (aset but 1 'gnus-offline-gnus-get-new-news)
-                          (setq stat nil))
-                     (setq i (1+ i))))))))
+                 (catch 'tag
+                   (mapcar (lambda (but)
+                             (when (eq 'gnus-group-get-new-news (aref but 1))
+                               (aset but 1 'gnus-offline-gnus-get-new-news)
+                               (throw 'tag nil)))
+                           gnus-group-toolbar))))))
 ;;
 ;;
 (defun gnus-offline-define-menu-on-miee ()
@@ -846,7 +787,7 @@ If value is nil , dialup line is disconnected status.")
         "----"
         ("Gnus Offline"
          ["movemail \e$B$N@ZBX$(\e(B" gnus-offline-toggle-movemail-program
-          (not (featurep 'running-pterodactyl-gnus-0_73-or-later))
+          (not (featurep 'running-pterodactyl-gnus-0_73-or-later))]
          ["\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]
@@ -868,7 +809,7 @@ If value is nil , dialup line is disconnected status.")
        "----"
        ("Gnus Offline"
        ["Toggle movemail program" gnus-offline-toggle-movemail-program
-        (not (featurep 'running-pterodactyl-gnus-0_73-or-later))
+        (not (featurep 'running-pterodactyl-gnus-0_73-or-later))]
        ["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]
@@ -892,7 +833,7 @@ If value is nil , dialup line is disconnected status.")
    (if (featurep 'meadow)
        '("Offline"
         ["movemail \e$B$N@ZBX$(\e(B" gnus-offline-toggle-movemail-program
-         (not (featurep 'running-pterodactyl-gnus-0_73-or-later))
+         (not (featurep 'running-pterodactyl-gnus-0_73-or-later))]
         ["\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]
@@ -903,7 +844,7 @@ If value is nil , dialup line is disconnected status.")
         ["\e$B2s@~$N@ZCG\e(B" gnus-offline-set-unplugged-state gnus-offline-connected])
      '("Offline"
        ["Toggle movemail program" gnus-offline-toggle-movemail-program
-       (not (featurep 'running-pterodactyl-gnus-0_73-or-later))
+       (not (featurep 'running-pterodactyl-gnus-0_73-or-later))]
        ["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]
@@ -917,16 +858,31 @@ If value is nil , dialup line is disconnected status.")
 ;;
 ;; Popup menu within the group buffer (under Emacs).
 ;;
+(defvar gnus-offline-popup-menu nil)
 (defun gnus-offline-popup-menu (event)
   "Popup menu for Gnus offline."
   (interactive "e")
-  (let* ((menu (if (boundp 'miee-popup-menu)
-                  (or (assoc 'keymap
-                             (assoc 'Miee (assoc 'menu-bar global-map)))
-                      miee-popup-menu)
-                gnus-offline-menu-on-agent))
-        (pop (x-popup-menu t menu))
-        (func (and pop (lookup-key menu (apply 'vector pop)))))
+  (unless gnus-offline-popup-menu
+    (setq gnus-offline-popup-menu
+         (or (featurep 'xemacs)
+             (let ((menu
+                    (if (boundp 'miee-popup-menu)
+                        (or (assoc 'keymap
+                                   (assoc 'Miee (assoc 'menu-bar global-map)))
+                            miee-popup-menu)
+                      gnus-offline-menu-on-agent)))
+               (if (string< emacs-version "20")
+                   (append (list 'keymap
+                                 (if (boundp 'miee-popup-menu)
+                                     '(nil "Miee")
+                                   '(nil "Offline"))
+                                 '(nil "")
+                                 '(nil ""))
+                           (cdr menu))
+                 menu)))))
+  (let* ((pop (x-popup-menu t gnus-offline-popup-menu))
+        (func (and pop (lookup-key gnus-offline-popup-menu
+                                   (apply 'vector pop)))))
     (and pop func (funcall func))))
 \f
 ;;
@@ -943,5 +899,4 @@ If value is nil , dialup line is disconnected status.")
       (gnus-demon-remove-handler 'gnus-offline-gnus-get-new-news t)))
 ;;
 ;;
-(provide 'gnus-offline)
 ;;; gnus-offline.el ends here