From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/5452 Path: main.gmane.org!not-for-mail From: "d. hall" Newsgroups: gmane.emacs.gnus.general Subject: TEMP fix for POP3 auth Date: Tue, 5 Mar 1996 01:58:06 -0500 Message-ID: <199603050658.BAA00633@illusion.apk.net> NNTP-Posting-Host: coloc-standby.netfonds.no Mime-Version: 1.0 (generated by tm-edit 7.43) boundary="Multipart_Tue_Mar__5_01:49:20_1996-1" Content-Type: text/plain; charset=US-ASCII X-Trace: main.gmane.org 1035146054 382 80.91.224.250 (20 Oct 2002 20:34:14 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Sun, 20 Oct 2002 20:34:14 +0000 (UTC) Return-Path: ding-request@ifi.uio.no Original-Received: from ifi.uio.no (ifi.uio.no [129.240.64.2]) by deanna.miranova.com (8.7.3/8.6.9) with SMTP id XAA28666 for ; Mon, 4 Mar 1996 23:25:03 -0800 Original-Received: from illusion.apk.net (dhall@mentor-dial-9.apk.net [206.21.40.38]) by ifi.uio.no with ESMTP (8.6.11/ifi2.4) id for ; Tue, 5 Mar 1996 08:01:32 +0100 Original-Received: (from dhall@localhost) by illusion.apk.net (8.6.12/8.6.9) id BAA00633; Tue, 5 Mar 1996 01:58:06 -0500 Original-To: Gnus List Gcc: nnfolder:folder.archive Xref: main.gmane.org gmane.emacs.gnus.general:5452 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:5452 --Multipart_Tue_Mar__5_01:49:20_1996-1 Content-Type: text/plain; charset=US-ASCII The following small snippet of emacs-lisp creates an asynch process via popclient (by Carl Harris) to allow POP3 auth. I have a synchronous (open-network-stream) emacs-lisp function in the works for people who don't have popclient available, unfortunately I don't have any specifications for the POP3 protocal, so I've just been emulating popclient's reactions. A couple notes: Yes, I copied ange-ftp's password function (I still think a password function should be a intrinsic byte-compiled emacs function which "secures" the X server) since I'm going to add a secure to the function. I'm still trying to decipher's ange-ftp's ability to cache the password while keeping it "directly" unreadable. For an example I have as my retrieve-error-hook (add-hook 'retrieve-error-hook 'retrieve-message-error) (defun retrieve-message-error () (message "Houston, we have a problem.") (wav-fx-play "houston.wav" 0.5)) --Multipart_Tue_Mar__5_01:49:20_1996-1 Content-Type: application/octet-stream; type=emacs-lisp Content-Disposition: attachment; filename="retrieve.el" Content-Transfer-Encoding: 7bit (defun retrieve-read-passwd (prompt &optional default) "\ Read a password, echoing `.' for each character typed. End with a RET, LFD, or ESC. DEL or C-h rubs out. C-u kills line. Optional DEFAULT is password to start with." (let ((pass (if default default "")) (c 0) (echo-keystrokes 0) (cursor-in-echo-area t)) (while (progn (message "%s%s" prompt (make-string (length pass) ?.)) (setq c (read-char)) (and (/= c ?\r) (/= c ?\n) (/= c ?\e))) (cond ((= c ?\C-u) (setq pass "")) ((if (and (/= c ?\b) (/= c ?\177)) (setq pass (concat pass (char-to-string c))))) ((if (> (length pass) 0) (setq pass (substring pass 0 -1)))))) (message "") (message nil) pass)) (defvar retrieve-user nil "\ *The login name of the user. Got from the function `user-login-name' if undefined.") (defvar retrieve-default-passwd nil "\ *The password for the POP3 server. Got from the user if undefined.") (defvar retrieve-default-host "pop" "\ Specify a default POP3 server. This variable can be defined in paths.el, and really should not be set by the user.") (defvar retrieve-default-spool-file nil "\ Where the output of the POP3 mail will be placed. This variable is \"/usr/spool/mail/$user\" by default.") (defvar retrieve-mail-received-hook nil) (defvar retrieve-no-mail-received-hook nil) (defvar retrieve-passwd-invalid-hook nil) (defvar retrieve-error-hook nil) (defun retrieve-mail () (interactive) (let ((user (or retrieve-user (user-login-name))) (host retrieve-default-host) (file (or retrieve-default-spool-file (getenv "MAIL") (concat rmail-spool-directory (user-login-name)))) (proc nil)) (save-excursion (setq retrieve-default-passwd (or retrieve-default-passwd (retrieve-read-passwd "Enter your password: "))) (setq proc (start-process "retrieve" "*retrieve*" "popclient" "-3" "-v" "-u" user "-o" file host)) (set-process-filter proc 'retrieve-filter) (set-process-sentinel proc 'retrieve-sentinel)))) (defun retrieve-filter (proc stream) (unwind-protect (save-excursion (set-buffer "*retrieve*") (goto-char (point-max)) (if (string-match "assword:" stream) (process-send-string proc (concat retrieve-default-passwd "\r")) (insert stream)) ))) (defun retrieve-sentinel (proc stream) (cond ((string-match "finished\n" stream) (run-hooks 'retrieve-mail-received-hook)) ((string-match "code 1" stream) (run-hooks 'retrieve-no-mail-received-hook)) ((string-match "code [234]" stream) (run-hooks 'retrieve-passwd-invalid-hook)) (t (run-hooks 'retrieve-error-hook)))) (provide 'retrieve) --Multipart_Tue_Mar__5_01:49:20_1996-1--