comparison lisp/mail/rmail.el @ 88206:fdaa84109d39

(rmail-get-sender): Deleted (rmail-process-new-messages): Use mail-fetch-field instead.
author Henrik Enberg <henrik.enberg@telia.com>
date Wed, 18 Jan 2006 20:11:04 +0000
parents f400fb7ee08a
children 8d2ef2dbf238
comparison
equal deleted inserted replaced
88205:f400fb7ee08a 88206:fdaa84109d39
1936 (let ((inhibit-read-only t) 1936 (let ((inhibit-read-only t)
1937 (case-fold-search nil) 1937 (case-fold-search nil)
1938 (new-message-counter 0) 1938 (new-message-counter 0)
1939 (start (point-max)) 1939 (start (point-max))
1940 end attributes keywords message-descriptor-list 1940 end attributes keywords message-descriptor-list
1941 date coding) 1941 date coding sender)
1942 (or nomsg (message "Processing new messages...")) 1942 (or nomsg (message "Processing new messages..."))
1943 ;; Process each message in turn starting from the back and 1943 ;; Process each message in turn starting from the back and
1944 ;; proceeding to the front of the region. This is especially a 1944 ;; proceeding to the front of the region. This is especially a
1945 ;; good approach since the buffer will likely have new headers 1945 ;; good approach since the buffer will likely have new headers
1946 ;; added. 1946 ;; added.
2021 (vconcat (list (list (point-min-marker) 2021 (vconcat (list (list (point-min-marker)
2022 attributes 2022 attributes
2023 keywords 2023 keywords
2024 date 2024 date
2025 (count-lines start end) 2025 (count-lines start end)
2026 (rmail-get-sender) 2026 (cadr (mail-extract-address-components
2027 (mail-fetch-field "from")))
2027 (rmail-header-get-header "subject"))) 2028 (rmail-header-get-header "subject")))
2028 message-descriptor-list))))) 2029 message-descriptor-list)))))
2029 ;; Add the new message data lists to the Rmail message descriptor 2030 ;; Add the new message data lists to the Rmail message descriptor
2030 ;; vector. 2031 ;; vector.
2031 (rmail-desc-add-descriptors message-descriptor-list) 2032 (rmail-desc-add-descriptors message-descriptor-list)
3482 (setq curmask (lsh curmask -8)) 3483 (setq curmask (lsh curmask -8))
3483 (aset string-vector i (logxor charmask (aref string-vector i))) 3484 (aset string-vector i (logxor charmask (aref string-vector i)))
3484 (setq i (1+ i))) 3485 (setq i (1+ i)))
3485 (concat string-vector))) 3486 (concat string-vector)))
3486 3487
3487 ;;; New functions that need better placement.
3488 (defun rmail-get-sender ()
3489 "Return the message sender.
3490 The current buffer (possibly narrowed) contains a single message."
3491 (save-excursion
3492 (goto-char (point-min))
3493 (if (not (re-search-forward "^From:[ \t]*" nil t))
3494 " "
3495 (let* ((from (mail-strip-quoted-names
3496 (buffer-substring
3497 (1- (point))
3498 ;; Get all the lines of the From field
3499 ;; so that we get a whole comment if there is one,
3500 ;; so that mail-strip-quoted-names can discard it.
3501 (let ((opoint (point)))
3502 (while (progn (forward-line 1)
3503 (looking-at "[ \t]")))
3504 ;; Back up over newline, then trailing spaces or tabs
3505 (forward-char -1)
3506 (skip-chars-backward " \t")
3507 (point)))))
3508 len mch lo)
3509 (if (string-match (concat "^\\("
3510 (regexp-quote (user-login-name))
3511 "\\($\\|@\\)\\|"
3512 (regexp-quote
3513 ;; Don't lose if run from init file
3514 ;; where user-mail-address is not
3515 ;; set yet.
3516 (or user-mail-address
3517 (concat (user-login-name) "@"
3518 (or mail-host-address
3519 (system-name)))))
3520 "\\>\\)")
3521 from)
3522 (save-excursion
3523 (goto-char (point-min))
3524 (if (not (re-search-forward "^To:[ \t]*" nil t))
3525 nil
3526 (setq from
3527 (concat "to: "
3528 (mail-strip-quoted-names
3529 (buffer-substring
3530 (point)
3531 (progn (end-of-line)
3532 (skip-chars-backward " \t")
3533 (point)))))))))
3534 (setq len (length from))
3535 (setq mch (string-match "[@%]" from))
3536 (format "%25s"
3537 (if (or (not mch) (<= len 25))
3538 (substring from (max 0 (- len 25)))
3539 (substring from
3540 (setq lo (cond ((< (- mch 14) 0) 0)
3541 ((< len (+ mch 11))
3542 (- len 25))
3543 (t (- mch 14))))
3544 (min len (+ lo 25)))))))))
3545
3546 ;;;; Desktop support 3488 ;;;; Desktop support
3547 3489
3548 (defun rmail-restore-desktop-buffer (desktop-buffer-file-name 3490 (defun rmail-restore-desktop-buffer (desktop-buffer-file-name
3549 desktop-buffer-name 3491 desktop-buffer-name
3550 desktop-buffer-misc) 3492 desktop-buffer-misc)