[gnus git] branch master updated: n0-15-42-g4b3eae1 =1= registry.el and gnus-registry.el ERT compatibility fixes, proto-stream.el commit revert, old .eld gnus-registry.el importer

Ted Zlatanov <[email protected]>
Newsgroups gmane.emacs.gnus.cvs
Message-ID <[email protected]>
       via  4b3eae16e6dfbed9198a27657860934a02b5b8b5 (commit)
      from  4b36d9a9ab204266a28408fb81368174d9c183a7 (commit)


- Log -----------------------------------------------------------------
commit 4b3eae16e6dfbed9198a27657860934a02b5b8b5
Author: Ted Zlatanov <[email protected]>
Date:   Wed Apr 6 05:52:28 2011 -0500

    registry.el and gnus-registry.el ERT compatibility fixes, proto-stream.el commit revert, old .eld gnus-registry.el importer
    
    * proto-stream.el (gnutls-negotiate): Revert inadvertent commit of the
    version from the Claudio Bley GnuTLS patch (extra optional parameters
    and host name).
    
    * registry.el: Don't use ERT if it's not available.
    
    * gnus-registry.el: Don't use ERT if it's not available.
    (gnus-registry-delete-entries): New convenience function.
    (gnus-registry-import-eld): Import from old .eld registry.

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 51a8ef3..36e5b8b 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,15 @@
+2011-04-06  Teodor Zlatanov  <[email protected]>
+
+	* gnus-registry.el: Don't use ERT if it's not available.
+	(gnus-registry-delete-entries): New convenience function.
+	(gnus-registry-import-eld): Import from old .eld registry.
+
+	* registry.el: Don't use ERT if it's not available.
+
+	* proto-stream.el (gnutls-negotiate): Revert inadvertent commit of the
+	version from the Claudio Bley GnuTLS patch (extra optional parameters
+	and host name).
+
 2011-04-05  Teodor Zlatanov  <[email protected]>
 
 	* gnus-registry.el (gnus-registry-fixup-registry): New function to
diff --git a/lisp/gnus-registry.el b/lisp/gnus-registry.el
index 3ab8400..511012d 100644
--- a/lisp/gnus-registry.el
+++ b/lisp/gnus-registry.el
@@ -57,7 +57,10 @@
 
 (eval-when-compile (require 'cl))
 
-(require 'ert)
+(eval-when-compile
+  (when (null (require 'ert nil t))
+    (defmacro* ert-deftest (name () &body docstring-keys-and-body))))
+
 (require 'gnus)
 (require 'gnus-int)
 (require 'gnus-sum)
@@ -807,6 +810,9 @@ only the last one's marks are returned."
 
     (nth 1 (assoc id entries))))
 
+(defun gnus-registry-delete-entries (idlist)
+  (registry-delete gnus-registry-db idlist nil))
+
 (defun gnus-registry-get-id-key (id key)
   (cdr-safe (assq key (gnus-registry-get-or-make-entry id))))
 
@@ -818,6 +824,51 @@ only the last one's marks are returned."
     (registry-insert db id entry)
     entry))
 
+(defun gnus-registry-import-eld (file)
+  (interactive "fOld registry file to import? ")
+  ;; example content:
+  ;;   (setq gnus-registry-alist '(
+  ;; ("<messageID>" ((marks nil)
+  ;;                 (mtime 19365 1776 440496)
+  ;;                 (sender . "root (Cron Daemon)")
+  ;;                 (subject . "Cron"))
+  ;;  "cron" "nnml+private:cron")
+  (load file t)
+  (when (boundp 'gnus-registry-alist)
+    (let* ((old (symbol-value 'gnus-registry-alist))
+           (count 0)
+           (expected (length old))
+           entry)
+      (while (car-safe old)
+        (incf count)
+        ;; don't use progress reporters for backwards compatibility
+        (when (and (< 0 expected)
+                   (= 0 (mod count 100)))
+          (message "importing: %d of %d (%.2f%%)"
+                   count expected (/ (* 100 count) expected)))
+        (setq entry (car-safe old)
+              old (cdr-safe old))
+        (let* ((id (car-safe entry))
+               (new-entry (gnus-registry-get-or-make-entry id))
+               (rest (cdr-safe entry))
+               (groups (loop for p in rest
+                             when (stringp p)
+                             collect p))
+               extra-cell key val)
+          ;; remove all the strings from the entry
+          (delete* nil rest :test (lambda (a b) (stringp b)))
+          (gnus-registry-set-id-key id 'group groups)
+          ;; just use the first extra element
+          (setq rest (car-safe rest))
+          (while (car-safe rest)
+            (setq extra-cell (car-safe rest)
+                  key (car-safe extra-cell)
+                  val (cdr-safe extra-cell)
+                  rest (cdr-safe rest))
+            (when (and val (atom val))
+              (setq val (list val)))
+            (gnus-registry-set-id-key id key val))))
+      (message "Import done, collected %d entries" count))))
 
 (ert-deftest gnus-registry-usage-test ()
   (let* ((n 100)
diff --git a/lisp/proto-stream.el b/lisp/proto-stream.el
index f4d438d..45cc974 100644
--- a/lisp/proto-stream.el
+++ b/lisp/proto-stream.el
@@ -52,8 +52,7 @@
 (require 'starttls)
 
 (declare-function gnutls-negotiate "gnutls"
-                  (proc type host &optional priority-string trustfiles keyfiles
-                        verify-flags verify-error verify-hostname-error))
+		  (proc type &optional priority-string trustfiles keyfiles))
 
 ;;;###autoload
 (defun open-protocol-stream (name buffer host service &rest parameters)
@@ -185,7 +184,7 @@ PARAMETERS should be a sequence of keywords and values:
 			  (proto-stream-command stream starttls-command eoc))
 	;; The server said it was OK to begin STARTTLS negotiations.
 	(if (fboundp 'open-gnutls-stream)
-	    (gnutls-negotiate stream nil host)
+	    (gnutls-negotiate stream nil)
 	  (unless (starttls-negotiate stream)
 	    (delete-process stream)))
 	(if (memq (process-status stream) '(open run))
diff --git a/lisp/registry.el b/lisp/registry.el
index 319da8f..cc03b20 100644
--- a/lisp/registry.el
+++ b/lisp/registry.el
@@ -77,7 +77,10 @@
 
 ;;; Code:
 
-(eval-when-compile (require 'ert))
+(eval-when-compile
+  (when (null (require 'ert nil t))
+    (defmacro* ert-deftest (name () &body docstring-keys-and-body))))
+
 (eval-when-compile (require 'cl))
 (eval-and-compile
   (or (ignore-errors (progn

-----------------------------------------------------------------------
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we listed those
revisions in full, above.

Summary of changes:
 lisp/ChangeLog        |   12 +++++++++++
 lisp/gnus-registry.el |   53 ++++++++++++++++++++++++++++++++++++++++++++++++-
 lisp/proto-stream.el  |    5 +--
 lisp/registry.el      |    5 +++-
 4 files changed, 70 insertions(+), 5 deletions(-)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnus Project".

The branch, master has been updated


hooks/post-receive
-- 
Gnus Project
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.