aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Love2000-10-27 19:48:50 +0000
committerDave Love2000-10-27 19:48:50 +0000
commit03f20b4797dd0a48aee18775bdfe78f7b2db1cee (patch)
tree6e8d7baa154eb567c2910fbfbed8d90f3700c016
parentd71d711415e9b18383adb82b2d890eac95b82bdf (diff)
downloademacs-03f20b4797dd0a48aee18775bdfe78f7b2db1cee.tar.gz
emacs-03f20b4797dd0a48aee18775bdfe78f7b2db1cee.zip
2000-10-27 Simon Josefsson <simon@josefsson.org>
* gnus-agent.el (gnus-agent-possibly-do-gcc): (gnus-agent-restore-gcc): (gnus-agent-possibly-save-gcc): New functions. Asks the user to synch flags with server when you plug in. * gnus-agent.el (gnus-agent-synchronize-flags): New variable. (gnus-agent-possibly-synchronize-flags-server): New function, use it. (gnus-agent-toggle-plugged): Call it. (gnus-agent-synchronize-flags): Renamed from `gnus-agent-synchronize'. (gnus-agent-group-mode-map): `g-a-s' -> `g-a-s-flags'. (gnus-agent-possibly-synchronize-flags): New function. (gnus-agent-possibly-synchronize-flags-server): New function. 2000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu> * gnus.el (gnus-xmas-define): Defalias gnus-overlay-buffer, gnus-overlay-start. * gnus.el (gnus-agent-fetching): New variable. * gnus-agent.el (gnus-agent-with-fetch): Bind it. * gnus-agent.el (gnus-agent-fetch-session): Catch quit. (gnus-agent-fetch-group-1): Score-param could be nil. (gnus-agent-any-covered-gcc): New function. (gnus-agent-possibly-save-gcc): Use it. (gnus-agent-possibly-do-gcc): Ditto. * gnus-agent.el: Revoke Mike McEwan's 1998-09-05 patch due to the GNU assignment issue. (gnus-agent-fetch-group-1): Reimplement Mike McEwan's proposal. * gnus-agent.el: timer vs. itimer.
-rw-r--r--lisp/gnus/ChangeLog80
-rw-r--r--lisp/gnus/gnus-agent.el188
2 files changed, 191 insertions, 77 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 759680f3cd4..5c232105809 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,10 +1,79 @@
12000-09-24 Simon Josefsson <simon@josefsson.org> 12000-10-27 Dave Love <fx@gnu.org>
2
3 * gnus.el: Don't require custom. Don't require message at top
4 level.
5 (gnus-message-archive-method): Require message here.
6
72000-10-27 Kai Gro,A_(Bjohann <Kai.Grossjohann@CS.Uni-Dortmund.DE>
8
9 * gnus-sum.el (gnus-get-split-value): Use first match only (Ed L
10 Cashin <ecashin@coe.uga.edu>).
11
122000-10-27 Simon Josefsson <simon@josefsson.org>
13
14 * gnus-agent.el (gnus-agent-possibly-do-gcc):
15 (gnus-agent-restore-gcc):
16 (gnus-agent-possibly-save-gcc): New functions.
17
18 Asks the user to synch flags with server when you plug in.
19
20 * gnus-agent.el (gnus-agent-synchronize-flags): New variable.
21 (gnus-agent-possibly-synchronize-flags-server): New function, use it.
22 (gnus-agent-toggle-plugged): Call it.
23 (gnus-agent-synchronize-flags): Renamed from `gnus-agent-synchronize'.
24 (gnus-agent-group-mode-map): `g-a-s' -> `g-a-s-flags'.
25 (gnus-agent-possibly-synchronize-flags): New function.
26 (gnus-agent-possibly-synchronize-flags-server): New function.
27
28 * nnheader.el (nnheader-parse-head): Try both "from:" and "from: ".
29
30 * gnus-sum.el (gnus-get-newsgroup-headers): Ditto.
2 31
3 * gnus-group.el (gnus-group-nnimap-edit-acl): Check if server 32 * gnus-group.el (gnus-group-nnimap-edit-acl): Check if server
4 support ACL's. 33 support ACL's.
5 34
62000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu> 352000-10-27 ShengHuo ZHU <zsh@cs.rochester.edu>
7 36
37 * gnus.el (gnus-xmas-define): Defalias gnus-overlay-buffer,
38 gnus-overlay-start.
39 * gnus.el (gnus-agent-fetching): New variable.
40 * gnus-agent.el (gnus-agent-with-fetch): Bind it.
41
42 * gnus-agent.el (gnus-agent-fetch-session): Catch quit.
43 (gnus-agent-fetch-group-1): Score-param could be nil.
44 (gnus-agent-any-covered-gcc): New function.
45 (gnus-agent-possibly-save-gcc): Use it.
46 (gnus-agent-possibly-do-gcc): Ditto.
47 * gnus-agent.el: Revoke Mike McEwan's 1998-09-05 patch due to
48 the GNU assignment issue.
49 (gnus-agent-fetch-group-1): Reimplement Mike McEwan's proposal.
50 * gnus-agent.el: timer vs. itimer.
51
52 * webmail.el (webmail-type-definition): Fix my-deja open url.
53 (webmail-hotmail-list): Fix.
54 (webmail-netscape-open, webmail-hotmail-article,
55 webmail-hotmail-list): Update.
56 (webmail-my-deja-*): Rewrite.
57
58 * gnus-sum.el (gnus-refer-article-methods): The second could be
59 a named method.
60 (gnus-cache-write-active): Auto load.
61 (gnus-summary-display-article): Enable multibyte.
62 (gnus-summary-select-article): Don't enable multibyte here.
63 (gnus-summary-goto-article): Ditto.
64 (gnus-summary-enter-digest-group): Decode to-address.
65
66 * mm-util.el (mm-multibyte-p): Test (featurep 'xemacs).
67 (mm-with-unibyte-current-buffer-mule4): New function.
68 (mm-enable-multibyte-mule4): New.
69 (mm-disable-multibyte-mule4): New.
70
71 * mm-util.el (mm-enable-multibyte-mule4): New.
72 (mm-disable-multibyte-mule4): New.
73 * gnus-sum.el (gnus-summary-mode): Use it.
74 (gnus-summary-select-article): Ditto.
75 (gnus-summary-goto-article): Use enable multibyte.
76
8 * nnkiboze.el (nnkiboze-generate-group): Use it. Inhibit list groups. 77 * nnkiboze.el (nnkiboze-generate-group): Use it. Inhibit list groups.
9 (nnkiboze-enter-nov): Fix it when there is no xref. 78 (nnkiboze-enter-nov): Fix it when there is no xref.
10 (nnkiboze-generate-groups): List groups. 79 (nnkiboze-generate-groups): List groups.
@@ -26,15 +95,14 @@
26 (message-default-charset): Set default value in non-MULE XEmacsen 95 (message-default-charset): Set default value in non-MULE XEmacsen
27 as iso-8859-1. 96 as iso-8859-1.
28 97
292000-10-27 Emerick Rogul <emerick@csa.bu.edu>
30
31 * message.el (message-setup-fill-variables): New variable.
32 (message-mode): Use it.
33
342000-10-27 Bjorn Torkelsson <torkel@hpc2n.umu.se> 982000-10-27 Bjorn Torkelsson <torkel@hpc2n.umu.se>
35 99
36 * message.el: xemacs cleanup (use featurep ' xemacs) 100 * message.el: xemacs cleanup (use featurep ' xemacs)
37 101
102 * nnheader.el: ditto
103
104 * mm-util.el: ditto
105
382000-10-27 Stanislav Shalunov <shalunov@internet2.edu> 1062000-10-27 Stanislav Shalunov <shalunov@internet2.edu>
39 107
40 * message.el (message-make-in-reply-to): In-Reply-To is message-id 108 * message.el (message-make-in-reply-to): In-Reply-To is message-id
diff --git a/lisp/gnus/gnus-agent.el b/lisp/gnus/gnus-agent.el
index 3a4d4bb81f6..39f1dde08c4 100644
--- a/lisp/gnus/gnus-agent.el
+++ b/lisp/gnus/gnus-agent.el
@@ -2,6 +2,7 @@
2;; Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc. 2;; Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
3 3
4;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org> 4;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
5;; Maintainer: bugs@gnus.org
5;; This file is part of GNU Emacs. 6;; This file is part of GNU Emacs.
6 7
7;; GNU Emacs is free software; you can redistribute it and/or modify 8;; GNU Emacs is free software; you can redistribute it and/or modify
@@ -27,10 +28,12 @@
27(require 'gnus-cache) 28(require 'gnus-cache)
28(require 'nnvirtual) 29(require 'nnvirtual)
29(require 'gnus-sum) 30(require 'gnus-sum)
31(require 'gnus-score)
30(eval-when-compile 32(eval-when-compile
31 (require 'timer) 33 (if (featurep 'xemacs)
32 (require 'cl) 34 (require 'itimer)
33 (require 'gnus-score)) 35 (require 'timer))
36 (require 'cl))
34 37
35(defcustom gnus-agent-directory (nnheader-concat gnus-directory "agent/") 38(defcustom gnus-agent-directory (nnheader-concat gnus-directory "agent/")
36 "Where the Gnus agent will store its files." 39 "Where the Gnus agent will store its files."
@@ -83,6 +86,14 @@ If nil, only read articles will be expired."
83 :group 'gnus-agent 86 :group 'gnus-agent
84 :type 'function) 87 :type 'function)
85 88
89(defcustom gnus-agent-synchronize-flags 'ask
90 "Indicate if flags are synchronized when you plug in.
91If this is `ask' the hook will query the user."
92 :type '(choice (const :tag "Always" t)
93 (const :tag "Never" nil)
94 (const :tag "Ask" ask))
95 :group 'gnus-agent)
96
86;;; Internal variables 97;;; Internal variables
87 98
88(defvar gnus-agent-history-buffers nil) 99(defvar gnus-agent-history-buffers nil)
@@ -100,10 +111,6 @@ If nil, only read articles will be expired."
100(defvar gnus-agent-send-mail-function nil) 111(defvar gnus-agent-send-mail-function nil)
101(defvar gnus-agent-file-coding-system 'raw-text) 112(defvar gnus-agent-file-coding-system 'raw-text)
102 113
103(defconst gnus-agent-scoreable-headers
104 '("subject" "from" "date" "message-id" "references" "chars" "lines" "xref")
105 "Headers that are considered when scoring articles for download via the Agent.")
106
107;; Dynamic variables 114;; Dynamic variables
108(defvar gnus-headers) 115(defvar gnus-headers)
109(defvar gnus-score) 116(defvar gnus-score)
@@ -186,7 +193,7 @@ If nil, only read articles will be expired."
186(defmacro gnus-agent-with-fetch (&rest forms) 193(defmacro gnus-agent-with-fetch (&rest forms)
187 "Do FORMS safely." 194 "Do FORMS safely."
188 `(unwind-protect 195 `(unwind-protect
189 (progn 196 (let ((gnus-agent-fetching t))
190 (gnus-agent-start-fetch) 197 (gnus-agent-start-fetch)
191 ,@forms) 198 ,@forms)
192 (gnus-agent-stop-fetch))) 199 (gnus-agent-stop-fetch)))
@@ -233,7 +240,7 @@ If nil, only read articles will be expired."
233 "Jc" gnus-enter-category-buffer 240 "Jc" gnus-enter-category-buffer
234 "Jj" gnus-agent-toggle-plugged 241 "Jj" gnus-agent-toggle-plugged
235 "Js" gnus-agent-fetch-session 242 "Js" gnus-agent-fetch-session
236 "JY" gnus-agent-synchronize 243 "JY" gnus-agent-synchronize-flags
237 "JS" gnus-group-send-drafts 244 "JS" gnus-group-send-drafts
238 "Ja" gnus-agent-add-group 245 "Ja" gnus-agent-add-group
239 "Jr" gnus-agent-remove-group) 246 "Jr" gnus-agent-remove-group)
@@ -290,6 +297,7 @@ If nil, only read articles will be expired."
290 (if plugged 297 (if plugged
291 (progn 298 (progn
292 (setq gnus-plugged plugged) 299 (setq gnus-plugged plugged)
300 (gnus-agent-possibly-synchronize-flags)
293 (gnus-run-hooks 'gnus-agent-plugged-hook) 301 (gnus-run-hooks 'gnus-agent-plugged-hook)
294 (setcar (cdr gnus-agent-mode-status) " Plugged")) 302 (setcar (cdr gnus-agent-mode-status) " Plugged"))
295 (gnus-agent-close-connections) 303 (gnus-agent-close-connections)
@@ -371,6 +379,43 @@ be a select method."
371 (while (search-backward "\n" nil t) 379 (while (search-backward "\n" nil t)
372 (replace-match "\\n" t t)))) 380 (replace-match "\\n" t t))))
373 381
382(defun gnus-agent-restore-gcc ()
383 "Restore GCC field from saved header."
384 (save-excursion
385 (goto-char (point-min))
386 (while (re-search-forward (concat gnus-agent-gcc-header ":") nil t)
387 (replace-match "Gcc:" 'fixedcase))))
388
389(defun gnus-agent-any-covered-gcc ()
390 (save-restriction
391 (message-narrow-to-headers)
392 (let* ((gcc (mail-fetch-field "gcc" nil t))
393 (methods (and gcc
394 (mapcar 'gnus-inews-group-method
395 (message-unquote-tokens
396 (message-tokenize-header
397 gcc " ,")))))
398 covered)
399 (while (and (not covered) methods)
400 (setq covered
401 (member (car methods) gnus-agent-covered-methods)
402 methods (cdr methods)))
403 covered)))
404
405(defun gnus-agent-possibly-save-gcc ()
406 "Save GCC if Gnus is unplugged."
407 (when (and (not gnus-plugged) (gnus-agent-any-covered-gcc))
408 (save-excursion
409 (goto-char (point-min))
410 (let ((case-fold-search t))
411 (while (re-search-forward "^gcc:" nil t)
412 (replace-match (concat gnus-agent-gcc-header ":") 'fixedcase))))))
413
414(defun gnus-agent-possibly-do-gcc ()
415 "Do GCC if Gnus is plugged."
416 (when (or gnus-plugged (not (gnus-agent-any-covered-gcc)))
417 (gnus-inews-do-gcc)))
418
374;;; 419;;;
375;;; Group mode commands 420;;; Group mode commands
376;;; 421;;;
@@ -425,27 +470,49 @@ be a select method."
425 (setf (cadddr c) (delete group (cadddr c)))))) 470 (setf (cadddr c) (delete group (cadddr c))))))
426 (gnus-category-write))) 471 (gnus-category-write)))
427 472
428(defun gnus-agent-synchronize () 473(defun gnus-agent-synchronize-flags ()
429 "Synchronize local, unplugged, data with backend. 474 "Synchronize unplugged flags with servers."
430Currently sends flag setting requests, if any." 475 (interactive)
476 (save-excursion
477 (dolist (gnus-command-method gnus-agent-covered-methods)
478 (when (file-exists-p (gnus-agent-lib-file "flags"))
479 (gnus-agent-synchronize-flags-server gnus-command-method)))))
480
481(defun gnus-agent-possibly-synchronize-flags ()
482 "Synchronize flags according to `gnus-agent-synchronize-flags'."
431 (interactive) 483 (interactive)
432 (save-excursion 484 (save-excursion
433 (dolist (gnus-command-method gnus-agent-covered-methods) 485 (dolist (gnus-command-method gnus-agent-covered-methods)
434 (when (file-exists-p (gnus-agent-lib-file "flags")) 486 (when (file-exists-p (gnus-agent-lib-file "flags"))
435 (set-buffer (get-buffer-create " *Gnus Agent flag synchronize*")) 487 (gnus-agent-possibly-synchronize-flags-server gnus-command-method)))))
436 (erase-buffer) 488
437 (nnheader-insert-file-contents (gnus-agent-lib-file "flags")) 489(defun gnus-agent-synchronize-flags-server (method)
438 (if (null (gnus-check-server gnus-command-method)) 490 "Synchronize flags set when unplugged for server."
439 (message "Couldn't open server %s" (nth 1 gnus-command-method)) 491 (let ((gnus-command-method method))
440 (while (not (eobp)) 492 (when (file-exists-p (gnus-agent-lib-file "flags"))
441 (if (null (eval (read (current-buffer)))) 493 (set-buffer (get-buffer-create " *Gnus Agent flag synchronize*"))
442 (progn (forward-line) 494 (erase-buffer)
443 (kill-line -1)) 495 (nnheader-insert-file-contents (gnus-agent-lib-file "flags"))
444 (write-file (gnus-agent-lib-file "flags")) 496 (if (null (gnus-check-server gnus-command-method))
445 (error "Couldn't set flags from file %s" 497 (message "Couldn't open server %s" (nth 1 gnus-command-method))
446 (gnus-agent-lib-file "flags")))) 498 (while (not (eobp))
447 (write-file (gnus-agent-lib-file "flags"))) 499 (if (null (eval (read (current-buffer))))
448 (kill-buffer nil))))) 500 (progn (forward-line)
501 (kill-line -1))
502 (write-file (gnus-agent-lib-file "flags"))
503 (error "Couldn't set flags from file %s"
504 (gnus-agent-lib-file "flags"))))
505 (delete-file (gnus-agent-lib-file "flags")))
506 (kill-buffer nil))))
507
508(defun gnus-agent-possibly-synchronize-flags-server (method)
509 "Synchronize flags for server according to `gnus-agent-synchronize-flags'."
510 (when (or (and gnus-agent-synchronize-flags
511 (not (eq gnus-agent-synchronize-flags 'ask)))
512 (and (eq gnus-agent-synchronize-flags 'ask)
513 (gnus-y-or-n-p (format "Synchronize flags on server `%s'? "
514 (cadr method)))))
515 (gnus-agent-synchronize-flags-server method)))
449 516
450;;; 517;;;
451;;; Server mode commands 518;;; Server mode commands
@@ -1034,7 +1101,11 @@ the actual number of articles toggled is returned."
1034 (error 1101 (error
1035 (unless (funcall gnus-agent-confirmation-function 1102 (unless (funcall gnus-agent-confirmation-function
1036 (format "Error (%s). Continue? " err)) 1103 (format "Error (%s). Continue? " err))
1037 (error "Cannot fetch articles into the Gnus agent.")))) 1104 (error "Cannot fetch articles into the Gnus agent.")))
1105 (quit
1106 (unless (funcall gnus-agent-confirmation-function
1107 (format "Quit (%s). Continue? " err))
1108 (signal 'quit "Cannot fetch articles into the Gnus agent."))))
1038 (pop methods)) 1109 (pop methods))
1039 (gnus-message 6 "Finished fetching articles into the Gnus agent")))) 1110 (gnus-message 6 "Finished fetching articles into the Gnus agent"))))
1040 1111
@@ -1057,17 +1128,13 @@ the actual number of articles toggled is returned."
1057 ;; Fetch headers. 1128 ;; Fetch headers.
1058 (when (and (or (gnus-active group) (gnus-activate-group group)) 1129 (when (and (or (gnus-active group) (gnus-activate-group group))
1059 (setq articles (gnus-agent-fetch-headers group)) 1130 (setq articles (gnus-agent-fetch-headers group))
1060 (progn 1131 (let ((nntp-server-buffer gnus-agent-overview-buffer))
1061 ;; Parse them and see which articles we want to fetch. 1132 ;; Parse them and see which articles we want to fetch.
1062 (setq gnus-newsgroup-dependencies 1133 (setq gnus-newsgroup-dependencies
1063 (make-vector (length articles) 0)) 1134 (make-vector (length articles) 0))
1064 ;; No need to call `gnus-get-newsgroup-headers-xover' with 1135 (setq gnus-newsgroup-headers
1065 ;; the entire .overview for group as we still have the just 1136 (gnus-get-newsgroup-headers-xover articles nil nil
1066 ;; downloaded headers in `gnus-agent-overview-buffer'. 1137 group))
1067 (let ((nntp-server-buffer gnus-agent-overview-buffer))
1068 (setq gnus-newsgroup-headers
1069 (gnus-get-newsgroup-headers-xover articles nil nil
1070 group)))
1071 ;; `gnus-agent-overview-buffer' may be killed for 1138 ;; `gnus-agent-overview-buffer' may be killed for
1072 ;; timeout reason. If so, recreate it. 1139 ;; timeout reason. If so, recreate it.
1073 (gnus-agent-create-buffer))) 1140 (gnus-agent-create-buffer)))
@@ -1076,45 +1143,24 @@ the actual number of articles toggled is returned."
1076 (gnus-get-predicate 1143 (gnus-get-predicate
1077 (or (gnus-group-find-parameter group 'agent-predicate t) 1144 (or (gnus-group-find-parameter group 'agent-predicate t)
1078 (cadr category)))) 1145 (cadr category))))
1079 ;; Do we want to download everything, or nothing? 1146 (if (memq (caaddr predicate) '(gnus-agent-true gnus-agent-false))
1080 (if (or (eq (caaddr predicate) 'gnus-agent-true) 1147 ;; Simple implementation
1081 (eq (caaddr predicate) 'gnus-agent-false)) 1148 (setq arts
1082 ;; Yes. 1149 (and (eq (caaddr predicate) 'gnus-agent-true) articles))
1083 (setq arts (symbol-value 1150 (setq arts nil)
1084 (cadr (assoc (caaddr predicate)
1085 '((gnus-agent-true articles)
1086 (gnus-agent-false nil))))))
1087 ;; No, we need to decide what we want.
1088 (setq score-param 1151 (setq score-param
1089 (let ((score-method 1152 (or (gnus-group-get-parameter group 'agent-score t)
1090 (or 1153 (caddr category)))
1091 (gnus-group-find-parameter group 'agent-score t) 1154 ;; Translate score-param into real one
1092 (caddr category)))) 1155 (cond
1093 (when score-method 1156 ((not score-param))
1094 (require 'gnus-score) 1157 ((eq score-param 'file)
1095 (if (eq score-method 'file) 1158 (setq score-param (gnus-all-score-files group)))
1096 (let ((entries 1159 ((stringp (car score-param)))
1097 (gnus-score-load-files 1160 (t
1098 (gnus-all-score-files group))) 1161 (setq score-param (list (list score-param)))))
1099 list score-file)
1100 (while (setq list (car entries))
1101 (push (car list) score-file)
1102 (setq list (cdr list))
1103 (while list
1104 (when (member (caar list)
1105 gnus-agent-scoreable-headers)
1106 (push (car list) score-file))
1107 (setq list (cdr list)))
1108 (setq score-param
1109 (append score-param (list (nreverse score-file)))
1110 score-file nil entries (cdr entries)))
1111 (list score-param))
1112 (if (stringp (car score-method))
1113 score-method
1114 (list (list score-method)))))))
1115 (when score-param 1162 (when score-param
1116 (gnus-score-headers score-param)) 1163 (gnus-score-headers score-param))
1117 (setq arts nil)
1118 (while (setq gnus-headers (pop gnus-newsgroup-headers)) 1164 (while (setq gnus-headers (pop gnus-newsgroup-headers))
1119 (setq gnus-score 1165 (setq gnus-score
1120 (or (cdr (assq (mail-header-number gnus-headers) 1166 (or (cdr (assq (mail-header-number gnus-headers)