Importing Pterodactyl Gnus v0.96.
[elisp/gnus.git-] / lisp / nnsoup.el
index 6eb1a02..031c0ac 100644 (file)
@@ -1,7 +1,7 @@
 ;;; nnsoup.el --- SOUP access for Gnus
-;; Copyright (C) 1995,96,97,98 Free Software Foundation, Inc.
+;; Copyright (C) 1995,96,97,98,99 Free Software Foundation, Inc.
 
-;; Author: Lars Magne Ingebrigtsen <larsi@ifi.uio.no>
+;; Author: Lars Magne Ingebrigtsen <larsi@gnus.org>
 ;;     Masanobu UMEDA <umerin@flab.flab.fujitsu.junet>
 ;; Keywords: news, mail
 
 (defvoo nnsoup-directory "~/SOUP/"
   "*SOUP packet directory.")
 
-(defvoo nnsoup-tmp-directory "/tmp/"
+(defvoo nnsoup-tmp-directory
+    (cond ((fboundp 'temp-directory) (temp-directory))
+         ((boundp 'temporary-file-directory) temporary-file-directory)
+         ("/tmp/"))
   "*Where nnsoup will store temporary files.")
 
 (defvoo nnsoup-replies-directory (concat nnsoup-directory "replies/")
@@ -70,8 +73,8 @@ The SOUP packet file name will be inserted at the %s.")
   "*Regular expression matching SOUP packets in `nnsoup-packet-directory'.")
 
 (defvoo nnsoup-always-save t
-  "If non nil commit the reply buffer on each message send. 
-This is necessary if using message mode outside Gnus with nnsoup as a 
+  "If non nil commit the reply buffer on each message send.
+This is necessary if using message mode outside Gnus with nnsoup as a
 backend for the messages.")
 
 \f
@@ -376,7 +379,7 @@ backend for the messages.")
             (or force
                 nnsoup-group-alist-touched))
     (setq nnsoup-group-alist-touched nil)
-    (nnheader-temp-write nnsoup-active-file
+    (with-temp-file nnsoup-active-file
       (gnus-prin1 `(setq nnsoup-group-alist ',nnsoup-group-alist))
       (insert "\n")
       (gnus-prin1 `(setq nnsoup-current-prefix ,nnsoup-current-prefix))
@@ -417,7 +420,7 @@ backend for the messages.")
          (while (setq area (pop areas))
            ;; Change the name to the permanent name and move the files.
            (setq cur-prefix (nnsoup-next-prefix))
-           (message "Incorporating file %s..." cur-prefix)
+           (nnheader-message 5 "Incorporating file %s..." cur-prefix)
            (when (file-exists-p
                   (setq file (concat nnsoup-tmp-directory
                                      (gnus-soup-area-prefix area) ".IDX")))
@@ -530,7 +533,7 @@ backend for the messages.")
        (when (file-exists-p (concat nnsoup-directory file))
          (save-excursion               ; Load the file.
            (set-buffer (get-buffer-create buffer-name))
-           (buffer-disable-undo (current-buffer))
+           (buffer-disable-undo)
            (push (cons nnsoup-current-group (current-buffer)) nnsoup-buffers)
            (nnheader-insert-file-contents (concat nnsoup-directory file))
            (current-buffer))))))
@@ -548,13 +551,13 @@ backend for the messages.")
                  nnsoup-packet-directory t nnsoup-packet-regexp))
        packet)
     (while (setq packet (pop packets))
-      (message "nnsoup: unpacking %s..." packet)
+      (nnheader-message 5 "nnsoup: unpacking %s..." packet)
       (if (not (gnus-soup-unpack-packet
                nnsoup-tmp-directory nnsoup-unpacker packet))
-         (message "Couldn't unpack %s" packet)
+         (nnheader-message 5 "Couldn't unpack %s" packet)
        (delete-file packet)
        (nnsoup-read-areas)
-       (message "Unpacking...done")))))
+       (nnheader-message 5 "Unpacking...done")))))
 
 (defun nnsoup-narrow-to-article (article &optional area head)
   (let* ((area (or area (nnsoup-article-to-area article nnsoup-current-group)))
@@ -618,7 +621,7 @@ backend for the messages.")
   "Make an outbound package of SOUP replies."
   (interactive)
   (unless (file-exists-p nnsoup-replies-directory)
-    (message "No such directory: %s" nnsoup-replies-directory))
+    (nnheader-message 5 "No such directory: %s" nnsoup-replies-directory))
   ;; Write all data buffers.
   (gnus-soup-save-areas)
   ;; Write the active file.
@@ -666,8 +669,6 @@ backend for the messages.")
   (require 'mail-utils)
   (let ((tembuf (generate-new-buffer " message temp"))
        (case-fold-search nil)
-       (real-header-separator mail-header-separator)
-       (mail-header-separator "")
        delimline
        (mailbuf (current-buffer)))
     (unwind-protect
@@ -693,15 +694,11 @@ backend for the messages.")
            ;; Change header-delimiter to be what sendmail expects.
            (goto-char (point-min))
            (re-search-forward
-            (concat "^" (regexp-quote real-header-separator) "\n"))
+            (concat "^" (regexp-quote mail-header-separator) "\n"))
            (replace-match "\n")
            (backward-char 1)
            (setq delimline (point-marker))
-           ;; Insert an extra newline if we need it to work around
-           ;; Sun's bug that swallows newlines.
            (goto-char (1+ delimline))
-           (when (eval message-mailer-swallows-blank-line)
-             (newline))
            (let ((msg-buf
                   (gnus-soup-store
                    nnsoup-replies-directory
@@ -716,7 +713,7 @@ backend for the messages.")
                    (incf num))
                  (when nnsoup-always-save
                    (save-buffer)))
-               (message "Stored %d messages" num)))
+               (nnheader-message 5 "Stored %d messages" num)))
            (nnsoup-write-replies)
            (kill-buffer tembuf))))))
 
@@ -752,9 +749,8 @@ backend for the messages.")
                                 (string-to-int (match-string 1 f2)))))))
        active group lines ident elem min)
     (set-buffer (get-buffer-create " *nnsoup work*"))
-    (buffer-disable-undo (current-buffer))
     (while files
-      (message "Doing %s..." (car files))
+      (nnheader-message 5 "Doing %s..." (car files))
       (erase-buffer)
       (nnheader-insert-file-contents (car files))
       (goto-char (point-min))
@@ -779,7 +775,7 @@ backend for the messages.")
                      (vector ident group "ncm" "" lines))))
        (setcdr (cadr elem) (+ min lines)))
       (setq files (cdr files)))
-    (message "")
+    (nnheader-message 5 "")
     (setq nnsoup-group-alist active)
     (nnsoup-write-active-file t)))