;;; url-news.el --- News Uniform Resource Locator retrieval code ;; Copyright (C) 1996, 1997, 1998, 1999, 2004, ;; 2005, 2006, 2007 Free Software Foundation, Inc. ;; Keywords: comm, data, processes ;; This file is part of GNU Emacs. ;; GNU Emacs is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation; either version 3, or (at your option) ;; any later version. ;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with GNU Emacs; see the file COPYING. If not, write to the ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, ;; Boston, MA 02110-1301, USA. ;;; Code: (require 'url-vars) (require 'url-util) (require 'url-parse) (require 'nntp) (autoload 'url-warn "url") (autoload 'gnus-group-read-ephemeral-group "gnus-group") (eval-when-compile (require 'cl)) (defvar nntp-open-tls-stream) (defvar nntp-open-ssl-stream) (defgroup url-news nil "News related options." :group 'url) (defun url-news-open-host (host port user pass) (if (fboundp 'nnheader-init-server-buffer) (nnheader-init-server-buffer)) (nntp-open-server host (list port)) (if (and user pass) (progn (nntp-send-command "^.*\r?\n" "AUTHINFO USER" user) (nntp-send-command "^.*\r?\n" "AUTHINFO PASS" pass) (if (not (nntp-server-opened host)) (url-warn 'url (format "NNTP authentication to `%s' as `%s' failed" host user)))))) (defun url-news-fetch-message-id (host message-id) (let ((buf (generate-new-buffer " *url-news*"))) (if (eq ?> (aref message-id (1- (length message-id)))) nil (setq message-id (concat "<" message-id ">"))) (if (cdr-safe (nntp-request-article message-id nil host buf)) ;; Successfully retrieved the article nil (with-current-buffer buf (insert "Content-type: text/html\n\n" "\n" "
\n" "\n"
" The status message returned by the NNTP server was:"
"
\n" " If you If you feel this is an error, send mail\n" "
\n" "