;ELC ;;; compiled by jwz@thalidomide on Wed Jan 26 14:10:46 1994 ;;; from file /u/jwz/emacs19/lisp/gnus/mhspool.el ;;; emacs version 19.9 Lucid. ;;; bytecomp version 2.22; 22-dec-93. ;;; optimization is on. ;;; this file uses opcodes which do not exist in Emacs 18. (if (and (boundp 'emacs-version) (or (and (boundp 'epoch::version) epoch::version) (string-lessp emacs-version "19"))) (error "This file was compiled for Emacs 19.")) (require 'nntp) (defvar mhspool-list-folders-method '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 '("-R") "\ *Switches for mhspool-list-folders-using-ls to pass to `ls' for getting file lists. One entry should appear on one line. You may need to add `-1' option.") (defvar mhspool-retrieve-headers-method 'mhspool-retrieve-headers-using-emacs-lisp "\ *Function to retrieve headers from articles in an mhspool directory. The function accepts a list of articles to retrieve the headers from where the articles are located in the directory mhspool-current-directory. Two functions mhspool-retrieve-headers-using-emacs-lisp and mhspool-retrieve-headers-using-gnushdrs are provided now. For the latter mhspool-retrieve-headers-gnushdrs-program specifies the name of the program to execute (which see).") (defvar mhspool-retrieve-headers-gnushdrs-program "gnushdrs" "\ *The name of a program used to retrieve headers from articles when mhspool-retrieve-headers-method is set to mhspool-retrieve-headers-using-gnushdrs. The program takes a directory as it first argument and the files to retrieve articles from as the rest of its arguments. It must produce on its standard output an emacs lisp expression in the same format as the value of mhspool-retrieve-headers (which see).") (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.") (defvar mhspool-article-header-read-size 1024 "\ Number of bytes to read when processing headers from MHSPOOL.") (fset 'mhspool-retrieve-headers-by-id #[(message-id) "!" [error "Unimplemented function, sorry."] 2 "\ UNIMPLEMENTED. Should return same things mhspool-retrieve-headers does."]) (fset 'mhspool-retrieve-headers #[(sequence) " !" [mhspool-retrieve-headers-method sequence] 2 "\ 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."]) (fset 'mhspool-retrieve-headers-using-gnushdrs #[(sequence) " GV q   \"&\n!eb ! \n!+" [nntp-large-newsgroup sequence msg nntp-server-buffer erase-buffer nil process-connection-type apply call-process mhspool-retrieve-headers-gnushdrs-program t mhspool-current-directory mapcar int-to-string message "MHSPOOL: parsing headers..." read "MHSPOOL: parsing headers...done."] 10 "\ A method for mhspool-retrieve-headers that uses the program gnushdrs."]) (fset 'mhspool-retrieve-headers-using-emacs-lisp #[(sequence) "q\nG \n   \n\n@  !P!S!S $eb#e`}eb#܉#qebceb#``){eb#``){\n\neb#``){  eb#``){eb#``){!db~`d\")eb#``){eb##``){   \n  & B \nA T -'-V' U' _\"'--V! . " [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 mhspool-article-header-read-size search-forward "\n\n" move re-search-forward "\\( ?\n[ ]+\\)+" t replace-match " " "\n" "\nFrom: " "(Unknown User)" "\nSubject: " "(None)" "\nMessage-ID: " "\nDate: " "\nLines: " string-to-int count-lines "\nXref: " "\nReferences: " "\nIn-Reply-To: " vector nntp-large-newsgroup 20 message "MHSPOOL: Receiving headers... %d%%" 100 "MHSPOOL: Receiving headers... done"] 12 "\ A method for mhspool-retrieve-headers that only uses Emacs Lisp."]) (fset 'mhspool-open-server #[(host &optional service) "!\"ɔɕO\"\"!  ; ; ! \"  \"\" *" [host getenv "NNTPSERVER" nil status string-match ":\\(.+\\)$" file-name-as-directory expand-file-name 1 "~/" mhspool-spool-directory system-name "" nntp-status-string file-directory-p 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."]) (fset 'mhspool-close-server #[nil " " [mhspool-close-server-internal] 1 "\ Close news server."]) (byte-code "KM" [mhspool-request-quit mhspool-close-server] 2) (fset '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) (fset '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)."]) (fset 'mhspool-request-body #[(id) " !\nqeb#e`|)Ƈ" [mhspool-request-article id nntp-server-buffer search-forward "\n\n" nil t] 4 "\ Select article body by message ID (or number)."]) (fset 'mhspool-request-head #[(id) " !\nqeb#`Sd|)Ƈ" [mhspool-request-article id nntp-server-buffer search-forward "\n\n" nil t] 4 "\ Select article head by message ID (or number)."]) (fset 'mhspool-request-stat #[(id) "‡" ["MHSPOOL: STAT is not implemented." nntp-status-string nil] 1 "\ Select article by message ID (or number)."]) (fset '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."]) (fset 'mhspool-request-list #[nil " \"!!Q\n! q  q !eb\n#Ԕԕ{#ym!!۔ە{!\nByd\nJ \n\"\n\"$\"7 !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 1 47 46 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."]) (fset 'mhspool-request-list-newsgroups #[nil "‡" ["MHSPOOL: LIST NEWSGROUPS is not implemented." nntp-status-string nil] 1 "\ List newsgoups (defined in NNTP2)."]) (fset 'mhspool-request-list-distributions #[nil "‡" ["MHSPOOL: LIST DISTRIBUTIONS is not implemented." nntp-status-string nil] 1 "\ List distributions (defined in NNTP2)."]) (fset '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."]) (fset 'mhspool-request-next #[nil "‡" ["MHSPOOL: NEXT is not implemented." nntp-status-string nil] 1 "\ Advance current article pointer."]) (fset 'mhspool-request-post #[nil "‡" ["MHSPOOL: POST: what do you mean?" nntp-status-string nil] 1 "\ Post a new news in current buffer."]) (fset 'mhspool-open-server-internal #[(host &optional service) " \"!qp!  ! !)ʇ" [host system-name error "MHSPOOL: cannot talk to %s." get-buffer-create " *nntpd*" nntp-server-buffer buffer-disable-undo erase-buffer kill-all-local-variables t case-fold-search boundp nntp-server-process nil nntp-server-name run-hooks nntp-server-hook] 4 "\ Open connection to news server on HOST by SERVICE (default is nntp)."]) (fset 'mhspool-close-server-internal #[nil "!!‰" [nntp-server-buffer kill-buffer nil boundp nntp-server-process] 2 "\ Close connection to news server."]) (fset '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 " " delete-char 1] 4) ((file-error))] 3 "\ Insert FILE in server buffer safely."]) (fset 'mhspool-article-pathname #[(group) " !\nQ" [file-name-as-directory mhspool-spool-directory group "/"] 3 "\ Make pathname for GROUP."]) (fset 'mhspool-replace-chars-in-string #[(string from to) "OG W H U I Ti+" [string 0 nil idx len from to] 4 "\ Replace characters in STRING from FROM to TO."]) (fset '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'."]) (fset 'mhspool-list-folders-using-sh #[(directory) "p!\nq DZed &*\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 'mhspool)