diff options
| author | Gnus developers | 2010-10-10 22:48:40 +0000 |
|---|---|---|
| committer | Katsumi Yamaoka | 2010-10-10 22:48:40 +0000 |
| commit | dab0271f8dfd284e0ecd5022745a67c182410b81 (patch) | |
| tree | f2691cc40ee0625e33677905602745440f451563 /lisp | |
| parent | 355cdaf37b7eeef16d23c4bf7fce7b69d56423ec (diff) | |
| download | emacs-dab0271f8dfd284e0ecd5022745a67c182410b81.tar.gz emacs-dab0271f8dfd284e0ecd5022745a67c182410b81.zip | |
Merge changes made in Gnus trunk.
nnimap.el (nnimap-wait-for-response): If the user hits `C-g', kill the process, too.
nnir.el (gnus-summary-nnir-goto-thread): Modify to work with imap.
nnimap.el (nnimap-update-info): If the server doesn't return any useful info, just use the previous info.
nnimap.el (nnimap-update-info): Prefer old info over start-article.
nnimap.el (nnimap-update-qresync-info): Finish implementing QRESYNC.
auth-source.el (auth-source-create): Use (user-login-name) for the user name default.
nnimap.el (nnimap-open-connection): Use gnutls STARTTLS, if available.
nnimap.el (nnimap-update-info): Rely more on the current active than the param active to avoid marking articles as read too much.
gnus-sum.el (gnus-summary-set-local-parameters): Ignore the `active' non-variable, too.
nnimap.el (nnimap-update-qresync-info): \Flagged messages are read for Gnus.
nnimap.el (nnimap-retrieve-group-data-early): utf7-encode the group parameters.
nnimap.el (nnimap-update-qresync-info): Mark \Seen articles as read.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/gnus/ChangeLog | 38 | ||||
| -rw-r--r-- | lisp/gnus/auth-source.el | 5 | ||||
| -rw-r--r-- | lisp/gnus/gnus-sum.el | 3 | ||||
| -rw-r--r-- | lisp/gnus/nnimap.el | 110 | ||||
| -rw-r--r-- | lisp/gnus/nnir.el | 84 |
5 files changed, 170 insertions, 70 deletions
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 3b2a61e3d3d..2b88592be9d 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog | |||
| @@ -1,3 +1,41 @@ | |||
| 1 | 2010-10-10 Lars Magne Ingebrigtsen <larsi@gnus.org> | ||
| 2 | |||
| 3 | * nnimap.el (nnimap-update-qresync-info): \Flagged messages are read | ||
| 4 | for Gnus. | ||
| 5 | (nnimap-retrieve-group-data-early): utf7-encode the group parameters. | ||
| 6 | (nnimap-update-qresync-info): Mark \Seen articles as read. | ||
| 7 | |||
| 8 | * gnus-sum.el (gnus-summary-set-local-parameters): Ignore the `active' | ||
| 9 | non-variable, too. | ||
| 10 | |||
| 11 | * nnimap.el (nnimap-open-connection): Use gnutls STARTTLS, if | ||
| 12 | available. | ||
| 13 | (nnimap-update-info): Rely more on the current active than the param | ||
| 14 | active to avoid marking articles as read too much. | ||
| 15 | |||
| 16 | * auth-source.el (auth-source-create): Use (user-login-name) for the | ||
| 17 | user name default. | ||
| 18 | |||
| 19 | * nnimap.el (nnimap-update-info): If the server doesn't return any | ||
| 20 | useful info, just use the previous info. | ||
| 21 | (nnimap-update-info): Prefer old info over start-article. | ||
| 22 | (nnimap-update-qresync-info): Finish implementing QRESYNC. | ||
| 23 | |||
| 24 | 2010-10-10 Andrew Cohen <cohen@andy.bu.edu> | ||
| 25 | |||
| 26 | * nnir.el (autoload): Clean up autoloads. | ||
| 27 | (nnir-imap-default-search-key): Renamed from | ||
| 28 | nnir-imap-search-field. Use key rather than value. | ||
| 29 | (nnir-imap-search-other): New variable. | ||
| 30 | (nnir-read-parm): Use it. | ||
| 31 | (nnir-imap-expr-to-imap): Use %S rather than imap-quote-specials. | ||
| 32 | (gnus-summary-nnir-goto-thread): Modify to work with imap. | ||
| 33 | |||
| 34 | 2010-10-10 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 35 | |||
| 36 | * nnimap.el (nnimap-wait-for-response): If the user hits `C-g', kill | ||
| 37 | the process, too. | ||
| 38 | |||
| 1 | 2010-10-09 Lars Magne Ingebrigtsen <larsi@gnus.org> | 39 | 2010-10-09 Lars Magne Ingebrigtsen <larsi@gnus.org> |
| 2 | 40 | ||
| 3 | * spam.el (gnus-summary-mode-map): Bind to "$". Suggested by Russ | 41 | * spam.el (gnus-summary-mode-map): Bind to "$". Suggested by Russ |
diff --git a/lisp/gnus/auth-source.el b/lisp/gnus/auth-source.el index 0b1d8eb57af..20e4af189d9 100644 --- a/lisp/gnus/auth-source.el +++ b/lisp/gnus/auth-source.el | |||
| @@ -336,7 +336,10 @@ Return structure as specified by MODE." | |||
| 336 | passwd)) | 336 | passwd)) |
| 337 | ((equal "login" m) | 337 | ((equal "login" m) |
| 338 | (or user | 338 | (or user |
| 339 | (read-string (format "User name for %s on %s: " prot host)))) | 339 | (read-string |
| 340 | (format "User name for %s on %s (default %s): " prot host | ||
| 341 | (user-login-name)) | ||
| 342 | nil nil (user-login-name)))) | ||
| 340 | (t | 343 | (t |
| 341 | "unknownuser")))) | 344 | "unknownuser")))) |
| 342 | (if (consp mode) mode (list mode)))) | 345 | (if (consp mode) mode (list mode)))) |
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index a0566900757..1a8d4549b26 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el | |||
| @@ -3841,7 +3841,8 @@ This function is intended to be used in | |||
| 3841 | 3841 | ||
| 3842 | (defun gnus-summary-set-local-parameters (group) | 3842 | (defun gnus-summary-set-local-parameters (group) |
| 3843 | "Go through the local params of GROUP and set all variable specs in that list." | 3843 | "Go through the local params of GROUP and set all variable specs in that list." |
| 3844 | (let ((vars '(quit-config))) ; Ignore quit-config. | 3844 | (let ((vars '(quit-config active))) ; Ignore things that aren't |
| 3845 | ; really variables. | ||
| 3845 | (dolist (elem (gnus-group-find-parameter group)) | 3846 | (dolist (elem (gnus-group-find-parameter group)) |
| 3846 | (and (consp elem) ; Has to be a cons. | 3847 | (and (consp elem) ; Has to be a cons. |
| 3847 | (consp (cdr elem)) ; The cdr has to be a list. | 3848 | (consp (cdr elem)) ; The cdr has to be a list. |
diff --git a/lisp/gnus/nnimap.el b/lisp/gnus/nnimap.el index b30e5868669..73b7fbdb733 100644 --- a/lisp/gnus/nnimap.el +++ b/lisp/gnus/nnimap.el | |||
| @@ -295,7 +295,9 @@ textual parts.") | |||
| 295 | (port nil) | 295 | (port nil) |
| 296 | (ports | 296 | (ports |
| 297 | (cond | 297 | (cond |
| 298 | ((eq nnimap-stream 'network) | 298 | ((or (eq nnimap-stream 'network) |
| 299 | (and (eq nnimap-stream 'starttls) | ||
| 300 | (fboundp 'open-gnutls-stream))) | ||
| 299 | (open-network-stream | 301 | (open-network-stream |
| 300 | "*nnimap*" (current-buffer) nnimap-address | 302 | "*nnimap*" (current-buffer) nnimap-address |
| 301 | (setq port | 303 | (setq port |
| @@ -357,8 +359,16 @@ textual parts.") | |||
| 357 | (push (format "%s" nnimap-server-port) ports)) | 359 | (push (format "%s" nnimap-server-port) ports)) |
| 358 | ;; If this is a STARTTLS-capable server, then sever the | 360 | ;; If this is a STARTTLS-capable server, then sever the |
| 359 | ;; connection and start a STARTTLS connection instead. | 361 | ;; connection and start a STARTTLS connection instead. |
| 360 | (when (and (eq nnimap-stream 'network) | 362 | (cond |
| 361 | (member "STARTTLS" (nnimap-capabilities nnimap-object))) | 363 | ((and (or (and (eq nnimap-stream 'network) |
| 364 | (member "STARTTLS" | ||
| 365 | (nnimap-capabilities nnimap-object))) | ||
| 366 | (eq nnimap-stream 'starttls)) | ||
| 367 | (fboundp 'open-gnutls-stream)) | ||
| 368 | (nnimap-command "STARTTLS") | ||
| 369 | (gnutls-negotiate (nnimap-process nnimap-object) nil)) | ||
| 370 | ((and (eq nnimap-stream 'network) | ||
| 371 | (member "STARTTLS" (nnimap-capabilities nnimap-object))) | ||
| 362 | (let ((nnimap-stream 'starttls)) | 372 | (let ((nnimap-stream 'starttls)) |
| 363 | (let ((tls-process | 373 | (let ((tls-process |
| 364 | (nnimap-open-connection buffer))) | 374 | (nnimap-open-connection buffer))) |
| @@ -369,7 +379,7 @@ textual parts.") | |||
| 369 | (when (memq (process-status tls-process) '(open run)) | 379 | (when (memq (process-status tls-process) '(open run)) |
| 370 | (delete-process (nnimap-process nnimap-object)) | 380 | (delete-process (nnimap-process nnimap-object)) |
| 371 | (kill-buffer (current-buffer)) | 381 | (kill-buffer (current-buffer)) |
| 372 | (return tls-process))))) | 382 | (return tls-process)))))) |
| 373 | (unless (equal connection-result "PREAUTH") | 383 | (unless (equal connection-result "PREAUTH") |
| 374 | (if (not (setq credentials | 384 | (if (not (setq credentials |
| 375 | (if (eq nnimap-authenticator 'anonymous) | 385 | (if (eq nnimap-authenticator 'anonymous) |
| @@ -949,7 +959,7 @@ textual parts.") | |||
| 949 | (erase-buffer) | 959 | (erase-buffer) |
| 950 | (setf (nnimap-group nnimap-object) nil) | 960 | (setf (nnimap-group nnimap-object) nil) |
| 951 | ;; QRESYNC handling isn't implemented. | 961 | ;; QRESYNC handling isn't implemented. |
| 952 | (let ((qresyncp (member "notQRESYNC" (nnimap-capabilities nnimap-object))) | 962 | (let ((qresyncp (member "QRESYNC" (nnimap-capabilities nnimap-object))) |
| 953 | params groups sequences active uidvalidity modseq group) | 963 | params groups sequences active uidvalidity modseq group) |
| 954 | ;; Go through the infos and gather the data needed to know | 964 | ;; Go through the infos and gather the data needed to know |
| 955 | ;; what and how to request the data. | 965 | ;; what and how to request the data. |
| @@ -964,7 +974,8 @@ textual parts.") | |||
| 964 | modseq) | 974 | modseq) |
| 965 | (push | 975 | (push |
| 966 | (list (nnimap-send-command "EXAMINE %S (QRESYNC (%s %s))" | 976 | (list (nnimap-send-command "EXAMINE %S (QRESYNC (%s %s))" |
| 967 | group uidvalidity modseq) | 977 | (utf7-encode group t) |
| 978 | uidvalidity modseq) | ||
| 968 | 'qresync | 979 | 'qresync |
| 969 | nil group 'qresync) | 980 | nil group 'qresync) |
| 970 | sequences) | 981 | sequences) |
| @@ -982,7 +993,8 @@ textual parts.") | |||
| 982 | ;; examine), but will tell us whether the group | 993 | ;; examine), but will tell us whether the group |
| 983 | ;; is read-only or not. | 994 | ;; is read-only or not. |
| 984 | "SELECT"))) | 995 | "SELECT"))) |
| 985 | (push (list (nnimap-send-command "%s %S" command group) | 996 | (push (list (nnimap-send-command "%s %S" command |
| 997 | (utf7-encode group t)) | ||
| 986 | (nnimap-send-command "UID FETCH %d:* FLAGS" start) | 998 | (nnimap-send-command "UID FETCH %d:* FLAGS" start) |
| 987 | start group command) | 999 | start group command) |
| 988 | sequences))) | 1000 | sequences))) |
| @@ -1038,7 +1050,9 @@ textual parts.") | |||
| 1038 | ;; completely empty groups. | 1050 | ;; completely empty groups. |
| 1039 | ((and (not existing) | 1051 | ((and (not existing) |
| 1040 | (not uidnext)) | 1052 | (not uidnext)) |
| 1041 | ) | 1053 | (let ((active (cdr (assq 'active (gnus-info-params info))))) |
| 1054 | (when active | ||
| 1055 | (gnus-set-active (gnus-info-group info) active)))) | ||
| 1042 | ;; We have a mismatch between the old and new UIDVALIDITY | 1056 | ;; We have a mismatch between the old and new UIDVALIDITY |
| 1043 | ;; identifiers, so we have to re-request the group info (the next | 1057 | ;; identifiers, so we have to re-request the group info (the next |
| 1044 | ;; time). This virtually never happens. | 1058 | ;; time). This virtually never happens. |
| @@ -1051,9 +1065,11 @@ textual parts.") | |||
| 1051 | (gnus-group-remove-parameter info 'modseq)) | 1065 | (gnus-group-remove-parameter info 'modseq)) |
| 1052 | ;; We have the data needed to update. | 1066 | ;; We have the data needed to update. |
| 1053 | (t | 1067 | (t |
| 1054 | (let ((group (gnus-info-group info)) | 1068 | (let* ((group (gnus-info-group info)) |
| 1055 | (completep (and start-article | 1069 | (completep (and start-article |
| 1056 | (= start-article 1)))) | 1070 | (= start-article 1))) |
| 1071 | (active (or (gnus-active group) | ||
| 1072 | (cdr (assq 'active (gnus-info-params info)))))) | ||
| 1057 | (when uidnext | 1073 | (when uidnext |
| 1058 | (setq high (1- uidnext))) | 1074 | (setq high (1- uidnext))) |
| 1059 | ;; First set the active ranges based on high/low. | 1075 | ;; First set the active ranges based on high/low. |
| @@ -1066,6 +1082,8 @@ textual parts.") | |||
| 1066 | (uidnext | 1082 | (uidnext |
| 1067 | ;; No articles in this group. | 1083 | ;; No articles in this group. |
| 1068 | (cons uidnext (1- uidnext))) | 1084 | (cons uidnext (1- uidnext))) |
| 1085 | (active | ||
| 1086 | active) | ||
| 1069 | (start-article | 1087 | (start-article |
| 1070 | (cons start-article (1- start-article))) | 1088 | (cons start-article (1- start-article))) |
| 1071 | (t | 1089 | (t |
| @@ -1073,7 +1091,7 @@ textual parts.") | |||
| 1073 | nil))) | 1091 | nil))) |
| 1074 | (gnus-set-active | 1092 | (gnus-set-active |
| 1075 | group | 1093 | group |
| 1076 | (cons (car (gnus-active group)) | 1094 | (cons (car active) |
| 1077 | (or high (1- uidnext))))) | 1095 | (or high (1- uidnext))))) |
| 1078 | ;; See whether this is a read-only group. | 1096 | ;; See whether this is a read-only group. |
| 1079 | (unless (eq permanent-flags 'not-scanned) | 1097 | (unless (eq permanent-flags 'not-scanned) |
| @@ -1089,7 +1107,7 @@ textual parts.") | |||
| 1089 | (not start-article)) | 1107 | (not start-article)) |
| 1090 | ;; We've gotten the data by QRESYNCing. | 1108 | ;; We've gotten the data by QRESYNCing. |
| 1091 | (nnimap-update-qresync-info | 1109 | (nnimap-update-qresync-info |
| 1092 | info (nnimap-imap-ranges-to-gnus-ranges vanished) flags) | 1110 | info existing (nnimap-imap-ranges-to-gnus-ranges vanished) flags) |
| 1093 | ;; Do normal non-QRESYNC flag updates. | 1111 | ;; Do normal non-QRESYNC flag updates. |
| 1094 | ;; Update the list of read articles. | 1112 | ;; Update the list of read articles. |
| 1095 | (let* ((unread | 1113 | (let* ((unread |
| @@ -1137,13 +1155,35 @@ textual parts.") | |||
| 1137 | (gnus-group-set-parameter info 'modseq highestmodseq) | 1155 | (gnus-group-set-parameter info 'modseq highestmodseq) |
| 1138 | (nnimap-store-info info (gnus-active group))))))) | 1156 | (nnimap-store-info info (gnus-active group))))))) |
| 1139 | 1157 | ||
| 1140 | (defun nnimap-update-qresync-info (info vanished flags) | 1158 | (defun nnimap-update-qresync-info (info existing vanished flags) |
| 1141 | ;; Add all the vanished articles to the list of read articles. | 1159 | ;; Add all the vanished articles to the list of read articles. |
| 1142 | (gnus-info-set-read | 1160 | (gnus-info-set-read |
| 1143 | info | 1161 | info |
| 1144 | (gnus-range-add (gnus-info-read info) | 1162 | (gnus-add-to-range |
| 1145 | vanished)) | 1163 | (gnus-add-to-range |
| 1146 | ) | 1164 | (gnus-range-add (gnus-info-read info) |
| 1165 | vanished) | ||
| 1166 | (cdr (assq '%Flagged flags))) | ||
| 1167 | (cdr (assq '%Seen flags)))) | ||
| 1168 | (let ((marks (gnus-info-marks info))) | ||
| 1169 | (dolist (type (cdr nnimap-mark-alist)) | ||
| 1170 | (let ((ticks (assoc (car type) marks)) | ||
| 1171 | (new-marks | ||
| 1172 | (cdr (or (assoc (caddr type) flags) ; %Flagged | ||
| 1173 | (assoc (intern (cadr type) obarray) flags) | ||
| 1174 | (assoc (cadr type) flags))))) ; "\Flagged" | ||
| 1175 | (setq marks (delq ticks marks)) | ||
| 1176 | (pop ticks) | ||
| 1177 | ;; Add the new marks we got. | ||
| 1178 | (setq ticks (gnus-add-to-range ticks new-marks)) | ||
| 1179 | ;; Remove the marks from messages that don't have them. | ||
| 1180 | (setq ticks (gnus-remove-from-range | ||
| 1181 | ticks | ||
| 1182 | (gnus-compress-sequence | ||
| 1183 | (gnus-sorted-complement existing new-marks)))) | ||
| 1184 | (when ticks | ||
| 1185 | (push (cons (car type) ticks) marks))) | ||
| 1186 | (gnus-info-set-marks info marks t)))) | ||
| 1147 | 1187 | ||
| 1148 | (defun nnimap-imap-ranges-to-gnus-ranges (irange) | 1188 | (defun nnimap-imap-ranges-to-gnus-ranges (irange) |
| 1149 | (if (zerop (length irange)) | 1189 | (if (zerop (length irange)) |
| @@ -1355,20 +1395,28 @@ textual parts.") | |||
| 1355 | (defun nnimap-wait-for-response (sequence &optional messagep) | 1395 | (defun nnimap-wait-for-response (sequence &optional messagep) |
| 1356 | (let ((process (get-buffer-process (current-buffer))) | 1396 | (let ((process (get-buffer-process (current-buffer))) |
| 1357 | openp) | 1397 | openp) |
| 1358 | (goto-char (point-max)) | 1398 | (condition-case nil |
| 1359 | (while (and (setq openp (memq (process-status process) | 1399 | (progn |
| 1360 | '(open run))) | 1400 | (goto-char (point-max)) |
| 1361 | (not (re-search-backward | 1401 | (while (and (setq openp (memq (process-status process) |
| 1362 | (format "^%d .*\n" sequence) | 1402 | '(open run))) |
| 1363 | (if nnimap-streaming | 1403 | (not (re-search-backward |
| 1364 | (max (point-min) (- (point) 500)) | 1404 | (format "^%d .*\n" sequence) |
| 1365 | (point-min)) | 1405 | (if nnimap-streaming |
| 1366 | t))) | 1406 | (max (point-min) (- (point) 500)) |
| 1367 | (when messagep | 1407 | (point-min)) |
| 1368 | (message "nnimap read %dk" (/ (buffer-size) 1000))) | 1408 | t))) |
| 1369 | (nnheader-accept-process-output process) | 1409 | (when messagep |
| 1370 | (goto-char (point-max))) | 1410 | (message "nnimap read %dk" (/ (buffer-size) 1000))) |
| 1371 | openp)) | 1411 | (nnheader-accept-process-output process) |
| 1412 | (goto-char (point-max))) | ||
| 1413 | openp) | ||
| 1414 | (quit | ||
| 1415 | ;; The user hit C-g while we were waiting: kill the process, in case | ||
| 1416 | ;; it's a gnutls-cli process that's stuck (tends to happen a lot behind | ||
| 1417 | ;; NAT routers). | ||
| 1418 | (delete-process process) | ||
| 1419 | nil)))) | ||
| 1372 | 1420 | ||
| 1373 | (defun nnimap-parse-response () | 1421 | (defun nnimap-parse-response () |
| 1374 | (let ((lines (split-string (nnimap-last-response-string) "\r\n" t)) | 1422 | (let ((lines (split-string (nnimap-last-response-string) "\r\n" t)) |
diff --git a/lisp/gnus/nnir.el b/lisp/gnus/nnir.el index 86acad16638..2a264d1fa32 100644 --- a/lisp/gnus/nnir.el +++ b/lisp/gnus/nnir.el | |||
| @@ -339,23 +339,34 @@ | |||
| 339 | (eval-when-compile | 339 | (eval-when-compile |
| 340 | (require 'cl)) | 340 | (require 'cl)) |
| 341 | 341 | ||
| 342 | |||
| 343 | (eval-when-compile | ||
| 344 | (autoload 'nnimap-buffer "nnimap") | ||
| 345 | (autoload 'nnimap-command "nnimap") | ||
| 346 | (autoload 'nnimap-possibly-change-group "nnimap")) | ||
| 347 | |||
| 342 | (nnoo-declare nnir) | 348 | (nnoo-declare nnir) |
| 343 | (nnoo-define-basics nnir) | 349 | (nnoo-define-basics nnir) |
| 344 | 350 | ||
| 345 | (gnus-declare-backend "nnir" 'mail) | 351 | (gnus-declare-backend "nnir" 'mail) |
| 346 | 352 | ||
| 347 | (defvar nnir-imap-search-field "TEXT" | 353 | (defvar nnir-imap-default-search-key "Whole message" |
| 348 | "The IMAP search item when doing an nnir search. To use raw | 354 | "The default IMAP search key for an nnir search. Must be one of |
| 349 | imap queries by default set this to \"\"") | 355 | the keys in nnir-imap-search-arguments. To use raw imap queries |
| 356 | by default set this to \"Imap\"") | ||
| 350 | 357 | ||
| 351 | (defvar nnir-imap-search-arguments | 358 | (defvar nnir-imap-search-arguments |
| 352 | '(("Whole message" . "TEXT") | 359 | '(("Whole message" . "TEXT") |
| 353 | ("Subject" . "SUBJECT") | 360 | ("Subject" . "SUBJECT") |
| 354 | ("To" . "TO") | 361 | ("To" . "TO") |
| 355 | ("From" . "FROM") | 362 | ("From" . "FROM") |
| 356 | ("Head" . "HEADER \"%s\"") | 363 | ("Imap" . "")) |
| 357 | (nil . "")) | 364 | "Mapping from user readable keys to IMAP search items for use in nnir") |
| 358 | "Mapping from user readable strings to IMAP search items for use in nnir") | 365 | |
| 366 | (defvar nnir-imap-search-other "HEADER %S" | ||
| 367 | "The IMAP search item to use for anything other than | ||
| 368 | nnir-imap-search-arguments. By default this is the name of an | ||
| 369 | email header field") | ||
| 359 | 370 | ||
| 360 | (defvar nnir-imap-search-argument-history () | 371 | (defvar nnir-imap-search-argument-history () |
| 361 | "The history for querying search options in nnir") | 372 | "The history for querying search options in nnir") |
| @@ -375,12 +386,12 @@ result, `gnus-retrieve-headers' will be called instead.") | |||
| 375 | ()) | 386 | ()) |
| 376 | (imap nnir-run-imap | 387 | (imap nnir-run-imap |
| 377 | ((criteria | 388 | ((criteria |
| 378 | "Search in: " ; Prompt | 389 | "Search in" ; Prompt |
| 379 | ,(mapcar 'car nnir-imap-search-arguments) ; alist for completing | 390 | ,(mapcar 'car nnir-imap-search-arguments) ; alist for completing |
| 380 | nil ; allow any user input | 391 | nil ; allow any user input |
| 381 | nil ; initial value | 392 | nil ; initial value |
| 382 | nnir-imap-search-argument-history ; the history to use | 393 | nnir-imap-search-argument-history ; the history to use |
| 383 | ,nnir-imap-search-field ; default | 394 | ,nnir-imap-default-search-key ; default |
| 384 | ))) | 395 | ))) |
| 385 | (swish++ nnir-run-swish++ | 396 | (swish++ nnir-run-swish++ |
| 386 | ((group . "Group spec: "))) | 397 | ((group . "Group spec: "))) |
| @@ -702,19 +713,30 @@ and show thread that contains this article." | |||
| 702 | (let* ((cur (gnus-summary-article-number)) | 713 | (let* ((cur (gnus-summary-article-number)) |
| 703 | (group (nnir-artlist-artitem-group nnir-artlist cur)) | 714 | (group (nnir-artlist-artitem-group nnir-artlist cur)) |
| 704 | (backend-number (nnir-artlist-artitem-number nnir-artlist cur)) | 715 | (backend-number (nnir-artlist-artitem-number nnir-artlist cur)) |
| 705 | server backend-group) | 716 | (id (mail-header-id (gnus-summary-article-header))) |
| 706 | (setq server (nnir-group-server group)) | 717 | (refs (split-string |
| 707 | (setq backend-group (gnus-group-real-name group)) | 718 | (mail-header-references (gnus-summary-article-header))))) |
| 708 | (gnus-group-read-ephemeral-group | 719 | (if (string= (car (gnus-group-method group)) "nnimap") |
| 709 | backend-group | 720 | (with-current-buffer (nnimap-buffer) |
| 710 | (gnus-server-to-method server) | 721 | (let* ((cmd (let ((value |
| 711 | t ; activate | 722 | (format |
| 712 | (cons (current-buffer) | 723 | "(OR HEADER REFERENCES %s HEADER Message-Id %s)" |
| 713 | 'summary) ; window config | 724 | id id))) |
| 714 | nil | 725 | (dolist (refid refs value) |
| 715 | (list backend-number)) | 726 | (setq value (format |
| 716 | (gnus-summary-limit (list backend-number)) | 727 | "(OR (OR HEADER Message-Id %s HEADER REFERENCES %s) %s)" |
| 717 | (gnus-summary-refer-thread))) | 728 | refid refid value))))) |
| 729 | (result (nnimap-command | ||
| 730 | "UID SEARCH %s" cmd))) | ||
| 731 | (gnus-summary-read-group-1 group t t gnus-summary-buffer nil | ||
| 732 | (and (car result) | ||
| 733 | (delete 0 (mapcar #'string-to-number | ||
| 734 | (cdr (assoc "SEARCH" (cdr result))))))))) | ||
| 735 | (gnus-summary-read-group-1 group t t gnus-summary-buffer | ||
| 736 | nil (list backend-number)) | ||
| 737 | (gnus-summary-limit (list backend-number)) | ||
| 738 | (gnus-summary-refer-thread)))) | ||
| 739 | |||
| 718 | 740 | ||
| 719 | (if (fboundp 'eval-after-load) | 741 | (if (fboundp 'eval-after-load) |
| 720 | (eval-after-load "gnus-sum" | 742 | (eval-after-load "gnus-sum" |
| @@ -936,22 +958,9 @@ pairs (also vectors, actually)." | |||
| 936 | 958 | ||
| 937 | ;; IMAP interface. | 959 | ;; IMAP interface. |
| 938 | ;; todo: | 960 | ;; todo: |
| 939 | ;; nnir invokes this two (2) times???! | ||
| 940 | ;; we should not use nnimap at all but open our own server connection | ||
| 941 | ;; we should not LIST * but use nnimap-list-pattern from defs | ||
| 942 | ;; send queries as literals | 961 | ;; send queries as literals |
| 943 | ;; handle errors | 962 | ;; handle errors |
| 944 | 963 | ||
| 945 | (autoload 'nnimap-open-server "nnimap") | ||
| 946 | (defvar nnimap-server-buffer) ;; nnimap.el | ||
| 947 | (autoload 'imap-mailbox-select "imap") | ||
| 948 | (autoload 'imap-search "imap") | ||
| 949 | (autoload 'imap-quote-specials "imap") | ||
| 950 | |||
| 951 | (eval-when-compile | ||
| 952 | (autoload 'nnimap-buffer "nnimap") | ||
| 953 | (autoload 'nnimap-command "nnimap") | ||
| 954 | (autoload 'nnimap-possibly-change-group "nnimap")) | ||
| 955 | 964 | ||
| 956 | (defun nnir-run-imap (query srv &optional group-option) | 965 | (defun nnir-run-imap (query srv &optional group-option) |
| 957 | "Run a search against an IMAP back-end server. | 966 | "Run a search against an IMAP back-end server. |
| @@ -963,7 +972,8 @@ details on the language and supported extensions" | |||
| 963 | (group (or group-option (gnus-group-group-name))) | 972 | (group (or group-option (gnus-group-group-name))) |
| 964 | (defs (caddr (gnus-server-to-method srv))) | 973 | (defs (caddr (gnus-server-to-method srv))) |
| 965 | (criteria (or (cdr (assq 'criteria query)) | 974 | (criteria (or (cdr (assq 'criteria query)) |
| 966 | nnir-imap-search-field)) | 975 | (cdr (assoc nnir-imap-default-search-key |
| 976 | nnir-imap-search-arguments)))) | ||
| 967 | (gnus-inhibit-demon t) | 977 | (gnus-inhibit-demon t) |
| 968 | artlist) | 978 | artlist) |
| 969 | (message "Opening server %s" server) | 979 | (message "Opening server %s" server) |
| @@ -1044,7 +1054,7 @@ In future the following will be added to the language: | |||
| 1044 | (cond | 1054 | (cond |
| 1045 | ;; Simple string term | 1055 | ;; Simple string term |
| 1046 | ((stringp expr) | 1056 | ((stringp expr) |
| 1047 | (format "%s \"%s\"" criteria (imap-quote-specials expr))) | 1057 | (format "%s %S" criteria expr)) |
| 1048 | ;; Trivial term: and | 1058 | ;; Trivial term: and |
| 1049 | ((eq expr 'and) nil) | 1059 | ((eq expr 'and) nil) |
| 1050 | ;; Composite term: or expression | 1060 | ;; Composite term: or expression |
| @@ -1580,7 +1590,7 @@ Tested with Namazu 2.0.6 on a GNU/Linux system." | |||
| 1580 | (if (listp prompt) | 1590 | (if (listp prompt) |
| 1581 | (let* ((result (apply 'gnus-completing-read prompt)) | 1591 | (let* ((result (apply 'gnus-completing-read prompt)) |
| 1582 | (mapping (or (assoc result nnir-imap-search-arguments) | 1592 | (mapping (or (assoc result nnir-imap-search-arguments) |
| 1583 | (assoc nil nnir-imap-search-arguments)))) | 1593 | (cons nil nnir-imap-search-other)))) |
| 1584 | (cons sym (format (cdr mapping) result))) | 1594 | (cons sym (format (cdr mapping) result))) |
| 1585 | (cons sym (read-string prompt))))) | 1595 | (cons sym (read-string prompt))))) |
| 1586 | 1596 | ||