annotate lisp/w3/url-irc.el @ 14:9ee227acff29 r19-15b90

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