This commit was generated by cvs2svn to compensate for changes in r473,
[elisp/tm.git] / gnus / gnus-charset.el
index 561adc9..0d008af 100644 (file)
@@ -5,7 +5,7 @@
 ;; Author: MORIOKA Tomohiko <morioka@jaist.ac.jp>
 ;; Created: 1996/8/6
 ;; Version:
-;;     $Id: gnus-charset.el,v 0.2 1996/08/12 09:06:54 morioka Exp $
+;;     $Id: gnus-charset.el,v 0.6 1996/08/22 17:51:22 morioka Exp $
 ;; Keywords: news, MIME, multimedia, multilingual, encoded-word
 
 ;; This file is not part of GNU Emacs yet.
 ;; General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with This program.  If not, write to the Free Software
-;; Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+;; along with this program; see the file COPYING.  If not, write to
+;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+;; Boston, MA 02111-1307, USA.
 
 ;;; Code:
 
-(defvar running-xemacs (string-match "XEmacs" emacs-version))
-(defvar running-xemacs-20 (and running-xemacs
-                              (= emacs-major-version 20)))
+(require 'gnus)
 
 
 ;;; @ newsgroup default charset
 
 (defun gnus-set-newsgroup-default-charset (newsgroup charset)
   "Set CHARSET for the NEWSGROUP as default MIME charset."
-  (set-alist 'gnus-newsgroup-default-charset-alist
-            (concat "^" (regexp-quote newsgroup) "\\($\\|\\.\\)")
-            charset))
+  (let* ((ng-regexp (concat "^" (regexp-quote newsgroup) "\\($\\|\\.\\)"))
+        (pair (assoc ng-regexp gnus-newsgroup-default-charset-alist))
+        )
+    (if pair
+       (setcdr pair charset)
+      (setq gnus-newsgroup-default-charset-alist
+           (cons (cons ng-regexp charset)
+                 gnus-newsgroup-default-charset-alist))
+      )))
 
 
 ;;; @ for mule (Multilingual support)
 
 (cond
  ((featurep 'mule)
-  (cond ((boundp 'MULE) ; for MULE 1.* and 2.*.
-        (defun gnus-set-nntp-coding-system ()
-          (define-service-coding-system gnus-nntp-service nil *noconv*)
-          )
-        (add-hook 'gnus-open-server-hook 'gnus-set-nntp-coding-system)
-        )
-       (running-xemacs-20
-        (or (boundp '*noconv*)
-            (defconst *noconv* 'noconv)
-            )))
+  (require 'emu)
+  (defvar nntp-open-binary-connection-function
+    (if (featurep 'gnus-load)
+       ;; maybe Red Gnus
+       (if (boundp 'nntp-open-connection-function)
+           nntp-open-connection-function
+         'nntp-open-network-stream)
+      ;; maybe Gnus 5.[01] or Gnus 5.[23]
+      (if (boundp 'nntp-open-server-function)
+         nntp-open-server-function
+       'nntp-open-network-stream)
+      ))
+  (defun nntp-open-network-stream-with-no-code-conversion (&rest args)
+    (let ((proc (apply nntp-open-binary-connection-function args)))
+      (set-process-input-coding-system proc *noconv*)
+      proc))
+  (if (featurep 'gnus-load)
+      (setq nntp-open-connection-function
+           'nntp-open-network-stream-with-no-code-conversion)
+    (setq nntp-open-server-function
+         'nntp-open-network-stream-with-no-code-conversion)
+    )
   (call-after-loaded
    'nnheader
    (lambda ()
@@ -75,7 +92,7 @@
    'nnmail
    (lambda ()
      (defun nnmail-find-file (file)
-       "Insert FILE in server buffer safely. [tm-gnus5.el]"
+       "Insert FILE in server buffer safely. [gnus-charset.el]"
        (set-buffer nntp-server-buffer)
        (erase-buffer)
        (let ((format-alist nil)