Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!brutus.cs.uiuc.edu!flute!grunwald From: grunwald@flute.cs.uiuc.edu (Dirk Grunwald) Newsgroups: gnu.emacs Subject: Re: finger.el Message-ID: Date: 25 Jul 89 00:13:00 GMT References: <4341@tekcrl.LABS.TEK.COM> <116992@sun.Eng.Sun.COM> Sender: news@brutus.cs.uiuc.edu Reply-To: grunwald@flute.cs.uiuc.edu Distribution: gnu Organization: University of Illinois, Urbana-Champaign Lines: 114 In-reply-to: bob@tinman.cis.ohio-state.edu's message of 21 Jul 89 17:57:56 GMT In article bob@tinman.cis.ohio-state.edu (Bob Sutterfield) writes: In article grunwald@flute.cs.uiuc.edu (Dirk Grunwald) writes: I had also done a finger command once, and the someone pointed out that ``M-!finger user@foo'' did the same thing. Nope, these little toys make TCP connections directly from Emacs to the fingerd port on some remote machine. They don't invoke a shell and an application on your local machine. ---- too true, an too useful. I hacked finger.el around a little to give mail-verify.el, a variant of a C program I have occasion to use. It probes an SMTP mailer to verify mailing addresses. If anyone extends this or makes it more useful, please send mail. ;; Copyright (C) 1989 Free Software Foundation, if they want it ;; This file is part of GNU Emacs. ;; GNU Emacs is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY. No author or distributor ;; accepts responsibility to anyone for the consequences of using it ;; or for whether it serves any particular purpose or works at all, ;; unless he says so in writing. Refer to the GNU Emacs General Public ;; License for full details. ;; Everyone is granted permission to copy, modify and redistribute ;; GNU Emacs, but only under the conditions described in the ;; GNU Emacs General Public License. A copy of this license is ;; supposed to have been given to you along with GNU Emacs so you ;; can know your rights and responsibilities. It should be in a ;; file named COPYING. Among other things, the copyright notice ;; and this notice must be preserved on all copies. ;; ;; Author Dirk Grunwald (grunwald@cs.uiuc.edu) ;; modified from finger.el, but largely different. ;; (defvar mail-verify-stream nil) (defun mail-verify (who) "Verify mail address for users." (interactive "sVerify mail address for: ") (let (mail-query-system) (cond ((null who) (setq who "@localhost")) ((not (string-match "@" who)) (setq who (concat who "@localhost")))) (setq mail-query-system (read-string (concat "Query which mailer?: ") (substring who (1+ (string-match "@" who))))) (with-output-to-temp-buffer "*mail-verify*" (let ((stream (open-network-stream "mail-verify" "*mail-verify*" mail-query-system "smtp"))) (setq mail-verify-stream stream) (set-process-sentinel stream 'mail-verify-process-sentinel) (set-process-filter stream 'mail-verify-process-filter) (process-send-string stream (concat "VRFY " (substring who 0 (string-match "@" who)) "\n")) )))) (defun mail-verify-process-sentinel (process s) (accept-process-output) (save-excursion (set-buffer "*mail-verify*") (goto-char (point-min)) (replace-string "\C-m" ""))) (defun mail-verify-process-filter (process string) (let (( this-buffer (current-buffer))) (set-buffer "*mail-verify*") (goto-char (point-max)) (cond ((string-match "^220 " string) t) ((string-match "^221 " string) t) ((string-match "^250 " string) (progn (insert (substring string 4)) (process-send-string mail-verify-stream "QUIT\n") (process-send-eof mail-verify-stream))) ((string-match "^550-" string) (insert (substring string 4))) (t (insert string))) (goto-char (point-min)) (replace-string "\C-m" "") ;; ;; if verify is visible, move the last line to the bottom of that window ;; (let ((here (selected-window))) (let ((webster-window (get-buffer-window "*mail-verify*"))) (if (windowp webster-window) (progn (select-window webster-window) (recenter -1) (select-window here))))) (set-buffer this-buffer))) -- Dirk Grunwald -- Univ. of Illinois (grunwald@flute.cs.uiuc.edu)