* lisp/gnus-sum.el (gnus-extract-full-name): New variable.
authorakr <akr>
Sun, 22 Mar 1998 22:56:23 +0000 (22:56 +0000)
committerakr <akr>
Sun, 22 Mar 1998 22:56:23 +0000 (22:56 +0000)
(gnus-extract-full-name-default): New function.
(gnus-summary-insert-line): Use `gnus-extract-full-name'.
(gnus-summary-prepare-threads): Use `gnus-extract-full-name'.

lisp/gnus-sum.el

index 762c59e..79bf904 100644 (file)
@@ -2482,6 +2482,27 @@ marks of articles."
    (point) (progn (eval gnus-summary-dummy-line-format-spec) (point))
    (list 'gnus-number gnus-tmp-number 'gnus-intangible gnus-tmp-number)))
 
+(defvar gnus-extract-full-name 'gnus-extract-full-name-default)
+(defun gnus-extract-full-name-default (gnus-tmp-from)
+  (let ((gnus-tmp-name
+        (cond
+         ((string-match "<[^>]+> *$" gnus-tmp-from)
+          (let ((beg (match-beginning 0)))
+            (or (and (string-match
+                      "^\"\\([^\"\\\\]\\|\\\\.\\)*\""
+                      gnus-tmp-from)
+                     (std11-strip-quoted-pair
+                      (substring gnus-tmp-from (1+ (match-beginning 0))
+                                 (1- (match-end 0)))))
+                (substring gnus-tmp-from 0 beg))))
+         ((string-match "(.+)" gnus-tmp-from)
+          (substring gnus-tmp-from
+                     (1+ (match-beginning 0)) (1- (match-end 0))))
+         (t gnus-tmp-from))))
+    (if (string= gnus-tmp-name "")
+      gnus-tmp-from
+      gnus-tmp-name)))
+
 (defun gnus-summary-insert-line (gnus-tmp-header
                                 gnus-tmp-level gnus-tmp-current
                                 gnus-tmp-unread gnus-tmp-replied
@@ -2507,25 +2528,12 @@ marks of articles."
                 gnus-saved-mark)
                (t gnus-unread-mark)))
         (gnus-tmp-from (mail-header-from gnus-tmp-header))
-        (gnus-tmp-name
-         (cond
-          ((string-match "<[^>]+> *$" gnus-tmp-from)
-           (let ((beg (match-beginning 0)))
-             (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
-                      (substring gnus-tmp-from (1+ (match-beginning 0))
-                                 (1- (match-end 0))))
-                 (substring gnus-tmp-from 0 beg))))
-          ((string-match "(.+)" gnus-tmp-from)
-           (substring gnus-tmp-from
-                      (1+ (match-beginning 0)) (1- (match-end 0))))
-          (t gnus-tmp-from)))
+        (gnus-tmp-name (funcall gnus-extract-full-name gnus-tmp-from))
         (gnus-tmp-subject (mail-header-subject gnus-tmp-header))
         (gnus-tmp-number (mail-header-number gnus-tmp-header))
         (gnus-tmp-opening-bracket (if gnus-tmp-dummy ?\< ?\[))
         (gnus-tmp-closing-bracket (if gnus-tmp-dummy ?\> ?\]))
         (buffer-read-only nil))
-    (when (string= gnus-tmp-name "")
-      (setq gnus-tmp-name gnus-tmp-from))
     (unless (numberp gnus-tmp-lines)
       (setq gnus-tmp-lines 0))
     (gnus-put-text-property
@@ -3513,7 +3521,7 @@ or a straight list of headers."
   (let ((gnus-tmp-level 0)
        (default-score (or gnus-summary-default-score 0))
        (gnus-visual-p (gnus-visual-p 'summary-highlight 'highlight))
-       thread number subject stack state gnus-tmp-gathered beg-match
+       thread number subject stack state gnus-tmp-gathered
        new-roots gnus-tmp-new-adopts thread-end
        gnus-tmp-header gnus-tmp-unread
        gnus-tmp-replied gnus-tmp-subject-or-nil
@@ -3710,20 +3718,7 @@ or a straight list of headers."
                    gnus-saved-mark)
                   (t gnus-unread-mark))
             gnus-tmp-from (mail-header-from gnus-tmp-header)
-            gnus-tmp-name
-            (cond
-             ((string-match "<[^>]+> *$" gnus-tmp-from)
-              (setq beg-match (match-beginning 0))
-              (or (and (string-match "^\"[^\"]*\"" gnus-tmp-from)
-                       (substring gnus-tmp-from (1+ (match-beginning 0))
-                                  (1- (match-end 0))))
-                  (substring gnus-tmp-from 0 beg-match)))
-             ((string-match "(.+)" gnus-tmp-from)
-              (substring gnus-tmp-from
-                         (1+ (match-beginning 0)) (1- (match-end 0))))
-             (t gnus-tmp-from)))
-           (when (string= gnus-tmp-name "")
-             (setq gnus-tmp-name gnus-tmp-from))
+            gnus-tmp-name (funcall gnus-extract-full-name gnus-tmp-from))
            (unless (numberp gnus-tmp-lines)
              (setq gnus-tmp-lines 0))
            (gnus-put-text-property