(spam-necessary-extra-headers): make
[gnus] / lisp / rfc1843.el
1 ;;; rfc1843.el --- HZ (rfc1843) decoding
2
3 ;; Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4 ;;   2005, 2006 Free Software Foundation, Inc.
5
6 ;; Author: Shenghuo Zhu <zsh@cs.rochester.edu>
7 ;; Keywords: news HZ HZ+ mail i18n
8
9 ;; This file is part of GNU Emacs.
10
11 ;; GNU Emacs is free software; you can redistribute it and/or modify
12 ;; it under the terms of the GNU General Public License as published
13 ;; by the Free Software Foundation; either version 2, or (at your
14 ;; option) any later version.
15
16 ;; GNU Emacs is distributed in the hope that it will be useful, but
17 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19 ;; General Public License for more details.
20
21 ;; You should have received a copy of the GNU General Public License
22 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
23 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24 ;; Boston, MA 02110-1301, USA.
25
26 ;;; Commentary:
27
28 ;; Usage:
29 ;; (require 'rfc1843)
30 ;; (rfc1843-gnus-setup)
31 ;;
32 ;; Test:
33 ;; (rfc1843-decode-string  "~{<:Ky2;S{#,NpJ)l6HK!#~}")
34
35 ;;; Code:
36
37 (eval-when-compile (require 'cl))
38 (require 'mm-util)
39
40 (defvar gnus-decode-encoded-word-function)
41 (defvar gnus-decode-header-function)
42 (defvar gnus-newsgroup-name)
43
44 (defvar rfc1843-word-regexp
45   "~\\({\\([\041-\167][\041-\176]\\| \\)+\\)\\(~}\\|$\\)")
46
47 (defvar rfc1843-word-regexp-strictly
48   "~\\({\\([\041-\167][\041-\176]\\)+\\)\\(~}\\|$\\)")
49
50 (defvar rfc1843-hzp-word-regexp
51   "~\\({\\([\041-\167][\041-\176]\\| \\)+\\|\
52 \[<>]\\([\041-\175][\041-\176]\\| \\)+\\)\\(~}\\|$\\)")
53
54 (defvar rfc1843-hzp-word-regexp-strictly
55   "~\\({\\([\041-\167][\041-\176]\\)+\\|\
56 \[<>]\\([\041-\175][\041-\176]\\)+\\)\\(~}\\|$\\)")
57
58 (defcustom rfc1843-decode-loosely nil
59   "Loosely check HZ encoding if non-nil.
60 When it is set non-nil, only buffers or strings with strictly
61 HZ-encoded are decoded."
62   :type 'boolean