[gnus git] branch master updated: =1= Implement the asynchronous data fetching functions for nntp.

Lars Magne Ingebrigtsen <[email protected]>
Newsgroups gmane.emacs.gnus.cvs
Message-ID <[email protected]>
       via  3ecb468fe961e2ab237028f1864bc9e9fdafb70e (commit)
      from  0757f205eed80587bfbc461c5510707d9be3247d (commit)


- Log -----------------------------------------------------------------
commit 3ecb468fe961e2ab237028f1864bc9e9fdafb70e
Author: Lars Magne Ingebrigtsen <[email protected]>
Date:   Sun Jan 30 19:15:42 2011 -0800

    Implement the asynchronous data fetching functions for nntp.

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 51b0359..3d3f79f 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -4,6 +4,10 @@
 
 2011-01-31  Lars Ingebrigtsen  <[email protected]>
 
+	* nntp.el (nntp-retrieve-group-data-early)
+	(nntp-finish-retrieve-group-infos): Implement the asynchronous data
+	fetching functions.
+
 	* gnus-start.el (gnus-read-active-for-groups): Read the active files
 	thoroughly for all backends that have no known groups.  This should
 	allow new nnml methods to retrieve mail.
diff --git a/lisp/nntp.el b/lisp/nntp.el
index b6b6449..cae0150 100644
--- a/lisp/nntp.el
+++ b/lisp/nntp.el
@@ -774,6 +774,62 @@ command whose response triggered the error."
 	 (nntp-copy-to-buffer nntp-server-buffer (point-min) (point-max))
          'headers)))))
 
+(deffoo nntp-retrieve-group-data-early (server infos)
+  "Retrieve group info on INFOS."
+  (nntp-with-open-group nil server
+    (when (nntp-find-connection-buffer nntp-server-buffer)
+      ;; The first time this is run, this variable is `try'.  So we
+      ;; try.
+      (when (eq nntp-server-list-active-group 'try)
+	(nntp-try-list-active (gnus-group-real-name (gnus-info-group (car infos)))))
+      (with-current-buffer (nntp-find-connection-buffer nntp-server-buffer)
+	(erase-buffer)
+	(let ((nntp-inhibit-erase t)
+	      (command (if nntp-server-list-active-group
+			   "LIST ACTIVE" "GROUP")))
+	  (dolist (info infos)
+	    (nntp-send-command
+	     nil command (gnus-group-real-name (gnus-info-group info)))))
+	(length infos)))))
+
+(deffoo nntp-finish-retrieve-group-infos (server infos count)
+  (nntp-with-open-group nil server
+    (let ((buf (nntp-find-connection-buffer nntp-server-buffer))
+	  (method (gnus-find-method-for-group
+		   (gnus-info-group (car infos))
+		   (car infos)))
+	  (received 0)
+	  (last-point 1))
+      (when buf
+	(with-current-buffer buf
+	  (while (and (gnus-buffer-live-p buf)
+		      (progn
+			(goto-char last-point)
+			;; Count replies.
+			(while (re-search-forward "^[0-9]" nil t)
+			  (incf received))
+			(setq last-point (point))
+			(< received count)))
+	    (nntp-accept-response))
+	  ;; We now have all the entries.  Remove CRs.
+	  (goto-char (point-min))
+	  (while (search-forward "\r" nil t)
+	    (replace-match "" t t))
+
+	  (if (not nntp-server-list-active-group)
+	      (progn
+		(nntp-copy-to-buffer nntp-server-buffer
+				     (point-min) (point-max))
+		(gnus-groups-to-gnus-format method gnus-active-hashtb t))
+	    ;; We have read active entries, so we just delete the
+	    ;; superfluous gunk.
+	    (goto-char (point-min))
+	    (while (re-search-forward "^[.2-5]" nil t)
+	      (delete-region (match-beginning 0)
+			     (progn (forward-line 1) (point))))
+	    (nntp-copy-to-buffer nntp-server-buffer (point-min) (point-max))
+	    (gnus-active-to-gnus-format method gnus-active-hashtb nil t)))))))
+
 (deffoo nntp-retrieve-groups (groups &optional server)
   "Retrieve group info on GROUPS."
   (nntp-with-open-group

-----------------------------------------------------------------------
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 |    4 ++++
 lisp/nntp.el   |   56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 60 insertions(+), 0 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.