diff options
| author | Dave Love | 2000-11-10 11:56:06 +0000 |
|---|---|---|
| committer | Dave Love | 2000-11-10 11:56:06 +0000 |
| commit | daaeed873e1daa736155e5845f35b2fcc478cf99 (patch) | |
| tree | f3798067be3129c30496d8d66e70a1ccebf5f795 | |
| parent | d7fa3319f5bf4c6e23ffc45c2d4385698773a080 (diff) | |
| download | emacs-daaeed873e1daa736155e5845f35b2fcc478cf99.tar.gz emacs-daaeed873e1daa736155e5845f35b2fcc478cf99.zip | |
2000-11-10 Dave Love <fx@gnu.org>
* pop3.el (pop3-version): Deleted.
(pop3-make-date): New function, avoiding message-make-date.
(pop3-munge-message-separator): Use it.
2000-11-10 ShengHuo ZHU <zsh@cs.rochester.edu>
* pop3.el (pop3-munge-message-separator): A message may have an
empty body.
| -rw-r--r-- | lisp/gnus/pop3.el | 62 |
1 files changed, 43 insertions, 19 deletions
diff --git a/lisp/gnus/pop3.el b/lisp/gnus/pop3.el index 02630b5ed87..9fb20725b96 100644 --- a/lisp/gnus/pop3.el +++ b/lisp/gnus/pop3.el | |||
| @@ -6,7 +6,6 @@ | |||
| 6 | ;; Author: Richard L. Pieri <ratinox@peorth.gweep.net> | 6 | ;; Author: Richard L. Pieri <ratinox@peorth.gweep.net> |
| 7 | ;; Maintainer: FSF | 7 | ;; Maintainer: FSF |
| 8 | ;; Keywords: mail | 8 | ;; Keywords: mail |
| 9 | ;; Version: 1.3s | ||
| 10 | 9 | ||
| 11 | ;; This file is part of GNU Emacs. | 10 | ;; This file is part of GNU Emacs. |
| 12 | 11 | ||
| @@ -38,8 +37,6 @@ | |||
| 38 | 37 | ||
| 39 | (require 'mail-utils) | 38 | (require 'mail-utils) |
| 40 | 39 | ||
| 41 | (defconst pop3-version "1.3s") | ||
| 42 | |||
| 43 | (defvar pop3-maildrop (or (user-login-name) (getenv "LOGNAME") (getenv "USER") nil) | 40 | (defvar pop3-maildrop (or (user-login-name) (getenv "LOGNAME") (getenv "USER") nil) |
| 44 | "*POP3 maildrop.") | 41 | "*POP3 maildrop.") |
| 45 | (defvar pop3-mailhost (or (getenv "MAILHOST") nil) | 42 | (defvar pop3-mailhost (or (getenv "MAILHOST") nil) |
| @@ -195,9 +192,31 @@ Return the response string if optional second argument is non-nil." | |||
| 195 | (forward-char))) | 192 | (forward-char))) |
| 196 | (set-marker end nil)) | 193 | (set-marker end nil)) |
| 197 | 194 | ||
| 195 | (eval-when-compile (defvar parse-time-months)) | ||
| 196 | |||
| 197 | ;; Copied from message-make-date. | ||
| 198 | (defun pop3-make-date (&optional now) | ||
| 199 | "Make a valid date header. | ||
| 200 | If NOW, use that time instead." | ||
| 201 | (require 'parse-time) | ||
| 202 | (let* ((now (or now (current-time))) | ||
| 203 | (zone (nth 8 (decode-time now))) | ||
| 204 | (sign "+")) | ||
| 205 | (when (< zone 0) | ||
| 206 | (setq sign "-") | ||
| 207 | (setq zone (- zone))) | ||
| 208 | (concat | ||
| 209 | (format-time-string "%d" now) | ||
| 210 | ;; The month name of the %b spec is locale-specific. Pfff. | ||
| 211 | (format " %s " | ||
| 212 | (capitalize (car (rassoc (nth 4 (decode-time now)) | ||
| 213 | parse-time-months)))) | ||
| 214 | (format-time-string "%Y %H:%M:%S " now) | ||
| 215 | ;; We do all of this because XEmacs doesn't have the %z spec. | ||
| 216 | (format "%s%02d%02d" sign (/ zone 3600) (/ (% zone 3600) 60))))) | ||
| 217 | |||
| 198 | (defun pop3-munge-message-separator (start end) | 218 | (defun pop3-munge-message-separator (start end) |
| 199 | "Check to see if a message separator exists. If not, generate one." | 219 | "Check to see if a message separator exists. If not, generate one." |
| 200 | (if (not (fboundp 'message-make-date)) (autoload 'message-make-date "message")) | ||
| 201 | (save-excursion | 220 | (save-excursion |
| 202 | (save-restriction | 221 | (save-restriction |
| 203 | (narrow-to-region start end) | 222 | (narrow-to-region start end) |
| @@ -208,7 +227,7 @@ Return the response string if optional second argument is non-nil." | |||
| 208 | )) | 227 | )) |
| 209 | (let ((from (mail-strip-quoted-names (mail-fetch-field "From"))) | 228 | (let ((from (mail-strip-quoted-names (mail-fetch-field "From"))) |
| 210 | (date (split-string (or (mail-fetch-field "Date") | 229 | (date (split-string (or (mail-fetch-field "Date") |
| 211 | (message-make-date)) | 230 | (pop3-make-date)) |
| 212 | " ")) | 231 | " ")) |
| 213 | (From_)) | 232 | (From_)) |
| 214 | ;; sample date formats I have seen | 233 | ;; sample date formats I have seen |
| @@ -234,7 +253,10 @@ Return the response string if optional second argument is non-nil." | |||
| 234 | (substring From_ (match-end 0))))) | 253 | (substring From_ (match-end 0))))) |
| 235 | (goto-char (point-min)) | 254 | (goto-char (point-min)) |
| 236 | (insert From_) | 255 | (insert From_) |
| 237 | (re-search-forward "\n\n") | 256 | (if (search-forward "\n\n" nil t) |
| 257 | nil | ||
| 258 | (goto-char (point-max)) | ||
| 259 | (insert "\n")) | ||
| 238 | (narrow-to-region (point) (point-max)) | 260 | (narrow-to-region (point) (point-max)) |
| 239 | (let ((size (- (point-max) (point-min)))) | 261 | (let ((size (- (point-max) (point-min)))) |
| 240 | (goto-char (point-min)) | 262 | (goto-char (point-min)) |
| @@ -277,19 +299,21 @@ Return the response string if optional second argument is non-nil." | |||
| 277 | 299 | ||
| 278 | ;; TRANSACTION STATE | 300 | ;; TRANSACTION STATE |
| 279 | 301 | ||
| 280 | (defvar pop3-md5-program "md5" | 302 | (eval-and-compile |
| 281 | "*Program to encode its input in MD5.") | 303 | (if (fboundp 'md5) |
| 282 | 304 | (defalias 'pop3-md5 'md5) | |
| 283 | (defun pop3-md5 (string) | 305 | (defvar pop3-md5-program "md5" |
| 284 | (with-temp-buffer | 306 | "*Program to encode its input in MD5.") |
| 285 | (insert string) | 307 | |
| 286 | (call-process-region (point-min) (point-max) | 308 | (defun pop3-md5 (string) |
| 287 | (or shell-file-name "/bin/sh") | 309 | (with-temp-buffer |
| 288 | t (current-buffer) nil | 310 | (insert string) |
| 289 | "-c" pop3-md5-program) | 311 | (call-process-region (point-min) (point-max) |
| 290 | ;; The meaningful output is the first 32 characters. | 312 | pop3-md5-program |
| 291 | ;; Don't return the newline that follows them! | 313 | t (current-buffer) nil) |
| 292 | (buffer-substring (point-min) (+ (point-min) 32)))) | 314 | ;; The meaningful output is the first 32 characters. |
| 315 | ;; Don't return the newline that follows them! | ||
| 316 | (buffer-substring 1 33))))) | ||
| 293 | 317 | ||
| 294 | (defun pop3-stat (process) | 318 | (defun pop3-stat (process) |
| 295 | "Return the number of messages in the maildrop and the maildrop's size." | 319 | "Return the number of messages in the maildrop and the maildrop's size." |