changeset 29303:a3541330de52

(finger-X.500-host-regexps): New user-option. (finger): If HOST matches a regexp from finger-X.500-host-regexps, send a query containing USER only, not USER@HOST.
author Gerd Moellmann <gerd@gnu.org>
date Tue, 30 May 2000 20:01:39 +0000
parents b1d66cb97075
children 71272a11eab7
files lisp/net/net-utils.el
diffstat 1 files changed, 23 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/net/net-utils.el	Tue May 30 18:45:45 2000 +0000
+++ b/lisp/net/net-utils.el	Tue May 30 20:01:39 2000 +0000
@@ -691,6 +691,15 @@
 ;; Simple protocols
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
+(defcustom finger-X.500-host-regexps nil
+  "A list of regular expressions matching host names.
+If a host name passed to `finger' matches one of these regular
+expressions, it is assumed to be a host that doesn't accept
+queries of the form USER@HOST, and wants a query containing USER only."
+  :group 'net-utils
+  :type '(repeat regexp)
+  :version "21.1")
+
 ;; Finger protocol
 ;;;###autoload
 (defun finger (user host)
@@ -704,23 +713,24 @@
 					 (net-utils-url-at-point)))
 	   (index  (string-match (regexp-quote "@") answer)))
       (if index
-	  (list 
-	   (substring answer 0 index)
-	   (substring answer (1+ index)))
-	(list
-	 answer
-	 (read-from-minibuffer "At Host: " (net-utils-machine-at-point))))))
-  (let* (
-	 (user-and-host (concat user "@" host))
-	 (process-name 
-	  (concat "Finger [" user-and-host "]"))
-	 )
+	  (list (substring answer 0 index)
+		(substring answer (1+ index)))
+	(list answer
+	      (read-from-minibuffer "At Host: "
+				    (net-utils-machine-at-point))))))
+  (let* ((user-and-host (concat user "@" host))
+	 (process-name (concat "Finger [" user-and-host "]"))
+	 (regexps finger-X.500-host-regexps)
+	 found)
+    (while (not (string-match (car regexps) host))
+      (setq regexps (cdr regexps)))
+    (when regexps
+      (setq user-and-host user))
     (run-network-program 
      process-name 
      host 
      (cdr (assoc 'finger network-connection-service-alist))
-     user-and-host
-     )))
+     user-and-host)))
 
 (defcustom whois-server-name "rs.internic.net"
   "Default host name for the whois service."