;;; compiled by roland@geech.gnu.ai.mit.edu on Sun May 16 22:36:54 1993
;;; from file /gd/gnu/emacs/19.0/lisp/mhspool.el
;;; emacs version 19.6.3.
;;; bytecomp version FSF 2.08
;;; optimization is on.

(require (quote nntp))
(defvar mhspool-list-folders-method (quote mhspool-list-folders-using-sh) "\
*Function to list files in folders.
The function should accept a directory as its argument, and fill the
current buffer with file and directory names.  The output format must
be the same as that of 'ls -R1'.  Two functions
mhspool-list-folders-using-ls and mhspool-list-folders-using-sh are
provided now.  I suppose the later is faster.")
(defvar mhspool-list-directory-switches (quote ("-R")) "\
*Switches for mhspool-list-folders-using-ls to pass to `ls' for gettting file lists.
One entry should appear on one line. You may need to add `-1' option.")
(defconst mhspool-version "MHSPOOL 1.8" "\
Version numbers of this version of MHSPOOL.")
(defvar mhspool-spool-directory "~/Mail" "\
Private mail directory.")
(defvar mhspool-current-directory nil "\
Current news group directory.")
(defalias 'mhspool-retrieve-headers #[(sequence) "q\nG	\n\n\n@!P!k!k !eb#e`\"eb#p ܉#_ ebceb# ` `)\" eb# ` `)\"\n \neb# ` `)\"	 	eb# ` `)\" eb# ` `)\"!db `d\")eb#&` `)\")eb#<#I` `)\"Kk	k\n	&B\nAT1!' 1V' \"U' \"\"\"' 1!1V!!." [nntp-server-buffer nil sequence 0 references date lines xref from message-id subject article headers count number file mhspool-current-directory prin1-to-string file-exists-p file-directory-p erase-buffer insert-file-contents search-forward "\n\n" move narrow-to-region re-search-forward "\\(?\n[ 	]+\\)+" t replace-match " " "\n" "\nFrom: " buffer-substring end-of-line "(Unknown User)" "\nSubject: " "(None)" "\nMessage-ID: " "\nDate: " "\nLines: " string-to-int widen count-lines "\nXref: " "\nReferences: " "\nIn-Reply-To: " vector numberp nntp-large-newsgroup % 20 message "MHSPOOL: Receiving headers... %d%%" / * 100 "MHSPOOL: Receiving headers... done" nreverse] 12 "\
Return list of article headers specified by SEQUENCE of article id.
The format of list is
 `([NUMBER SUBJECT FROM XREF LINES DATE MESSAGE-ID REFERENCES] ...)'.
If there is no References: field, In-Reply-To: field is used instead.
Reader macros for the vector are defined as `nntp-header-FIELD'.
Writer macros for the vector are defined as `nntp-set-header-FIELD'.
Newsgroup must be selected before calling this."])
(defalias 'mhspool-open-server #[(host &optional service) " !\") !!O\"\"! , ;R ;R !R  \"R \"t  \"d \"t n t \"*" [host getenv "NNTPSERVER" nil status string-match ":\\(.+\\)$" file-name-as-directory expand-file-name match-beginning 1 match-end "~/" mhspool-spool-directory system-name "" nntp-status-string file-directory-p string-equal mhspool-open-server-internal service format "No such directory: %s.  Goodbye." "NNTP server is not specified." "MHSPOOL: cannot talk to %s."] 6 "\
Open news server on HOST.
If HOST is nil, use value of environment variable `NNTPSERVER'.
If optional argument SERVICE is non-nil, open by the service name."])
(defalias 'mhspool-close-server #[nil " " [mhspool-close-server-internal] 1 "\
Close news server."])
(byte-code "KM" [mhspool-request-quit mhspool-close-server] 2)
(defalias 'mhspool-server-opened #[nil " !" [nntp-server-buffer get-buffer] 2 "\
Return server process status, T or NIL.
If the stream is opened, return T, otherwise return NIL."])
(defun mhspool-status-message nil "\
Return server status response as string." nntp-status-string)
(defalias 'mhspool-request-article #[(id) "\n!P; ! !? !))" [mhspool-current-directory prin1-to-string id file file-exists-p file-directory-p mhspool-find-file] 4 "\
Select article by message ID (or number)."])
(defalias 'mhspool-request-body #[(id) "	! \nqeb# e`\")Ƈ" [mhspool-request-article id nntp-server-buffer search-forward "\n\n" nil t delete-region] 4 "\
Select article body by message ID (or number)."])
(defalias 'mhspool-request-head #[(id) "	! \nqeb# `Sd\")Ƈ" [mhspool-request-article id nntp-server-buffer search-forward "\n\n" nil t delete-region] 4 "\
Select article head by message ID (or number)."])
(defalias 'mhspool-request-stat #[(id) "" ["MHSPOOL: STAT is not implemented." nntp-status-string nil] 1 "\
Select article by message ID (or number)."])
(defalias 'mhspool-request-group #[(group) "\n!! \n!\n#!!# \n#!" [file-directory-p mhspool-article-pathname group mhspool-current-directory mhspool-replace-chars-in-string 46 47] 6 "\
Select news GROUP."])
(defalias 'mhspool-request-list #[nil "\"!!Q\n!q q !eb\n# !!\"#!mr !r !k !!\"!\nB!N \n2 	\n\"\n\"$\"2 !q ." [nil newsgroup articles file-name-as-directory expand-file-name mhspool-spool-directory directory "^" regexp-quote "\\(.+\\):$" folder-regexp get-buffer-create " *MHSPOOL File List*" buffer nntp-server-buffer erase-buffer mhspool-list-folders-method re-search-forward t mhspool-replace-chars-in-string buffer-substring match-beginning 1 match-end 47 46 forward-line looking-at "^$" "^[0-9]+$" string-to-int 0 princ format "%s %d %d n\n" apply max min kill-buffer buffer-size] 8 "\
List active newsgoups."])
(defalias 'mhspool-request-list-newsgroups #[nil "" ["MHSPOOL: LIST NEWSGROUPS is not implemented." nntp-status-string nil] 1 "\
List newsgoups (defined in NNTP2)."])
(defalias 'mhspool-request-list-distributions #[nil "" ["MHSPOOL: LIST DISTRIBUTIONS is not implemented." nntp-status-string nil] 1 "\
List distributions (defined in NNTP2)."])
(defalias 'mhspool-request-last #[nil "" ["MHSPOOL: LAST is not implemented." nntp-status-string nil] 1 "\
Set current article pointer to the previous article
in the current news group."])
(defalias 'mhspool-request-next #[nil "" ["MHSPOOL: NEXT is not implemented." nntp-status-string nil] 1 "\
Advance current article pointer."])
(defalias 'mhspool-request-post #[nil "" ["MHSPOOL: POST: what do you mean?" nntp-status-string nil] 1 "\
Post a new news in current buffer."])
(defalias 'mhspool-open-server-internal #[(host &optional service) "	 \" 	\"!qp!  	!)ˇ" [string-equal host system-name error "MHSPOOL: cannot talk to %s." get-buffer-create " *nntpd*" nntp-server-buffer buffer-flush-undo erase-buffer kill-all-local-variables t case-fold-search nil nntp-server-process nntp-server-name run-hooks nntp-server-hook] 4 "\
Open connection to news server on HOST by SERVICE (default is nntp)."])
(defalias 'mhspool-close-server-internal #[nil " !" [nntp-server-buffer kill-buffer nil nntp-server-process] 2 "\
Close connection to news server."])
(defalias 'mhspool-find-file #[(file) "q ď" [nntp-server-buffer erase-buffer nil (byte-code "	!eb# `d\"\" !Ň" [insert-file-contents file search-forward "\n\n" nil t string-equal buffer-substring "" delete-char 1] 4) ((file-error))] 3 "\
Insert FILE in server buffer safely."])
(defalias 'mhspool-article-pathname #[(group) "	!\nQ" [file-name-as-directory mhspool-spool-directory group "/"] 3 "\
Make pathname for GROUP."])
(defalias 'mhspool-replace-chars-in-string #[(string from to) "OGW% HU IT +" [string 0 nil idx len from to] 4 "\
Replace characters in STRING from FROM to TO."])
(defalias 'mhspool-list-folders-using-ls #[(directory) "C\"&" [apply call-process "ls" nil t append mhspool-list-directory-switches directory] 9 "\
List files in folders under DIRECTORY using 'ls'."])
(defalias 'mhspool-list-folders-using-sh #[(directory) "p!\nq ccced&*\n!*" [get-buffer-create " *MHSPOOL Shell Script Buffer*" script buffer erase-buffer "PS2=\n          ffind() {\n		cd $1; echo $1:\n		ls -1\n		echo\n		for j in `echo *[a-zA-Z]*`\n		do\n		  if [ -d $1/$j ]; then\n			ffind $1/$j\n		  fi\n		done\n	  }\n	  cd " directory "; ffind `pwd`; exit 0\n" call-process-region "sh" nil kill-buffer] 7 "\
List files in folders under DIRECTORY using '/bin/sh'."])
(provide (quote mhspool))
