Created
November 1, 2012 04:31
-
-
Save joekarma/3991747 to your computer and use it in GitHub Desktop.
CL-IRC Test. Seems to be pinging out. :depends-on (:cl-irc)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; Trying to instrument handled events as well as unhandled events by | |
;;; monkey patching cl-irc: | |
(in-package :cl-irc) | |
(defmethod irc-message-event (connection (message irc-message)) | |
(declare (ignore connection)) | |
(if (apply-to-hooks message) | |
(client-log (connection message) message "HANDLED-EVENT:") | |
(client-log (connection message) message "UNHANDLED-EVENT:"))) | |
(defmethod default-hook ((message irc-ping-message)) | |
(format t "SHOULD BE PONGING!~%") | |
(apply #'pong (connection message) (arguments message))) | |
;;; Unfortunately, no ping messages are being logged by the code below. | |
;;; My bot is exiting the channel after about 5 minutes on average. | |
(defpackage :cl-irc.trials | |
(:use :cl)) | |
(in-package :cl-irc.trials) | |
(defparameter *username* "joekarma") | |
(defun connect-and-join () | |
(let ((connection nil)) | |
(unwind-protect | |
(progn | |
(setf connection | |
(irc:connect :nickname (format nil "~a|~4,'0d" *username* (random 9999)) | |
:server "irc.freenode.net")) | |
(irc:join connection "#joekarma") | |
(irc:read-message-loop connection)) | |
(irc:part connection "#joekarma") | |
(irc:die connection) | |
(setf connection nil)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It seems the above errors are unique to my OS, and possibly to my particular OS + Lisp implementation combo, Mac OS X Lion 10.7.4 + SBCL 1.0.57.56-2273f3a + CL-IRC revision 231. I tried with SBCL on my server (Ubuntu) and there was no problem with ping timeouts. Mac OS X + CCL failed, however.