annotate lisp/url/url-irc.el @ 2:ac2d302a0011 r19-15b2

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