bitlbee and rcirc

So, I switched from irssi to rcirc so that I could do all of my business in one window and not have to switch to the terminal to chat.

It worked fine, except that bitlbee sends a ctcp type of "TYPING" to indicate remote activity, and these messages were showing up on my screen like 13:58 *** mckay_mars CTCP TYPING 1, which isn't very nice.

So I wrote a little code to fix that, and put it in my .emacs:

(defun rcirc-handler-ctcp-TYPING (process target sender value)
;; value = 0 means they're done...which you already know, since their message was sent to you.
   ((string= value "1") (rcirc-print process sender "" target "is typing..."))
   ((string= value "2") (rcirc-print process sender "" target "stalled"))))

;; By default, the CTCP is echoed to the screen, which we don't want to see.
;; This adds "TYPING" to the list of types NOT echoed back.
(defun rcirc-handler-CTCP (process target sender text)
  (if (string-match "^\\([^ ]+\\) *\\(.*\\)$" text)
      (let* ((request (upcase (match-string 1 text)))
             (args (match-string 2 text))
             (handler (intern-soft (concat "rcirc-handler-ctcp-" request))))
        (if (not (fboundp handler))
            (rcirc-print process sender "ERROR" target
                         (format "%s sent unsupported ctcp: %s" sender text)
          (funcall handler process target sender args)
          (unless (or (string= request "ACTION")
                      (string= request "KEEPALIVE")
                      (string= request "TYPING"))
            (rcirc-print process sender "CTCP" target
                         (format "%s" text) t))))))

Hopefully that can be of some use to someone.