1 ;;; nnheader.el --- header access macros for Gnus and its backends
2 ;; Copyright (C) 1987,88,89,90,93,94,95,96 Free Software Foundation, Inc.
4 ;; Author: Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
5 ;; Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
8 ;; This file is part of GNU Emacs.
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
11 ;; it under the terms of the GNU General Public License as published by
12 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; GNU Emacs is distributed in the hope that it will be useful,
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;; GNU General Public License for more details.
20 ;; You should have received a copy of the GNU General Public License
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 ;; Boston, MA 02111-1307, USA.
27 ;; These macros may look very much like the ones in GNUS 4.1. They
28 ;; are, in a way, but you should note that the indices they use have
29 ;; been changed from the internal GNUS format to the NOV format. The
30 ;; makes it possible to read headers from XOVER much faster.
32 ;; The format of a header is now:
33 ;; [number subject from date id references chars lines xref]
35 ;; (That last entry is defined as "misc" in the NOV format, but Gnus
36 ;; uses it for xrefs.)
42 (defvar nnheader-max-head-length 4096
43 "*Max length of the head of articles.")
45 (defvar nnheader-head-chop-length 2048
46 "*Length of each read operation when trying to fetch HEAD headers.")
48 (defvar nnheader-file-name-translation-alist nil
49 "*Alist that says how to translate characters in file names.
50 For instance, if \":\" is illegal as a file character in file names
51 on your system, you could say something like:
53 \(setq nnheader-file-name-translation-alist '((?: . ?_)))")
56 (autoload 'nnmail-message-id "nnmail")
57 (autoload 'mail-position-on-field "sendmail")
58 (autoload 'message-remove-header "message")
59 (autoload 'cancel-function-timers "timers"))
61 ;;; Header access macros.
63 (defmacro mail-header-number (header)
64 "Return article number in HEADER."
67 (defmacro mail-header-set-number (header number)
68 "Set article number of HEADER to NUMBER."
69 `(aset ,header 0 ,number))
71 (defmacro mail-header-subject (header)
72 "Return subject string in HEADER."
75 (defmacro mail-header-set-subject (header subject)
76 "Set article subject of HEADER to SUBJECT."
77 `(aset ,header 1 ,subject))
79 (defmacro mail-header-from (header)
80 "Return author string in HEADER."
83 (defmacro mail-header-set-from (header from)
84 "Set article author of HEADER to FROM."
85 `(aset ,header 2 ,from))
87 (defmacro mail-header-date (header)
88 "Return date in HEADER."
91 (defmacro mail-header-set-date (header date)
92 "Set article date of HEADER to DATE."
93 `(aset ,header 3 ,date))
95 (defalias 'mail-header-message-id 'mail-header-id)
96 (defmacro mail-header-id (header)
97 "Return Id in HEADER."
100 (defalias 'mail-header-set-message-id 'mail-header-set-id)
101 (defmacro mail-header-set-id (header id)
102 "Set article Id of HEADER to ID."
103 `(aset ,header 4 ,id))
105 (defmacro mail-header-references (header)
106 "Return references in HEADER."
109 (defmacro mail-header-set-references (header ref)
110 "Set article references of HEADER to REF."
111 `(aset ,header 5 ,ref))
113 (defmacro mail-header-chars (header)
114 "Return number of chars of article in HEADER."
117 (defmacro mail-header-set-chars (header chars)
118 "Set number of chars in article of HEADER to CHARS."
119 `(aset ,header 6 ,chars))
121 (defmacro mail-header-lines (header)
122 "Return lines in HEADER."
125 (defmacro mail-header-set-lines (header lines)
126 "Set article lines of HEADER to LINES."
127 `(aset ,header 7 ,lines))
129 (defmacro mail-header-xref (header)
130 "Return xref string in HEADER."