nnregistry.el 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. ;;; nnregistry.el --- access to articles via Gnus' message-id registry
  2. ;;; -*- coding: utf-8 -*-
  3. ;; Copyright (C) 2010-2012 Free Software Foundation, Inc.
  4. ;; Authors: Ludovic Courtès <ludo@gnu.org>
  5. ;; Keywords: news, mail
  6. ;; This file is part of GNU Emacs.
  7. ;; GNU Emacs is free software: you can redistribute it and/or modify
  8. ;; it under the terms of the GNU General Public License as published by
  9. ;; the Free Software Foundation, either version 3 of the License, or
  10. ;; (at your option) any later version.
  11. ;; GNU Emacs is distributed in the hope that it will be useful,
  12. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. ;; GNU General Public License for more details.
  15. ;; You should have received a copy of the GNU General Public License
  16. ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
  17. ;;; Commentary:
  18. ;; This file provides the `nnregistry' Gnus back-end. It can be used
  19. ;; in `gnus-refer-article-method' to quickly search for a message by
  20. ;; id, regardless of the back-end that stores it. See the Gnus manual
  21. ;; for usage examples and more information.
  22. ;;; Code:
  23. (require 'nnoo)
  24. (require 'gnus-registry)
  25. (require 'gnus-int)
  26. (nnoo-declare nnregistry)
  27. (deffoo nnregistry-server-opened (server)
  28. gnus-registry-enabled)
  29. (deffoo nnregistry-close-server (server)
  30. t)
  31. (deffoo nnregistry-status-message (server)
  32. nil)
  33. (deffoo nnregistry-open-server (server &optional defs)
  34. gnus-registry-enabled)
  35. (defvar nnregistry-within-nnregistry nil)
  36. (deffoo nnregistry-request-article (id &optional group server buffer)
  37. (and (not nnregistry-within-nnregistry)
  38. (let* ((nnregistry-within-nnregistry t)
  39. (group (nth 0 (gnus-registry-get-id-key id 'group)))
  40. (gnus-override-method nil))
  41. (message "nnregistry: requesting article `%s' in group `%s'"
  42. id group)
  43. (and group
  44. (gnus-check-group group)
  45. (gnus-request-article id group buffer)))))
  46. (provide 'nnregistry)
  47. ;;; nnregistry.el ends here