[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

nnimap 0.3.17 released



Bug fixes and added support for RFC2086, ACL editing.

Get it from http://vic20.dzp.se/gnus-imap/nnimap.tar.gz.

/s

1998-08-10 01:08:45  Simon Josefsson  <jas@pdc.kth.se>

	* nnimap 0.3.17 released

1998-08-10 01:02:18  Simon Josefsson  <jas@pdc.kth.se>

	* nnimap.el (nnimap-open-server): IMAP4{rev,REV}1. Case sensitive?

1998-08-09 23:39:38  Simon Josefsson  <jas@pdc.kth.se>

	* nnimap.el (gnus-group-edit-nnimap-acl{-done}): new functions

	* nnimap.el (nnimap-group-mode-hook): bind G l in group-mode to
	gnus-group-edit-nnimap-acl

1998-08-09 23:39:13  Simon Josefsson  <jas@pdc.kth.se>

	* imap4rev1.el (imap-cb-acl): new function

	* imap4rev1.el (imap-cb-function-alist): added acl callback

diff -u nnimap-0.3.16/imap4rev1.el nnimap-0.3.17/imap4rev1.el
--- nnimap-0.3.16/imap4rev1.el	Mon Aug  3 11:51:29 1998
+++ nnimap-0.3.17/imap4rev1.el	Mon Aug 10 01:01:51 1998
@@ -128,6 +128,7 @@
 				 (FETCH . imap-cb-fetch)
 				 (SEARCH . imap-cb-search)
 				 (STATUS . imap-cb-status)
+				 (ACL . imap-cb-acl)
 				 (default . imap-cb-default))
   "Alist of IMAP code to function callbacks.")
 
@@ -752,6 +753,9 @@
 
 (defun imap-cb-capability (code &rest capabilities)
   (setq imap-data-capability capabilities))
+
+(defun imap-cb-acl (code group &rest acls)
+  (imap-folder-set 'acl acls (symbol-name group)))
 
 (defun imap-cb-status (code folder statuses)
 ;  (check-valid-plist statuses)
diff -u nnimap-0.3.16/nnimap.el nnimap-0.3.17/nnimap.el
--- nnimap-0.3.16/nnimap.el	Sun Aug  9 21:00:28 1998
+++ nnimap-0.3.17/nnimap.el	Mon Aug 10 01:02:16 1998
@@ -77,7 +77,6 @@
 ;;;   o MIME
 ;;;   o Disconnected support (I haven't a clue about the Gnus Agent thing,
 ;;;     but IMAP has very good disconnected support)
-;;;   o Support RFC2086 (ACL editing)
 ;;;   o Support RFC2221 (Login referrals)
 ;;;   o Support RFC2095 (MD5 logins -- is there a MD5 library in Elisp?)
 ;;;   o IMAP2BIS compatibility (RFC2061)
@@ -97,7 +96,7 @@
 
 (nnoo-declare nnimap) ; we derive from no one
 
-(defconst nnimap-version "nnimap 0.3.16")
+(defconst nnimap-version "nnimap 0.3.17")
 
 (defvoo nnimap-list-pattern "*" 
 "*PATTERN or list of PATTERNS use to limit available groups.  
@@ -276,6 +275,8 @@
 	  nnimap-range-to-string
           nnimap-request-expire-articles
           nnimap-request-move-article
+	  nnimap-edit-acl-done
+	  nnimap-edit-acl
           )))
 
 
@@ -292,7 +293,8 @@
 (nnoo-define-basics nnimap)
 
 ;; todo:
-;; use NOV lines instead? BODY gives me everything but references
+;; use NOV lines instead? A fetch like
+;;   (UID RFC822.SIZE BODY BODY[HEADER.FIELDS (References)]) would do it
 ;; remove redundant lines:/chars:
 (deffoo nnimap-retrieve-headers (articles &optional group server fetch-old)
   (when (nnimap-possibly-change-group group server)
@@ -359,6 +361,8 @@
 					   "CAPABILITY" nnimap-server-buffer))
 			     (or (memq 'IMAP4 (imap-capability-get
 					       nnimap-server-buffer))
+				 (memq 'IMAP4rev1 (imap-capability-get
+						   nnimap-server-buffer))
 				 (memq 'IMAP4REV1 (imap-capability-get
 						   nnimap-server-buffer))))
 		  (imap-close-server nnimap-server-buffer)
@@ -997,5 +1001,100 @@
 	    ;; Failed SELECT unselects the current group
 	    (setq imap-current-folder nil))))
       imap-current-folder)))
+
+;;; Other functions
+
+;; Is this a Gnus function or a nnimap function?   Is this the way to implement
+;; backend specific functions that can't be done through the backend interface?
+;; Should this be in nnimap.el or somewhere else?
+;; I've no idea, feel free to re-write.
+(defun gnus-group-edit-nnimap-acl (group)
+  "Edit the Access Control List of current nnimap GROUP."
+  (interactive (list (gnus-group-group-name)))
+  (let ((mailbox (gnus-group-real-name group))
+	method acl)
+    (unless group
+      (error "No group on current line"))
+    (unless (gnus-get-info group)
+      (error "Killed group; can't be edited"))
+    (unless (eq 'nnimap (car (setq method (gnus-find-method-for-group group))))
+      (error "ACL editing only available for nnimap groups"))
+    (when (nnimap-possibly-change-server (cadr method))
+      (unless (memq 'ACL (imap-capability-get nnimap-server-buffer))
+	(error "Your server does not support ACL editing"))
+      (gnus-edit-form (with-current-buffer nnimap-server-buffer
+			(imap-folder-set 'acl nil mailbox)
+			(nnimap-send-command-wait (format "GETACL %s" mailbox))
+			(let ((raw (imap-folder-get 'acl mailbox))
+			      user access)
+			  (while (setq access (pop raw))
+			    (if user
+				(prog1
+				    (push (cons (symbol-name user)
+						(symbol-name access)) acl)
+				  (setq user nil))
+			      (setq user access))))
+			acl)
+		      (format "Editing the access control list for `%s'.
+
+   An access control list is a list of (identifier . rights) elements.
+
+   The identifier specifies the corresponding user. The identifier
+   `anyone' is reserved to refer to the universal identity.
+
+   Rights is a string listing a (possibly empty) set of alphanumeric
+   characters, each character listing a set of operations which is being
+   controlled. Letters are reserved for ``standard'' rights, listed
+   below.  Digits are reserved for implementation or site defined rights.
+
+   l - lookup (mailbox is visible to LIST/LSUB commands)
+   r - read (SELECT the mailbox, perform CHECK, FETCH, PARTIAL,
+       SEARCH, COPY from mailbox)
+   s - keep seen/unseen information across sessions (STORE SEEN flag)
+   w - write (STORE flags other than SEEN and DELETED)
+   i - insert (perform APPEND, COPY into mailbox)
+   p - post (send mail to submission address for mailbox,
+       not enforced by IMAP4 itself)
+   c - create (CREATE new sub-mailboxes in any implementation-defined
+       hierarchy)
+   d - delete (STORE DELETED flag, perform EXPUNGE)
+   a - administer (perform SETACL)" group)
+		      `(lambda (form) 
+			 (gnus-group-edit-nnimap-acl-done 
+			  ,mailbox ',method ',acl form))))))
+
+(defun gnus-group-edit-nnimap-acl-done (mailbox method old-acls acls)
+  (when (nnimap-possibly-change-server (cadr method))
+    (with-current-buffer nnimap-server-buffer
+      ;; delete all removed identifiers
+      (let ((deleted (copy-list old-acls))
+	    (dontdelete acls) acl)
+	(while (setq acl (pop deleted))
+	  (unless (assoc (car acl) dontdelete)
+	    (let ((status 
+		   (nnimap-send-command-wait
+		    (format "DELETEACL %s %s" mailbox (car acl)))))
+	      (when (and (listp status)
+			 (eq 'NO (car status)))
+		(error "Can't delete ACL: %s" (cadr status))))))
+      ;; set all changed acl's
+      (let ((new-acls acls) acl)
+	(while (setq acl (pop new-acls))
+	  (let* ((user (car acl))
+		 (access (cdr acl))
+		 (old-access (cdr (assoc user old-acls))))
+	    (unless (string= access old-access)
+	      (let ((status 
+		     (nnimap-send-command-wait
+		      (format "SETACL %s %s %s" mailbox user access))))
+		(when (and (listp status)
+			   (eq 'NO (car status)))
+		  (error "Can't set ACL: %s" (cadr status))))))))))))
+
+;;; Glue
+
+(defun nnimap-group-mode-hook ()
+  (define-key gnus-group-mode-map (kbd "G l") 'gnus-group-edit-nnimap-acl))
+(add-hook 'gnus-group-mode-hook 'nnimap-group-mode-hook)
 
 (provide 'nnimap)
diff -u nnimap-0.3.16/ChangeLog nnimap-0.3.17/ChangeLog
--- nnimap-0.3.16/ChangeLog	Sun Aug  9 21:00:59 1998
+++ nnimap-0.3.17/ChangeLog	Mon Aug 10 01:08:49 1998
@@ -1,3 +1,24 @@
+1998-08-10 01:08:45  Simon Josefsson  <jas@pdc.kth.se>
+
+	* nnimap 0.3.17 released
+
+1998-08-10 01:02:18  Simon Josefsson  <jas@pdc.kth.se>
+
+	* nnimap.el (nnimap-open-server): IMAP4{rev,REV}1. Case sensitive?
+
+1998-08-09 23:39:38  Simon Josefsson  <jas@pdc.kth.se>
+
+	* nnimap.el (gnus-group-edit-nnimap-acl{-done}): new functions
+
+	* nnimap.el (nnimap-group-mode-hook): bind G l in group-mode to
+	gnus-group-edit-nnimap-acl
+
+1998-08-09 23:39:13  Simon Josefsson  <jas@pdc.kth.se>
+
+	* imap4rev1.el (imap-cb-acl): new function
+
+	* imap4rev1.el (imap-cb-function-alist): added acl callback
+
 1998-08-09 21:00:53  Simon Josefsson  <jas@pdc.kth.se>
 
 	* nnimap 0.3.16 released