Mercurial > hg > xemacs-beta
comparison lisp/url/url-irc.el @ 0:376386a54a3c r19-14
Import from CVS: tag r19-14
author | cvs |
---|---|
date | Mon, 13 Aug 2007 08:45:50 +0200 |
parents | |
children | ac2d302a0011 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:376386a54a3c |
---|---|
1 ;;; url-irc.el --- IRC URL interface | |
2 ;; Author: wmperry | |
3 ;; Created: 1996/05/29 15:07:01 | |
4 ;; Version: 1.19 | |
5 ;; Keywords: comm, data, processes | |
6 | |
7 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
8 ;;; Copyright (c) 1996 by William M. Perry (wmperry@spry.com) | |
9 ;;; | |
10 ;;; This file is not part of GNU Emacs, but the same permissions apply. | |
11 ;;; | |
12 ;;; GNU Emacs is free software; you can redistribute it and/or modify | |
13 ;;; it under the terms of the GNU General Public License as published by | |
14 ;;; the Free Software Foundation; either version 2, or (at your option) | |
15 ;;; any later version. | |
16 ;;; | |
17 ;;; GNU Emacs is distributed in the hope that it will be useful, | |
18 ;;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
19 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
20 ;;; GNU General Public License for more details. | |
21 ;;; | |
22 ;;; You should have received a copy of the GNU General Public License | |
23 ;;; along with GNU Emacs; see the file COPYING. If not, write to | |
24 ;;; the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. | |
25 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
26 | |
27 (require 'url-vars) | |
28 (require 'url-parse) | |
29 | |
30 (defvar url-irc-function 'url-irc-zenirc | |
31 "*Function to actually open an IRC connection. | |
32 Should be a function that takes several argument: | |
33 HOST - the hostname of the IRC server to contact | |
34 PORT - the port number of the IRC server to contact | |
35 CHANNEL - What channel on the server to visit right away (can be nil) | |
36 USER - What username to use | |
37 PASSWORD - What password to use") | |
38 | |
39 (defun url-irc-zenirc (host port channel user password) | |
40 (let ((zenirc-buffer-name (if (and user host port) | |
41 (format "%s@%s:%d" user host port) | |
42 (format "%s:%d" host port))) | |
43 (zenirc-server-alist | |
44 (list | |
45 (list host port pass nil user)))) | |
46 (zenirc) | |
47 (goto-char (point-max)) | |
48 (if (not channel) | |
49 nil | |
50 (insert "/join " channel) | |
51 (zenirc-send-line)))) | |
52 | |
53 (defun url-irc (url) | |
54 (let* ((urlobj (url-generic-parse-url url)) | |
55 (host (url-host urlobj)) | |
56 (port (string-to-int (url-port urlobj))) | |
57 (pass (url-password urlobj)) | |
58 (user (url-user urlobj)) | |
59 (chan (url-filename urlobj))) | |
60 (if (url-target urlobj) | |
61 (setq chan (concat chan "#" (url-target urlobj)))) | |
62 (and (get-buffer url-working-buffer) | |
63 (kill-buffer url-working-buffer)) | |
64 (if (string-match "^/" chan) | |
65 (setq chan (substring chan 1 nil))) | |
66 (if (= (length chan) 0) | |
67 (setq chan nil)) | |
68 (funcall url-irc-function host port chan user pass))) | |
69 |