comparison lisp/erc/erc-identd.el @ 76856:2fae574a2382

Release ERC 5.2. I have updated the version of ERC to 5.2, since it fixes a bug with C-c C-SPC being bound globally by default. For the full list of changes in this version, see etc/ERC-NEWS. Revision: emacs@sv.gnu.org/emacs--devo--0--patch-687 Creator: Michael Olson <mwolson@gnu.org>
author Miles Bader <miles@gnu.org>
date Sun, 01 Apr 2007 13:36:38 +0000
parents 7a3f13e2dd57
children 85d67fae9a94
comparison
equal deleted inserted replaced
76855:e6686c0a3d45 76856:2fae574a2382
40 40
41 (require 'erc) 41 (require 'erc)
42 42
43 (defvar erc-identd-process nil) 43 (defvar erc-identd-process nil)
44 44
45 (defgroup erc-identd nil
46 "Run a local identd server."
47 :group 'erc)
48
49 (defcustom erc-identd-port 8113
50 "Port to run the identd server on if not specified in the argument for
51 `erc-identd-start'.
52
53 This can be either a string or a number."
54 :group 'erc-identd
55 :type '(choice (const :tag "None" nil)
56 (integer :tag "Port number")
57 (string :tag "Port string")))
58
45 ;;;###autoload (autoload 'erc-identd-mode "erc-identd") 59 ;;;###autoload (autoload 'erc-identd-mode "erc-identd")
46 (define-erc-module identd nil 60 (define-erc-module identd nil
47 "This mode launches an identd server on port 8113." 61 "This mode launches an identd server on port 8113."
48 ((add-hook 'erc-connect-pre-hook 'erc-identd-start) 62 ((add-hook 'erc-connect-pre-hook 'erc-identd-quickstart)
49 (add-hook 'erc-disconnected-hook 'erc-identd-stop)) 63 (add-hook 'erc-disconnected-hook 'erc-identd-stop))
50 ((remove-hook 'erc-connect-pre-hook 'erc-identd-start) 64 ((remove-hook 'erc-connect-pre-hook 'erc-identd-quickstart)
51 (remove-hook 'erc-disconnected-hook 'erc-identd-stop))) 65 (remove-hook 'erc-disconnected-hook 'erc-identd-stop)))
52 66
53 (defun erc-identd-filter (proc string) 67 (defun erc-identd-filter (proc string)
54 "This filter implements RFC1413 (identd authentication protocol)." 68 "This filter implements RFC1413 (identd authentication protocol)."
55 (let ((erc-identd-process proc)) 69 (let ((erc-identd-process proc))
69 machine -- using iptables, or a program like redir which can be 83 machine -- using iptables, or a program like redir which can be
70 run from inetd. The idea is to provide a simple identd server 84 run from inetd. The idea is to provide a simple identd server
71 when you need one, without having to install one globally on your 85 when you need one, without having to install one globally on your
72 system." 86 system."
73 (interactive (list (read-string "Serve identd requests on port: " "8113"))) 87 (interactive (list (read-string "Serve identd requests on port: " "8113")))
74 (if (null port) 88 (unless port (setq port erc-identd-port))
75 (setq port 8113) 89 (when (stringp port)
76 (if (stringp port) 90 (setq port (string-to-number port)))
77 (setq port (string-to-number port)))) 91 (when erc-identd-process
78 (if erc-identd-process 92 (delete-process erc-identd-process))
79 (delete-process erc-identd-process))
80 (setq erc-identd-process 93 (setq erc-identd-process
81 (make-network-process :name "identd" 94 (make-network-process :name "identd"
82 :buffer nil 95 :buffer nil
83 :host 'local :service port 96 :host 'local :service port
84 :server t :noquery t :nowait t 97 :server t :noquery t :nowait t
85 :filter 'erc-identd-filter)) 98 :filter 'erc-identd-filter))
86 (set-process-query-on-exit-flag erc-identd-process nil)) 99 (set-process-query-on-exit-flag erc-identd-process nil))
100
101 (defun erc-identd-quickstart (&rest ignored)
102 "Start the identd server with the default port.
103 The default port is specified by `erc-identd-port'."
104 (erc-identd-start))
87 105
88 ;;;###autoload 106 ;;;###autoload
89 (defun erc-identd-stop (&rest ignore) 107 (defun erc-identd-stop (&rest ignore)
90 (interactive) 108 (interactive)
91 (when erc-identd-process 109 (when erc-identd-process