Following is the Emacs LISP code, I hacked for ERC to use ctrlproxy:
(defun setup-ctrlproxy()
"Setup Emacs for using ctrlproxy"
(interactive)
;; socks.el is part of GNU Emacs 23
(require 'socks)
(setq socks-noproxy '("localhost"))
(setq socks-override-functions 1)
(setq erc-server-connect-function 'socks-open-network-stream)
(setq socks-password "password")
;; ctrlproxy exposes itself a SOCKS 5 proxy
(setq socks-server '("ctrlproxy" "localhost" "6680" 5)))
Now, whenever I want to connect to IRC (using ERC) via ctrlproxy, I simply do M-x setup-ctrlproxy which make ERC aware of ctrlproxy, then M-x erc to start ERC and at the IRC Server prompt I enter the name of the ctrlproxy network I want to connect to. Thats it. Happy, Emacsing… :)