1 |
;;; rfc2231.el --- Functions for decoding rfc2231 headers |
;;; rfc2231.el --- Functions for decoding rfc2231 headers |
2 |
|
|
3 |
;; Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004 |
;; Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004, 2005 |
4 |
;; Free Software Foundation, Inc. |
;; Free Software Foundation, Inc. |
5 |
|
|
6 |
;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org> |
;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org> |
52 |
(prev-value "") |
(prev-value "") |
53 |
display-name mailbox c display-string parameters |
display-name mailbox c display-string parameters |
54 |
attribute value type subtype number encoded |
attribute value type subtype number encoded |
55 |
prev-attribute) |
prev-attribute prev-encoded) |
56 |
(ietf-drums-init (mail-header-remove-whitespace |
(ietf-drums-init (mail-header-remove-whitespace |
57 |
(mail-header-remove-comments string))) |
(mail-header-remove-comments string))) |
58 |
(let ((table (copy-syntax-table ietf-drums-syntax-table))) |
(let ((table (copy-syntax-table ietf-drums-syntax-table))) |
106 |
;; See if we have any previous continuations. |
;; See if we have any previous continuations. |
107 |
(when (and prev-attribute |
(when (and prev-attribute |
108 |
(not (eq prev-attribute attribute))) |
(not (eq prev-attribute attribute))) |
109 |
(push (cons prev-attribute prev-value) parameters) |
(push (cons prev-attribute |
110 |
|
(if prev-encoded |
111 |
|
(rfc2231-decode-encoded-string prev-value) |
112 |
|
prev-value)) |
113 |
|
parameters) |
114 |
(setq prev-attribute nil |
(setq prev-attribute nil |
115 |
prev-value "")) |
prev-value "" |
116 |
|
prev-encoded nil)) |
117 |
(unless (eq c ?=) |
(unless (eq c ?=) |
118 |
(error "Invalid header: %s" string)) |
(error "Invalid header: %s" string)) |
119 |
(forward-char 1) |
(forward-char 1) |
132 |
(error "Invalid header: %s" string))) |
(error "Invalid header: %s" string))) |
133 |
(if number |
(if number |
134 |
(setq prev-attribute attribute |
(setq prev-attribute attribute |
135 |
prev-value (concat prev-value value)) |
prev-value (concat prev-value value) |
136 |
|
prev-encoded encoded) |
137 |
(push (cons attribute |
(push (cons attribute |
138 |
(if encoded |
(if encoded |
139 |
(rfc2231-decode-encoded-string value) |
(rfc2231-decode-encoded-string value) |
143 |
;; Take care of any final continuations. |
;; Take care of any final continuations. |
144 |
(when prev-attribute |
(when prev-attribute |
145 |
(push (cons prev-attribute |
(push (cons prev-attribute |
146 |
(if encoded |
(if prev-encoded |
147 |
(rfc2231-decode-encoded-string prev-value) |
(rfc2231-decode-encoded-string prev-value) |
148 |
prev-value)) |
prev-value)) |
149 |
parameters)) |
parameters)) |