erc-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Erc-commit] [commit][emacs22] Update from CVS


From: mwolson
Subject: [Erc-commit] [commit][emacs22] Update from CVS
Date: Sun, 14 Oct 2007 00:48:13 -0400

commit 40aae05017bdc69e569a6d45a035f913d32b80f8
Author: Michael Olson <address@hidden>
Date:   Thu May 4 00:51:52 2006 +0000

    Update from CVS
    
    2006-05-01  Edward O'Connor  <address@hidden>
    
       * erc-goodies.el: (erc-handle-irc-url): New function, suitable as
       a value for `url-irc-function'.
    git-archimport-id: address@hidden/erc--cvs--0--patch-156

diff --git a/ChangeLog b/ChangeLog
index 1e401b2..ede6139 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2006-05-01  Edward O'Connor  <address@hidden>
+
+       * erc-goodies.el: (erc-handle-irc-url): New function, suitable as
+       a value for `url-irc-function'.
+
 2006-04-18  Diane Murray  <address@hidden>
 
        * erc-pcomplete.el (pcomplete-erc-nicks): Added new optional
diff --git a/erc-goodies.el b/erc-goodies.el
index c844af5..d50a8d9 100644
--- a/erc-goodies.el
+++ b/erc-goodies.el
@@ -516,6 +516,28 @@ servers.  If called from a program, PROC specifies the 
server process."
       (multi-occur (erc-buffer-list nil proc) string)
     (error "`multi-occur' is not defined as a function")))
 
+;; Teach url.el how to open irc:// URLs with ERC.
+;; To activate, customize `url-irc-function'.
+
+(defun erc-handle-irc-url (host port channel user password)
+  "Use ERC to IRC on HOST:PORT in CHANNEL as USER with PASSWORD.
+If ERC is already connected to HOST:PORT, simly /join CHANNEL.
+Otherwise, connect to HOST:PORT as USER and /join CHANNEL."
+  (let ((server-buffer
+         (car (erc-buffer-filter
+               (lambda ()
+                 (and (string-equal erc-session-server host)
+                      (= erc-session-port port)
+                      erc-server-connected
+                      (eq (erc-server-buffer) (current-buffer))))))))
+    (with-current-buffer (or server-buffer (current-buffer))
+      (if (and server-buffer channel)
+          (erc-cmd-JOIN channel)
+        (erc host port (or user (erc-compute-nick)) (erc-compute-full-name)
+             (not server-buffer) password nil channel
+             (when server-buffer
+               (get-buffer-process server-buffer)))))))
+
 (provide 'erc-goodies)
 
 ;; arch-tag: d987ae26-9e28-4c72-9596-e617309fb582




reply via email to

[Prev in Thread] Current Thread [Next in Thread]