• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.10.1/emacs-93/emacs/lisp/gnus/

Lines Matching +defs:gnus +defs:request +defs:expire +defs:articles

0 ;;; gnus-int.el --- backend interface functions for Gnus
6 ;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
32 (require 'gnus)
34 (require 'gnus-range)
36 (autoload 'gnus-agent-expire "gnus-agent")
37 (autoload 'gnus-agent-regenerate-group "gnus-agent")
38 (autoload 'gnus-agent-read-servers-validate-native "gnus-agent")
40 (defcustom gnus-open-server-hook nil
42 :group 'gnus-start
45 (defcustom gnus-server-unopen-status nil
52 :group 'gnus-start
57 (defvar gnus-internal-registry-spool-current-method nil
64 (defun gnus-start-news-server (&optional confirm)
68 (if gnus-current-select-method
72 (unless gnus-nntp-service
73 (setq gnus-nntp-server nil))
76 (setq gnus-nntp-server
79 (cons (list gnus-nntp-server)
80 gnus-secondary-servers))
81 nil nil gnus-nntp-server)))
83 (when (and gnus-nntp-server
84 (stringp gnus-nntp-server)
85 (not (string= gnus-nntp-server "")))
86 (setq gnus-select-method
87 (cond ((or (string= gnus-nntp-server "")
88 (string= gnus-nntp-server "::"))
90 ((string-match "^:" gnus-nntp-server)
91 (list 'nnmh gnus-nntp-server
95 (substring gnus-nntp-server 1) "~/")))
98 (list 'nntp gnus-nntp-server)))))
100 (setq how (car gnus-select-method))
104 (gnus-message 5 "Looking up local news spool..."))
107 (gnus-message 5 "Looking up mh spool..."))
110 (setq gnus-current-select-method gnus-select-method)
111 (gnus-run-hooks 'gnus-open-server-hook)
114 ;; gnus-select-method is known.
116 (if gnus-agent
120 ;; the agent code within gnus-open-server to function
122 (gnus-agent-read-servers-validate-native gnus-select-method))
125 ;; gnus-open-server-hook might have opened it
126 (gnus-server-opened gnus-select-method)
127 (gnus-open-server gnus-select-method)
128 gnus-batch-mode
129 (gnus-y-or-n-p
132 (car gnus-select-method) (cadr gnus-select-method)
133 (gnus-status-message gnus-select-method)))
134 (gnus-error 1 "Couldn't open server on %s"
135 (nth 1 gnus-select-method))))))
137 (defun gnus-check-group (group)
139 (let ((method (gnus-find-method-for-group group)))
140 (or (gnus-server-opened method)
141 (gnus-open-server method))))
143 (defun gnus-check-server (&optional method silent)
145 If METHOD is nil, use `gnus-select-method'.
147 (let ((method (or method gnus-select-method))
151 (setq method (gnus-server-to-method method)))
152 (if (gnus-server-opened method)
157 (gnus-message 5 "Opening %s server%s..." (car method)
160 (gnus-run-hooks 'gnus-open-server-hook)
163 (setq result (gnus-open-server method))
164 (quit (message "Quit gnus-check-server")
167 (gnus-message 5 "Opening %s server%s...%s" (car method)
172 (defun gnus-get-function (method function &optional noerror)
178 (setq method (gnus-server-to-method method)))
180 (let* ((method-sym (if gnus-agent
181 (inline (gnus-agent-get-function method))
183 (method-fns (get method-sym 'gnus-method-functions))
189 (put method-sym 'gnus-method-functions
209 (defun gnus-open-server (gnus-command-method)
211 (when (stringp gnus-command-method)
212 (setq gnus-command-method (gnus-server-to-method gnus-command-method)))
213 (let ((elem (assoc gnus-command-method gnus-opened-servers)))
217 (gnus-message 1 "Denied server")
220 (let* ((open-server-function (gnus-get-function gnus-command-method 'open-server))
224 (nth 1 gnus-command-method)
225 (nthcdr 2 gnus-command-method))
227 (gnus-message 1 (format
232 (gnus-message 1 "Quit trying to open server")
237 (setq elem (list gnus-command-method nil)
238 gnus-opened-servers (cons elem gnus-opened-servers)))
246 ((and gnus-agent
247 (gnus-agent-method-p gnus-command-method))
248 (cond (gnus-server-unopen-status
252 (setq open-offline (eq gnus-server-unopen-status 'offline))
253 gnus-server-unopen-status)
255 (not gnus-batch-mode)
256 (gnus-y-or-n-p
258 (car gnus-command-method)
259 (cadr gnus-command-method))))
271 ;; gnus-get-function (called above) to return the agent's
276 (let ((gnus-server-unopen-status 'denied))
277 ;; Bind gnus-server-unopen-status to avoid recursively
280 (gnus-open-server gnus-command-method))
283 (defun gnus-close-server (gnus-command-method)
285 (when (stringp gnus-command-method)
286 (setq gnus-command-method (gnus-server-to-method gnus-command-method)))
287 (funcall (gnus-get-function gnus-command-method 'close-server)
288 (nth 1 gnus-command-method)))
290 (defun gnus-request-list (gnus-command-method)
292 (when (stringp gnus-command-method)
293 (setq gnus-command-method (gnus-server-to-method gnus-command-method)))
294 (funcall (gnus-get-function gnus-command-method 'request-list)
295 (nth 1 gnus-command-method)))
297 (defun gnus-request-list-newsgroups (gnus-command-method)
299 (when (stringp gnus-command-method)
300 (setq gnus-command-method (gnus-server-to-method gnus-command-method)))
301 (funcall (gnus-get-function gnus-command-method 'request-list-newsgroups)
302 (nth 1 gnus-command-method)))
304 (defun gnus-request-newgroups (date gnus-command-method)
306 (when (stringp gnus-command-method)
307 (setq gnus-command-method (gnus-server-to-method gnus-command-method)))
308 (let ((func (gnus-get-function gnus-command-method 'request-newgroups t)))
310 (funcall func date (nth 1 gnus-command-method)))))
312 (defun gnus-server-opened (gnus-command-method)
314 (unless (eq (gnus-server-status gnus-command-method)
316 (when (stringp gnus-command-method)
317 (setq gnus-command-method (gnus-server-to-method gnus-command-method)))
318 (funcall (inline (gnus-get-function gnus-command-method 'server-opened))
319 (nth 1 gnus-command-method))))
321 (defun gnus-status-message (gnus-command-method)
325 (let ((gnus-command-method
326 (if (stringp gnus-command-method)
327 (gnus-find-method-for-group gnus-command-method)
328 gnus-command-method)))
329 (funcall (gnus-get-function gnus-command-method 'status-message)
330 (nth 1 gnus-command-method))))
332 (defun gnus-request-regenerate (gnus-command-method)
334 (when (stringp gnus-command-method)
335 (setq gnus-command-method (gnus-server-to-method gnus-command-method)))
336 (funcall (gnus-get-function gnus-command-method 'request-regenerate)
337 (nth 1 gnus-command-method)))
339 (defun gnus-request-group (group &optional dont-check gnus-command-method)
341 (let ((gnus-command-method
342 (or gnus-command-method (inline (gnus-find-method-for-group group)))))
343 (when (stringp gnus-command-method)
344 (setq gnus-command-method
345 (inline (gnus-server-to-method gnus-command-method))))
346 (funcall (inline (gnus-get-function gnus-command-method 'request-group))
347 (gnus-group-real-name group) (nth 1 gnus-command-method)
350 (defun gnus-list-active-group (group)
352 (let ((gnus-command-method (gnus-find-method-for-group group))
354 (when (gnus-check-backend-function func group)
355 (funcall (gnus-get-function gnus-command-method func)
356 (gnus-group-real-name group) (nth 1 gnus-command-method)))))
358 (defun gnus-request-group-description (group)
360 (let ((gnus-command-method (gnus-find-method-for-group group))
361 (func 'request-group-description))
362 (when (gnus-check-backend-function func group)
363 (funcall (gnus-get-function gnus-command-method func)
364 (gnus-group-real-name group) (nth 1 gnus-command-method)))))
366 (defun gnus-request-group-articles (group)
367 "Request a list of existing articles in GROUP."
368 (let ((gnus-command-method (gnus-find-method-for-group group))
369 (func 'request-group-articles))
370 (when (gnus-check-backend-function func group)
371 (funcall (gnus-get-function gnus-command-method func)
372 (gnus-group-real-name group) (nth 1 gnus-command-method)))))
374 (defun gnus-close-group (group)
376 (let ((gnus-command-method (inline (gnus-find-method-for-group group))))
377 (funcall (gnus-get-function gnus-command-method 'close-group)
378 (gnus-group-real-name group) (nth 1 gnus-command-method))))
380 (defun gnus-retrieve-headers (articles group &optional fetch-old)
383 (let ((gnus-command-method (gnus-find-method-for-group group)))
385 ((and gnus-use-cache (numberp (car articles)))
386 (gnus-cache-retrieve-headers articles group fetch-old))
387 ((and gnus-agent (gnus-online gnus-command-method)
388 (gnus-agent-method-p gnus-command-method))
389 (gnus-agent-retrieve-headers articles group fetch-old))
391 (funcall (gnus-get-function gnus-command-method 'retrieve-headers)
392 articles (gnus-group-real-name group)
393 (nth 1 gnus-command-method) fetch-old)))))
395 (defun gnus-retrieve-articles (articles group)
397 (let ((gnus-command-method (gnus-find-method-for-group group)))
398 (funcall (gnus-get-function gnus-command-method 'retrieve-articles)
399 articles (gnus-group-real-name group)
400 (nth 1 gnus-command-method))))
402 (defun gnus-retrieve-groups (groups gnus-command-method)
404 (when (stringp gnus-command-method)
405 (setq gnus-command-method (gnus-server-to-method gnus-command-method)))
406 (funcall (gnus-get-function gnus-command-method 'retrieve-groups)
407 groups (nth 1 gnus-command-method)))
409 (defun gnus-request-type (group &optional article)
411 (let ((gnus-command-method (gnus-find-method-for-group group)))
412 (if (not (gnus-check-backend-function
413 'request-type (car gnus-command-method)))
415 (funcall (gnus-get-function gnus-command-method 'request-type)
416 (gnus-group-real-name group) article))))
418 (defun gnus-request-set-mark (group action)
419 "Set marks on articles in the back end."
420 (let ((gnus-command-method (gnus-find-method-for-group group)))
421 (if (not (gnus-check-backend-function
422 'request-set-mark (car gnus-command-method)))
424 (funcall (gnus-get-function gnus-command-method 'request-set-mark)
425 (gnus-group-real-name group) action
426 (nth 1 gnus-command-method)))))
428 (defun gnus-request-update-mark (group article mark)
430 (let ((gnus-command-method (gnus-find-method-for-group group)))
431 (if (not (gnus-check-backend-function
432 'request-update-mark (car gnus-command-method)))
434 (funcall (gnus-get-function gnus-command-method 'request-update-mark)
435 (gnus-group-real-name group) article mark))))
437 (defun gnus-request-article (article group &optional buffer)
441 (let ((gnus-command-method (gnus-find-method-for-group group)))
442 (funcall (gnus-get-function gnus-command-method 'request-article)
443 article (gnus-group-real-name group)
444 (nth 1 gnus-command-method) buffer)))
446 (defun gnus-request-head (article group)
448 (let* ((gnus-command-method (gnus-find-method-for-group group))
449 (head (gnus-get-function gnus-command-method 'request-head t))
453 ((and gnus-use-cache
455 (gnus-cache-request-article article group))
459 ((gnus-agent-request-article article group)
464 (setq res (funcall head article (gnus-group-real-name group)
465 (nth 1 gnus-command-method))))
468 (setq res (gnus-request-article article group)
479 (defun gnus-request-body (article group)
481 (let* ((gnus-command-method (gnus-find-method-for-group group))
482 (head (gnus-get-function gnus-command-method 'request-body t))
486 ((and gnus-use-cache
488 (gnus-cache-request-article article group))
492 ((gnus-agent-request-article article group)
497 (setq res (funcall head article (gnus-group-real-name group)
498 (nth 1 gnus-command-method))))
501 (setq res (gnus-request-article article group)
511 (defun gnus-request-post (gnus-command-method)
513 (when (stringp gnus-command-method)
514 (setq gnus-command-method (gnus-server-to-method gnus-command-method)))
515 (funcall (gnus-get-function gnus-command-method 'request-post)
516 (nth 1 gnus-command-method)))
518 (defun gnus-request-scan (group gnus-command-method)
521 (let ((gnus-command-method
522 (if group (gnus-find-method-for-group group) gnus-command-method))
523 (gnus-inhibit-demon t)
524 (mail-source-plugged gnus-plugged))
525 (if (or gnus-plugged (not (gnus-agent-method-p gnus-command-method)))
527 (setq gnus-internal-registry-spool-current-method gnus-command-method)
528 (funcall (gnus-get-function gnus-command-method 'request-scan)
529 (and group (gnus-group-real-name group))
530 (nth 1 gnus-command-method))))))
532 (defsubst gnus-request-update-info (info gnus-command-method)
534 (when (stringp gnus-command-method)
535 (setq gnus-command-method (gnus-server-to-method gnus-command-method)))
536 (when (gnus-check-backend-function
537 'request-update-info (car gnus-command-method))
538 (let ((group (gnus-info-group info)))
539 (and (funcall (gnus-get-function gnus-command-method
540 'request-update-info)
541 (gnus-group-real-name group)
542 info (nth 1 gnus-command-method))
546 (let* ((active (gnus-active group))
550 (read (gnus-info-read info))
551 (new-read (gnus-range-add read (list range))))
552 (gnus-info-set-read info new-read)))
555 (defun gnus-request-expire-articles (articles group &optional force)
556 (let* ((gnus-command-method (gnus-find-method-for-group group))
559 (gnus-get-function gnus-command-method 'request-expire-articles)
560 articles (gnus-group-real-name group) (nth 1 gnus-command-method)
562 (when (and gnus-agent
563 (gnus-agent-method-p gnus-command-method))
564 (let ((expired-articles (gnus-sorted-difference articles not-deleted)))
565 (when expired-articles
566 (gnus-agent-expire expired-articles group 'force))))
569 (defun gnus-request-move-article (article group server accept-function
571 (let* ((gnus-command-method (gnus-find-method-for-group group))
572 (result (funcall (gnus-get-function gnus-command-method
573 'request-move-article)
574 article (gnus-group-real-name group)
575 (nth 1 gnus-command-method) accept-function last)))
576 (when (and result gnus-agent
577 (gnus-agent-method-p gnus-command-method))
578 (gnus-agent-unfetch-articles group (list article)))
581 (defun gnus-request-accept-article (group &optional gnus-command-method last
584 (when (stringp gnus-command-method)
585 (setq gnus-command-method (gnus-server-to-method gnus-command-method)))
586 (when (and (not gnus-command-method)
588 (setq gnus-command-method (or (gnus-find-method-for-group group)
589 (gnus-group-name-to-method group))))
601 (let ((gnus-command-method (or gnus-command-method
602 (gnus-find-method-for-group group)))
605 (gnus-get-function gnus-command-method 'request-accept-article)
606 (if (stringp group) (gnus-group-real-name group) group)
607 (cadr gnus-command-method)
609 (when (and gnus-agent (gnus-agent-method-p gnus-command-method))
610 (gnus-agent-regenerate-group group (list (cdr result))))
613 (defun gnus-request-replace-article (article group buffer &optional no-encode)
622 (let* ((func (car (gnus-group-name-to-method group)))
623 (result (funcall (intern (format "%s-request-replace-article" func))
624 article (gnus-group-real-name group) buffer)))
625 (when (and gnus-agent (gnus-agent-method-p gnus-command-method))
626 (gnus-agent-regenerate-group group (list article)))
629 (defun gnus-request-associate-buffer (group)
630 (let ((gnus-command-method (gnus-find-method-for-group group)))
631 (funcall (gnus-get-function gnus-command-method 'request-associate-buffer)
632 (gnus-group-real-name group))))
634 (defun gnus-request-restore-buffer (article group)
636 (let ((gnus-command-method (gnus-find-method-for-group group)))
637 (funcall (gnus-get-function gnus-command-method 'request-restore-buffer)
638 article (gnus-group-real-name group)
639 (nth 1 gnus-command-method))))
641 (defun gnus-request-create-group (group &optional gnus-command-method args)
642 (when (stringp gnus-command-method)
643 (setq gnus-command-method (gnus-server-to-method gnus-command-method)))
644 (let ((gnus-command-method
645 (or gnus-command-method (gnus-find-method-for-group group))))
646 (funcall (gnus-get-function gnus-command-method 'request-create-group)
647 (gnus-group-real-name group) (nth 1 gnus-command-method) args)))
649 (defun gnus-request-delete-group (group &optional force)
650 (let* ((gnus-command-method (gnus-find-method-for-group group))
652 (funcall (gnus-get-function gnus-command-method 'request-delete-group)
653 (gnus-group-real-name group) force (nth 1 gnus-command-method))))
655 (gnus-cache-delete-group group)
656 (gnus-agent-delete-group group))
659 (defun gnus-request-rename-group (group new-name)
660 (let* ((gnus-command-method (gnus-find-method-for-group group))
662 (funcall (gnus-get-function gnus-command-method 'request-rename-group)
663 (gnus-group-real-name group)
664 (gnus-group-real-name new-name) (nth 1 gnus-command-method))))
666 (gnus-cache-rename-group group new-name)
667 (gnus-agent-rename-group group new-name))
670 (defun gnus-close-backends ()
671 ;; Send a close request to all backends that support such a request.
672 (let ((methods gnus-valid-select-methods)
673 (gnus-inhibit-demon t)
674 func gnus-command-method)
675 (while (setq gnus-command-method (pop methods))
677 (concat (car gnus-command-method)
678 "-request-close"))))
681 (defun gnus-asynchronous-p (gnus-command-method)
682 (let ((func (gnus-get-function gnus-command-method 'asynchronous-p t)))
686 (defun gnus-remove-denial (gnus-command-method)
687 (when (stringp gnus-command-method)
688 (setq gnus-command-method (gnus-server-to-method gnus-command-method)))
689 (let* ((elem (assoc gnus-command-method gnus-opened-servers))
696 (provide 'gnus-int)
699 ;;; gnus-int.el ends here