* message.el (nnmaildir-article-number-to-base-name): New
authorPaul Jarc <prj@po.cwru.edu>
Tue, 5 Mar 2002 04:50:28 +0000 (04:50 +0000)
committerPaul Jarc <prj@po.cwru.edu>
Tue, 5 Mar 2002 04:50:28 +0000 (04:50 +0000)
function.
(nnmaildir-base-name-to-article-number): New function.

lisp/ChangeLog
lisp/nnmaildir.el

index 2fcb956..d58c256 100644 (file)
@@ -1,3 +1,9 @@
+2002-03-04  Paul Jarc  <prj@po.cwru.edu>
+
+       * message.el (nnmaildir-article-number-to-base-name): New
+       function.
+       (nnmaildir-base-name-to-article-number): New function.
+
 2002-03-04  Katsumi Yamaoka  <yamaoka@jpl.org>
 
        * smime.el (smime-make-temp-file): Don't quote
index 094704a..b87cf4f 100644 (file)
@@ -505,6 +505,42 @@ by nnmaildir-request-article.")
        (nnmaildir--art-set-nov article nil)
        nil))))
 
+(defun nnmaildir-article-number-to-base-name
+  (number group-name server-address-string)
+  (let ((group (nnmaildir--prepare server-address-string group-name))
+       list article suffix dir filename)
+    (catch 'return
+      (if (null group)
+         ;; The given group or server does not exist.
+         (throw 'return nil))
+      (setq list (nnmaildir--grp-get-lists group)
+           list (nnmaildir--lists-get-nlist list)
+           article (nnmaildir--nlist-art list number))
+      (if (null article)
+         ;; The given article number does not exist in this group.
+         (throw 'return nil))
+      (setq suffix (nnmaildir--art-get-suffix article))
+      (if (not (stringp suffix))
+         ;; The article has expired.
+         (throw 'return nil))
+      (cons (nnmaildir--art-get-prefix article) suffix))))
+
+(defun nnmaildir-base-name-to-article-number
+  (base-name group-name server-address-string)
+  (let ((group (nnmaildir--prepare server-address-string group-name))
+       list article suffix dir filename)
+    (catch 'return
+      (if (null group)
+         ;; The given group or server does not exist.
+         (throw 'return nil))
+      (setq list (nnmaildir--grp-get-lists group)
+           list (nnmaildir--lists-get-flist list)
+           article (nnmaildir--flist-art list base-name))
+      (if (null article)
+         ;; The given article number does not exist in this group.
+         (throw 'return nil))
+      (nnmaildir--art-get-num article))))
+
 (defun nnmaildir-request-type (group &optional article)
   'mail)