From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/44606 Path: main.gmane.org!not-for-mail From: Matt Armstrong Newsgroups: gmane.emacs.gnus.general Subject: nnmaildir.el + courier IMAP compatibility patch Date: Thu, 02 May 2002 11:39:54 -0600 Sender: owner-ding@hpc.uh.edu Message-ID: <87n0viphxx.fsf@squeaker.lickey.com> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: main.gmane.org 1020361260 32494 127.0.0.1 (2 May 2002 17:41:00 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Thu, 2 May 2002 17:41:00 +0000 (UTC) Return-path: Original-Received: from malifon.math.uh.edu ([129.7.128.13]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 173KZf-0008Rl-00 for ; Thu, 02 May 2002 19:40:59 +0200 Original-Received: from sina.hpc.uh.edu ([129.7.128.10] ident=lists) by malifon.math.uh.edu with esmtp (Exim 3.20 #1) id 173KZ0-0005LC-00; Thu, 02 May 2002 12:40:18 -0500 Original-Received: by sina.hpc.uh.edu (TLB v0.09a (1.20 tibbs 1996/10/09 22:03:07)); Thu, 02 May 2002 12:40:31 -0500 (CDT) Original-Received: from sclp3.sclp.com (qmailr@sclp3.sclp.com [209.196.61.66]) by sina.hpc.uh.edu (8.9.3/8.9.3) with SMTP id MAA16699 for ; Thu, 2 May 2002 12:40:18 -0500 (CDT) Original-Received: (qmail 4609 invoked by alias); 2 May 2002 17:39:58 -0000 Original-Received: (qmail 4604 invoked from network); 2 May 2002 17:39:57 -0000 Original-Received: from hank.lickey.com (ident-is-dumb@64.81.100.235) by gnus.org with SMTP; 2 May 2002 17:39:57 -0000 Original-Received: from squeaker.lickey.com (squeaker.lickey.com [192.168.100.10]) by hank.lickey.com (Postfix) with ESMTP id 16458EE45 for ; Thu, 2 May 2002 11:39:57 -0600 (MDT) Original-Received: by squeaker.lickey.com (Postfix, from userid 1000) id 2223CC068; Thu, 2 May 2002 11:39:55 -0600 (MDT) Mail-Copies-To: nobody Original-To: ding Mail-Followup-To: ding Original-Lines: 32 User-Agent: Gnus/5.090007 (Oort Gnus v0.07) Emacs/21.2 (i386-debian-linux-gnu) Precedence: list X-Majordomo: 1.94.jlt7 Xref: main.gmane.org gmane.emacs.gnus.general:44606 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:44606 --=-=-= 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 --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=nnmaildir.patch 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) --=-=-=--