Gnus development mailing list
 help / color / mirror / Atom feed
* nnmaildir.el + courier IMAP compatibility patch
@ 2002-05-02 17:39 Matt Armstrong
  2002-05-02 22:32 ` Paul Jarc
  0 siblings, 1 reply; 10+ messages in thread
From: Matt Armstrong @ 2002-05-02 17:39 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 1138 bytes --]

Paul and other nnmaildir hackers,

I'm now looking at switching to nnmaildir, primarily because it'll let
me read mail natively via Gnus or via Courier IMAP which also uses
Maildir for its backend.

By default Courier IMAP expects INBOX to be ~/Maildir/ and any
INBOX.subfolder to be ~/Maildir/.subfolder/.  However, if I set up
nnmaildir's create-directory to point at ~/Maildir/, it will create
new folders without the leading dot (~/Maildir/subfolder/) and Courier
IMAP won't find them.  What's more, conflicts would occur if I wanted
to create groups called "cur," "new" or "tmp".

So I added a courier-compatible parameter to the nnmaildir server that
causes it to create new maildirs with a leading . in the dir filename
(while keeping the Gnus group the same).

It also cleans up the logic that turns create-dir into the maildir
name by doing it only once.

It also makes sure not to turn any .nnmaildir directory into a maildir
(by failing to create a "nnmaildir" group when courier-compatible is
set).

Please check out this patch and consider committing it.  I recently
sent Gnus related copyright papers to the FSF.

-- 
matt


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: nnmaildir.patch --]
[-- Type: text/x-patch, Size: 2456 bytes --]

Index: nnmaildir.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/nnmaildir.el,v
retrieving revision 6.17
diff -u -r6.17 nnmaildir.el
--- nnmaildir.el	2002/04/22 02:28:17	6.17
+++ nnmaildir.el	2002/05/02 17:42:42
@@ -134,6 +134,7 @@
   (error      nil :type string)         ;; last error message, or nil
   (mtime      nil :type list)           ;; modtime of dir
   (gnm        nil)                      ;; flag: split from mail-sources?
+  (courier    nil)                      ;; flag: create maildirs w/ leading '.'
   (create-dir nil :type string))        ;; group creation directory
 
 (defmacro nnmaildir--nlist-last-num (nlist)
@@ -541,6 +542,10 @@
 	   (car x)
 	   (setf (nnmaildir--srv-gnm server) t)
 	   (require 'nnmail))
+      (and (setq x (assq 'courier-compatible defs))
+	   (setq x (cdr x))
+	   (car x)
+	   (setf (nnmaildir--srv-courier server) t))
       (setq x (assq 'create-directory defs))
       (when x
 	(setq x (cadr x)
@@ -897,7 +902,7 @@
   (nnmaildir--prepare server nil)
   (catch 'return
     (let ((create-dir (nnmaildir--srv-create-dir nnmaildir--cur-server))
-	  srv-dir dir groups)
+	  srv-dir dir groups maildir)
       (when (zerop (length gname))
 	(setf (nnmaildir--srv-error nnmaildir--cur-server)
 	      "Invalid (empty) group name")
@@ -922,13 +927,21 @@
 	(setq dir srv-dir
 	      dir (file-truename dir)
 	      dir (concat dir create-dir)))
-      (setq dir (nnmaildir--subdir (file-name-as-directory dir) gname))
+      (setq dir (file-name-as-directory dir))
+      (setq maildir (concat dir
+			    (if (nnmaildir--srv-courier nnmaildir--cur-server)
+				(concat "." gname)
+			      gname)))
+      (when (equal (file-name-as-directory maildir) (nnmaildir--nndir dir))
+	(setf (nnmaildir--srv-error nnmaildir--cur-server)
+	      (concat "Group name may not be " gname))
+	(throw 'return nil))
+      (setq dir (file-name-as-directory maildir))
       (nnmaildir--mkdir dir)
       (nnmaildir--mkdir (nnmaildir--tmp dir))
       (nnmaildir--mkdir (nnmaildir--new dir))
       (nnmaildir--mkdir (nnmaildir--cur dir))
-      (setq create-dir (file-name-as-directory create-dir))
-      (make-symbolic-link (concat create-dir gname) (concat srv-dir gname))
+      (make-symbolic-link maildir (concat srv-dir gname))
       (nnmaildir-request-scan 'find-new-groups))))
 
 (defun nnmaildir-request-rename-group (gname new-name &optional server)

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2002-05-03 21:37 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-02 17:39 nnmaildir.el + courier IMAP compatibility patch Matt Armstrong
2002-05-02 22:32 ` Paul Jarc
2002-05-02 23:26   ` Lloyd Zusman
2002-05-03 16:41   ` Matt Armstrong
2002-05-03 17:19     ` Matt Armstrong
2002-05-03 17:53       ` Simon Josefsson
2002-05-03 21:01         ` Matt Armstrong
2002-05-03 19:12     ` Paul Jarc
2002-05-03 21:21       ` Matt Armstrong
2002-05-03 21:37         ` Paul Jarc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).