X-Git-Url: http://cgit.sxemacs.org/?a=blobdiff_plain;f=lisp%2Fgnus-move.el;h=36839c8d07e8199808b03fc0d442f95f3ba145e0;hb=f2eb1747efcae6f3aeb0a2ee0988674a82c5a0a2;hp=ba8b9c252c3206b67bad996d0f4bcba5cc0d7d2b;hpb=b28454eed83f245c4160228b076134ce930b320a;p=gnus diff --git a/lisp/gnus-move.el b/lisp/gnus-move.el index ba8b9c252..36839c8d0 100644 --- a/lisp/gnus-move.el +++ b/lisp/gnus-move.el @@ -1,7 +1,8 @@ ;;; gnus-move.el --- commands for moving Gnus from one server to another -;; Copyright (C) 1996,97 Free Software Foundation, Inc. +;; Copyright (C) 1996, 1997, 1998, 1999, 2000 +;; Free Software Foundation, Inc. -;; Author: Lars Magne Ingebrigtsen +;; Author: Lars Magne Ingebrigtsen ;; Keywords: news ;; This file is part of GNU Emacs. @@ -25,6 +26,8 @@ ;;; Code: +(eval-when-compile (require 'cl)) + (require 'gnus) (require 'gnus-start) (require 'gnus-int) @@ -43,6 +46,7 @@ Update the .newsrc.eld file to reflect the change of nntp server." ;; First start Gnus. (let ((gnus-activate-level 0) + (mail-sources nil) (nnmail-spool-file nil)) (gnus)) @@ -59,15 +63,18 @@ Update the .newsrc.eld file to reflect the change of nntp server." "Move group INFO from FROM-SERVER to TO-SERVER." (let ((group (gnus-info-group info)) to-active hashtb type mark marks - to-article to-reads to-marks article) + to-article to-reads to-marks article + act-articles) (gnus-message 7 "Translating %s..." group) (when (gnus-request-group group nil to-server) (setq to-active (gnus-parse-active) - hashtb (gnus-make-hashtable 1024)) + hashtb (gnus-make-hashtable 1024) + act-articles (gnus-uncompress-range to-active)) ;; Fetch the headers from the `to-server'. (when (and to-active + act-articles (setq type (gnus-retrieve-headers - (gnus-uncompress-range to-active) + act-articles group to-server))) ;; Convert HEAD headers. I don't care. (when (eq type 'headers) @@ -85,6 +92,8 @@ Update the .newsrc.eld file to reflect the change of nntp server." ;; Then we read the headers from the `from-server'. (when (and (gnus-request-group group nil from-server) (gnus-active group) + (gnus-uncompress-range + (gnus-active group)) (setq type (gnus-retrieve-headers (gnus-uncompress-range (gnus-active group)) @@ -108,24 +117,27 @@ Update the .newsrc.eld file to reflect the change of nntp server." (goto-char (point-min)) (while (looking-at "^[0-9]+\t[^\t]*\t[^\t]*\t[^\t]*\t\\([^\t]*\\)\t") - (setq to-article - (gnus-gethash - (buffer-substring (match-beginning 1) (match-end 1)) - hashtb)) - ;; Add this article to the list of read articles. - (push to-article to-reads) - ;; See if there are any marks and then add them. - (when (setq mark (assq (read (current-buffer)) marks)) - (setq marks (delq mark marks)) - (setcar mark to-article) - (push mark to-marks)) - (forward-line 1)) + (when (setq to-article + (gnus-gethash + (buffer-substring (match-beginning 1) (match-end 1)) + hashtb)) + ;; Add this article to the list of read articles. + (push to-article to-reads) + ;; See if there are any marks and then add them. + (when (setq mark (assq (read (current-buffer)) marks)) + (setq marks (delq mark marks)) + (setcar mark to-article) + (push mark to-marks)) + (forward-line 1))) ;; Now we know what the read articles are and what the ;; article marks are. We transform the information ;; into the Gnus info format. (setq to-reads (gnus-range-add - (gnus-compress-sequence (sort to-reads '<) t) + (gnus-compress-sequence + (and (setq to-reads (delq nil to-reads)) + (sort to-reads '<)) + t) (cons 1 (1- (car to-active))))) (gnus-info-set-read info to-reads) ;; Do the marks. I'm sure y'all understand what's @@ -142,7 +154,8 @@ Update the .newsrc.eld file to reflect the change of nntp server." (cons article (cdr a))))) (setq a lists) (while a - (setcdr (car a) (gnus-compress-sequence (sort (cdar a) '<))) + (setcdr (car a) (gnus-compress-sequence + (and (cdar a) (sort (cdar a) '<)))) (pop a)) (gnus-info-set-marks info lists t))))) (gnus-message 7 "Translating %s...done" group)))