Mercurial > emacs
comparison lisp/url/url-irc.el @ 69695:20c95c0b0947
(url-irc-rcirc, url-irc-erc): New functions.
(url-irc-function): Add rcirc and ERC to the list of IRC clients.
Default to rcirc, since ZenIRC isn't part of Emacs.
author | Romain Francoise <romain@orebokech.com> |
---|---|
date | Mon, 27 Mar 2006 20:23:47 +0000 |
parents | e8a3fb527b77 |
children | 7ab73d29b692 |
comparison
equal
deleted
inserted
replaced
69694:f712cf2b3ceb | 69695:20c95c0b0947 |
---|---|
31 (require 'url-vars) | 31 (require 'url-vars) |
32 (require 'url-parse) | 32 (require 'url-parse) |
33 | 33 |
34 (defconst url-irc-default-port 6667 "Default port for IRC connections") | 34 (defconst url-irc-default-port 6667 "Default port for IRC connections") |
35 | 35 |
36 (defcustom url-irc-function 'url-irc-zenirc | 36 (defcustom url-irc-function 'url-irc-rcirc |
37 "*Function to actually open an IRC connection. | 37 "*Function to actually open an IRC connection. |
38 Should be a function that takes several argument: | 38 Should be a function that takes several arguments: |
39 HOST - the hostname of the IRC server to contact | 39 HOST - the hostname of the IRC server to contact |
40 PORT - the port number of the IRC server to contact | 40 PORT - the port number of the IRC server to contact |
41 CHANNEL - What channel on the server to visit right away (can be nil) | 41 CHANNEL - What channel on the server to visit right away (can be nil) |
42 USER - What username to use | 42 USER - What username to use |
43 PASSWORD - What password to use" | 43 PASSWORD - What password to use" |
44 :type '(choice (const :tag "ZEN IRC" :value 'url-irc-zenirc) | 44 :type '(choice (const :tag "rcirc" :value url-irc-rcirc) |
45 (const :tag "ERC" :value url-irc-erc) | |
46 (const :tag "ZEN IRC" :value url-irc-zenirc) | |
45 (function :tag "Other")) | 47 (function :tag "Other")) |
46 :group 'url) | 48 :group 'url) |
47 | 49 |
48 (defun url-irc-zenirc (host port channel user password) | 50 (defun url-irc-zenirc (host port channel user password) |
49 (let ((zenirc-buffer-name (if (and user host port) | 51 (let ((zenirc-buffer-name (if (and user host port) |
57 (if (not channel) | 59 (if (not channel) |
58 nil | 60 nil |
59 (insert "/join " channel) | 61 (insert "/join " channel) |
60 (zenirc-send-line)))) | 62 (zenirc-send-line)))) |
61 | 63 |
64 (defun url-irc-rcirc (host port channel user password) | |
65 (let ((chan (when channel (concat "#" channel)))) | |
66 (rcirc-connect host port user nil nil (when chan (list chan))) | |
67 (when chan | |
68 (switch-to-buffer (concat chan "@" host))))) | |
69 | |
70 (defun url-irc-erc (host port channel user password) | |
71 (erc-select :server host :port port :nick user :password password) | |
72 (erc-join-channel channel)) | |
73 | |
62 ;;;###autoload | 74 ;;;###autoload |
63 (defun url-irc (url) | 75 (defun url-irc (url) |
64 (let* ((host (url-host url)) | 76 (let* ((host (url-host url)) |
65 (port (url-port url)) | 77 (port (url-port url)) |
66 (pass (url-password url)) | 78 (pass (url-password url)) |
72 (setq chan (substring chan 1 nil))) | 84 (setq chan (substring chan 1 nil))) |
73 (if (= (length chan) 0) | 85 (if (= (length chan) 0) |
74 (setq chan nil)) | 86 (setq chan nil)) |
75 (funcall url-irc-function host port chan user pass) | 87 (funcall url-irc-function host port chan user pass) |
76 nil)) | 88 nil)) |
77 | 89 |
78 (provide 'url-irc) | 90 (provide 'url-irc) |
79 | 91 |
80 ;;; arch-tag: 2e5eecf8-9eb3-436b-9fbd-c26f2fb2bf3e | 92 ;;; arch-tag: 2e5eecf8-9eb3-436b-9fbd-c26f2fb2bf3e |
81 ;;; url-irc.el ends here | 93 ;;; url-irc.el ends here |