* elmo-nntp.el (elmo-nntp-debug): New function.
authoryoichi <yoichi>
Sat, 5 Jul 2003 05:17:25 +0000 (05:17 +0000)
committeryoichi <yoichi>
Sat, 5 Jul 2003 05:17:25 +0000 (05:17 +0000)
(elmo-nntp-send-command, elmo-nntp-process-filter): Call it.
(elmo-network-authenticate-session): Hide auth-info from the log.

elmo/ChangeLog
elmo/elmo-nntp.el

index 84708d4..7cf5bbf 100644 (file)
@@ -1,3 +1,9 @@
+2003-07-05  Yoichi NAKAYAMA  <yoichi@geiin.org>
+
+       * elmo-nntp.el (elmo-nntp-debug): New function.
+       (elmo-nntp-send-command, elmo-nntp-process-filter): Call it.
+       (elmo-network-authenticate-session): Hide auth-info from the log.
+
 2003-06-07  Yuuichi Teranishi  <teranisi@gohome.org>
 
        * elmo-shimbun.el (elmo-shimbun-get-headers): Use shimbun-server
index 980db9c..9bce1e0 100644 (file)
       (decode-coding-string string elmo-nntp-group-coding-system)
     string))
 
+;; For debugging.
+(defvar elmo-nntp-debug nil
+  "Non-nil forces NNTP folder as debug mode.
+Debug information is inserted in the buffer \"*NNTP DEBUG*\"")
+
+;;; Debug
+(defsubst elmo-nntp-debug (message &rest args)
+  (if elmo-nntp-debug
+      (let ((biff (string-match "BIFF-" (buffer-name)))
+           pos)
+       (with-current-buffer (get-buffer-create (concat "*NNTP DEBUG*"
+                                                       (if biff "BIFF")))
+         (goto-char (point-max))
+         (setq pos (point))
+         (insert (apply 'format message args) "\n")))))
+
 ;;; ELMO NNTP folder
 (eval-and-compile
   (luna-define-class elmo-nntp-folder (elmo-net-folder)
@@ -287,13 +303,17 @@ Don't cache if nil.")
       (elmo-nntp-send-command session
                              (format "authinfo user %s"
                                      (elmo-network-session-user-internal
-                                      session)))
+                                      session))
+                             nil
+                             'no-log)
       (or (elmo-nntp-read-response session)
          (signal 'elmo-authenticate-error '(authinfo)))
       (elmo-nntp-send-command
        session
        (format "authinfo pass %s"
-              (elmo-get-passwd (elmo-network-session-password-key session))))
+              (elmo-get-passwd (elmo-network-session-password-key session)))
+       nil
+       'no-log)
       (or (elmo-nntp-read-response session)
          (signal 'elmo-authenticate-error '(authinfo))))))
 
@@ -305,19 +325,21 @@ Don't cache if nil.")
   (save-excursion
     (set-buffer (process-buffer process))
     (goto-char (point-max))
-    (insert output)))
+    (insert output)
+    (elmo-nntp-debug "RECEIVED: %s\n" output)))
 
 (defun elmo-nntp-send-mode-reader (session)
   (elmo-nntp-send-command session "mode reader")
   (if (null (elmo-nntp-read-response session t))
       (message "Mode reader failed")))
 
-(defun elmo-nntp-send-command (session command &optional noerase)
+(defun elmo-nntp-send-command (session command &optional noerase no-log)
   (with-current-buffer (elmo-network-session-buffer session)
     (unless noerase
       (erase-buffer)
       (goto-char (point-min)))
     (setq elmo-nntp-read-point (point))
+    (elmo-nntp-debug "SEND: %s\n" (if no-log "<NO LOGGING>" command))
     (process-send-string (elmo-network-session-process-internal
                          session) command)
     (process-send-string (elmo-network-session-process-internal