;ELC ;;; compiled by jwz@thalidomide on Fri Jan 7 23:03:29 1994 ;;; from file /th/jwz/emacs19/lisp/gnus/old-nntp.el ;;; emacs version 19.9 Lucid (beta13). ;;; 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.")) (defvar nntp-server-hook nil "\ *Hooks for the NNTP server. If the kanji code of the NNTP server is different from the local kanji code, the correct kanji code of the buffer associated with the NNTP server must be specified as follows: (setq nntp-server-hook (function (lambda () ;; Server's Kanji code is EUC (NEmacs hack). (make-local-variable 'kanji-fileio-code) (setq kanji-fileio-code 0)))) If you'd like to change something depending on the server in this hook, use the variable `nntp-server-name'.") (defvar nntp-large-newsgroup 50 "\ *The number of the articles which indicates a large newsgroup. If the number of the articles is greater than the value, verbose messages will be shown to indicate the current status.") (defvar nntp-buggy-select (memq system-type '(usg-unix-v fujitsu-uts)) "\ *T if your select routine is buggy. If the select routine signals error or fall into infinite loop while waiting for the server response, the variable must be set to t. In case of Fujitsu UTS, it is set to T since `accept-process-output' doesn't work properly.") (defvar nntp-maximum-request 200 "\ *The maximum number of the requests sent to the NNTP server at one time. If Emacs hangs up while retrieving headers, set the variable to a lower value.") (defvar nntp-debug-read 10000 "\ *Display '...' every 10Kbytes of a message being received if it is non-nil. If it is a number, dots are displayed per the number.") (defconst nntp-version "NNTP 3.12" "\ Version numbers of this version of NNTP.") (defvar nntp-server-name nil "\ The name of the host running NNTP server.") (defvar nntp-server-buffer nil "\ Buffer associated with NNTP server process.") (defvar nntp-server-process nil "\ The NNTP server process. You'd better not use this variable in NNTP front-end program but instead use `nntp-server-buffer'.") (defvar nntp-status-string nil "\ Save the server response message. You'd better not use this variable in NNTP front-end program but instead call function `nntp-status-message' to get status message.") (fset 'nntp-header-number '(macro . #[(header) " E" [aref header 0] 3 "\ Return article number in HEADER."])) (fset 'nntp-set-header-number '(macro . #[(header number) " F" [aset header 0 number] 4 "\ Set article number of HEADER to NUMBER."])) (fset 'nntp-header-subject '(macro . #[(header) " E" [aref header 1] 3 "\ Return subject string in HEADER."])) (fset 'nntp-set-header-subject '(macro . #[(header subject) " F" [aset header 1 subject] 4 "\ Set article subject of HEADER to SUBJECT."])) (fset 'nntp-header-from '(macro . #[(header) " E" [aref header 2] 3 "\ Return author string in HEADER."])) (fset 'nntp-set-header-from '(macro . #[(header from) " F" [aset header 2 from] 4 "\ Set article author of HEADER to FROM."])) (fset 'nntp-header-xref '(macro . #[(header) " E" [aref header 3] 3 "\ Return xref string in HEADER."])) (fset 'nntp-set-header-xref '(macro . #[(header xref) " F" [aset header 3 xref] 4 "\ Set article xref of HEADER to xref."])) (fset 'nntp-header-lines '(macro . #[(header) " E" [aref header 4] 3 "\ Return lines in HEADER."])) (fset 'nntp-set-header-lines '(macro . #[(header lines) " F" [aset header 4 lines] 4 "\ Set article lines of HEADER to LINES."])) (fset 'nntp-header-date '(macro . #[(header) " E" [aref header 5] 3 "\ Return date in HEADER."])) (fset 'nntp-set-header-date '(macro . #[(header date) " F" [aset header 5 date] 4 "\ Set article date of HEADER to DATE."])) (fset 'nntp-header-id '(macro . #[(header) " E" [aref header 6] 3 "\ Return Id in HEADER."])) (fset 'nntp-set-header-id '(macro . #[(header id) " F" [aset header 6 id] 4 "\ Set article Id of HEADER to ID."])) (fset 'nntp-header-references '(macro . #[(header) " E" [aref header 7] 3 "\ Return references (or in-reply-to) in HEADER."])) (fset 'nntp-set-header-references '(macro . #[(header ref) " F" [aset header 7 ref] 4 "\ Set article references of HEADER to REF."])) (fset 'nntp-retrieve-headers #[(sequence) "q \nGeÉĉĉ \n   \n\n@\"\nAT\nUc b#Tr`WDVڦU_\" @db#!dZb! qV!eb#؉#qV!ebm!{! {\ny  mg>!{Ôf010\"1 0\"1 0\"10\"1!0\"10\"10\" 1*y     \n   \n & B ySVڦU_\"V! ." [nntp-server-buffer erase-buffer sequence 0 nil references date lines xref from message-id subject article headers count received last-point number nntp-send-strings-to-server "HEAD" nntp-maximum-request accept-process-output re-search-forward "^[0-9]" t nntp-large-newsgroup 20 gnus-lazy-message "NNTP: Receiving headers... %d%%" 100 nntp-accept-response re-search-backward looking-at "^[23]" 3 "^\\. $" message "NNTP: Receiving headers... done" "\\( ?\n[ ]+\\)+" replace-match " " "NNTP: Parsing headers..." "^[23][0-9][0-9][ ]+\\([0-9]+\\)[ ]+\\(<[^>]+>\\)" string-to-int 1 2 (50 51) "\\(From\\|Subject\\|Date\\|Lines\\|Xref\\|References\\|In-Reply-To\\):[ ]+\\([^ \n]+.*\\) $" c s char-equal 70 83 68 76 88 82 73 "(None)" "(Unknown User)" vector "NNTP: Parsing headers... %d%%" "NNTP: Parsing headers... done"] 13 "\ 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 'nntp-open-server #[(host &optional service) "!\"!\" \"  *" [host getenv "NNTPSERVER" nil status "" nntp-status-string nntp-open-server-internal service nntp-wait-for-response "^[23].* $" nntp-send-command "^.* $" "mode reader" set-process-sentinel nntp-server-process nntp-default-sentinel nntp-close-server-internal "NNTP server is not specified."] 3 "\ 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 'nntp-close-server #[nil " != \" \")" [((nntp-close-server-internal)) nntp-server-process nntp-default-sentinel process-sentinel set-process-sentinel nil nntp-server-opened nntp-send-command "QUIT"] 3 "\ Close news server."]) (byte-code "KM" [nntp-request-quit nntp-close-server] 2) (fset 'nntp-server-opened #[nil "!>" [nntp-server-process process-status (open run)] 2 "\ Return server process status, T or NIL. If the stream is opened, return T, otherwise return NIL."]) (fset 'nntp-status-message #[nil "\"ÔÕOć" [nntp-status-string string-match "[0-9][0-9][0-9][ ]+\\([^ ]*\\).*$" 1 ""] 3 "\ Return server status response as string."]) (fset 'nntp-request-article #[(id) " # " [nntp-send-command "^\\. $" "ARTICLE" id nntp-decode-text] 4 "\ Select article by message ID (or number)."]) (fset 'nntp-request-body #[(id) " # " [nntp-send-command "^\\. $" "BODY" id nntp-decode-text] 4 "\ Select article body by message ID (or number)."]) (fset 'nntp-request-head #[(id) " # " [nntp-send-command "^\\. $" "HEAD" id nntp-decode-text] 4 "\ Select article head by message ID (or number)."]) (fset 'nntp-request-stat #[(id) " #" [nntp-send-command "^[23].* $" "STAT" id] 4 "\ Select article by message ID (or number)."]) (fset 'nntp-request-group #[(group) " #" [nntp-send-command "^[23].*$" "GROUP" group] 4 "\ Select news GROUP."]) (fset 'nntp-request-list #[nil "\" " [nntp-send-command "^\\. $" "LIST" nntp-decode-text] 3 "\ List active newsgroups."]) (fset 'nntp-request-list-newsgroups #[nil "\" " [nntp-send-command "^\\. $" "LIST NEWSGROUPS" nntp-decode-text] 3 "\ List newsgroups (defined in NNTP2)."]) (fset 'nntp-request-list-distributions #[nil "\" " [nntp-send-command "^\\. $" "LIST DISTRIBUTIONS" nntp-decode-text] 3 "\ List distributions (defined in NNTP2)."]) (fset 'nntp-request-last #[nil "\"" [nntp-send-command "^[23].* $" "LAST"] 3 "\ Set current article pointer to the previous article in the current news group."]) (fset 'nntp-request-next #[nil "\"" [nntp-send-command "^[23].* $" "NEXT"] 3 "\ Advance current article pointer."]) (fset 'nntp-request-post #[nil "!\"! !ed\"!!!" [message "NNTP: awaiting POST connection..." nntp-send-command "^[23].* $" "POST" "NNTP: got POST connection; encoding text..." nntp-encode-text "NNTP: got POST connection; sending text..." nntp-send-region-to-server "NNTP: text sent; awaiting response..." nntp-wait-for-response "^[23].*$" "NNTP: post complete."] 3 "\ Post a new news in current buffer."]) (fset 'nntp-default-sentinel #[(proc status) " ?!" [nntp-server-process nntp-server-opened error "NNTP: Connection closed."] 2 "\ Default sentinel function for NNTP server process."]) (fset 'nntp-decode-text #[nil "qdbnceb`y`|mhU!yldby!`y`|eb#!s)" [nntp-server-buffer "\n" 1 nil 13 delete-char -1 looking-at "^\\.$" search-forward "\n.." t] 4 "\ Decode text transmitted by NNTP. 0. Delete status line. 1. Delete `^M' at end of line. 2. Delete `.' at end of buffer (end of text mark). 3. Delete `.' at beginning of line."]) (fset 'nntp-encode-text #[nil "dbnceb#ctdbc)" ["\n" search-forward "\n." nil t "." ". \n"] 4 "\ Encode text in current buffer for NNTP transmission. 1. Insert `.' at beginning of line. 2. Insert `.' at end of buffer (end of text mark)."]) (fset 'nntp-send-command #[(response cmd &rest args) "q #!)" [nntp-server-buffer erase-buffer apply nntp-send-strings-to-server cmd args response nntp-wait-for-response t] 4 "\ Wait for server RESPONSE after sending CMD and optional ARGS to server."]) (fset 'nntp-wait-for-response #[(regexp) " q eb!ljq!lje _e`{ \n dby !ljm ͥVѪ\") Q!+" [t wait status nntp-server-buffer nntp-accept-response looking-at "[23]" nil "[45]" nntp-status-string -1 regexp buffer-size 1024 k gnus-lazy-message 0 "NNTP: Reading (%sk)..." "NNTP: Reading..." message] 4 "\ Wait for server response which matches REGEXP."]) (fset 'nntp-send-strings-to-server #[(&rest strings) "@A @QAt P\"*" [strings cmd " " process-send-string nntp-server-process " \n"] 5 "\ Send list of STRINGS to news server as command and its arguments."]) (fset 'nntp-send-region-to-server #[(begin end) " \n # qed \nZ\n\n }\nbm\n_\"\n\\\n `\\^bmu`)` # bK-\n |)" [copy-to-buffer nntp-server-buffer begin end nil last 100 size total 0 sent gnus-lazy-message "NNTP: got POST connection; sending text...%d%%" 1 process-send-region nntp-server-process accept-process-output] 4 "\ Send current buffer region (from BEGIN to END) to news server."]) (fset 'nntp-open-server-internal #[(host &optional service) "!!!qp!  p $ !!)" [fboundp open-network-stream require tcp get-buffer-create " *nntpd*" nntp-server-buffer buffer-disable-undo erase-buffer kill-all-local-variables t case-fold-search "nntpd" host service "nntp" nntp-server-process nntp-server-name run-hooks nntp-server-hook process-kill-without-query] 6 "\ Open connection to news server on HOST by SERVICE (default is nntp)."]) (fset 'nntp-close-server-internal #[nil "!\n\n!ĉ" [nntp-server-process delete-process nntp-server-buffer kill-buffer nil] 2 "\ Close connection to news server."]) (fset 'nntp-accept-response #[nil " !>! !!!Ώ" [process-status nntp-server-process (open run) error "NNTP: Connection closed." nntp-buggy-select gnus-lazy-message "NNTP: Reading..." sleep-for 1 message "" errorcode (accept-process-output nntp-server-process) ((error (byte-code "A@‡@A\"" [errorcode "select error: Invalid argument" nil signal] 3)))] 3 "\ Read response of server. It is well-known that the communication speed will be much improved by defining this function as macro."]) (provide 'nntp)