use defun/setq instead of define (elisp isn't scheme); use format instead of concat, the latter breaks when the service is passed as an integer

Updated rcirc :connect-function fork (markdown)
mnemonikk 2010-12-08 04:17:57 -08:00
parent b7e78f0c82
commit c5368cf85e
1 changed files with 14 additions and 7 deletions

21
Home.md

@ -6,13 +6,20 @@ My fork of rcirc supports a new `:connect-function` parameter in `rcirc-server-a
Connecting with SSL Connecting with SSL
------------------------------- -------------------------------
The easiest way to get started is using the function `open-tls-stream`
which is defined in the `tls` library. You need the `gnutls` binary for
this:
(require 'tls)
(setq rcirc-server-alist '(("irc.freenode.net" :port 6697 :connect-function open-tls-stream :channels ("#rcirc"))))
This example defines a new `irc-open-tls-stream` function which calls out to the `socat` program to establish an SSL This example defines a new `irc-open-tls-stream` function which calls out to the `socat` program to establish an SSL
connection: connection:
(defun irc-open-tls-stream (name buffer host service) (defun irc-open-tls-stream (name buffer host service)
(start-process name buffer "socat" "STDIO" (concat "OPENSSL:" host ":" service ",verify=0"))) (start-process name buffer "socat" "STDIO" (concat "OPENSSL:" host ":" service ",verify=0")))
(define rcirc-server-alist '(("irc.freenode.net" :port 6697 :connect-function irc-open-tls-stream :channels ("#rcirc")))) (setq rcirc-server-alist '(("irc.freenode.net" :port 6697 :connect-function irc-open-tls-stream :channels ("#rcirc"))))
Connecting through an HTTP proxy Connecting through an HTTP proxy
--------------------------------------------------- ---------------------------------------------------
@ -20,10 +27,10 @@ Connecting through an HTTP proxy
The `proxychains` program does some magic tricks to get network activity to go out through an HTTP proxy. This example The `proxychains` program does some magic tricks to get network activity to go out through an HTTP proxy. This example
uses `proxychains` in front of `socat` to make a plain (non-SSL) connection: uses `proxychains` in front of `socat` to make a plain (non-SSL) connection:
(define irc-open-proxied-stream (name buffer host service) (defun irc-open-proxied-stream (name buffer host service)
(start-process name buffer "proxychains" "socat" "STDIO" (concat "TCP:" host ":" service))) (start-process name buffer "proxychains" "socat" "STDIO" (format "OPENSSL:%s:%d,verify=0" host service)))
(define rcirc-server-alist '(("irc.freenode.net" :connect-function irc-open-proxied-stream :channels ("#rcirc")))) (setq rcirc-server-alist '(("irc.freenode.net" :connect-function irc-open-proxied-stream :channels ("#rcirc"))))
Connecting with SSL, presenting a client certificate, with an SSH connection to a remote server Connecting with SSL, presenting a client certificate, with an SSH connection to a remote server
----------------------------------------------------------------- -----------------------------------------------------------------
@ -32,8 +39,8 @@ This crazy example (which I actually use) first establshes an SSH connection to
from that machine, presenting a client certificate to the IRC server to authenticate. It also makes sure the remote from that machine, presenting a client certificate to the IRC server to authenticate. It also makes sure the remote
host presents a valid SSL certificate. host presents a valid SSL certificate.
(define irc-open-crazy-stream (name buffer host service) (defun irc-open-crazy-stream (name buffer host service)
(start-process name buffer "ssh" "remotehost" "socat" "STDIO" (start-process name buffer "ssh" "remotehost" "socat" "STDIO"
(concat "OPENSSL:" host ":" service ",cert=/home/neale/ircauth.key,cafile=/home/neale/irc.pem"))) (format "OPENSSL:%s:%d,cert=/home/neale/ircauth.key,cafile=/home/neale/irc.pem" host service)))
(define rcirc-server-alist '(("irc.wotzit.net" :port 994 :connect-function irc-open-crazy-stream))) (setq rcirc-server-alist '(("irc.wotzit.net" :port 994 :connect-function irc-open-crazy-stream)))