+
+(defun do-connect-and-join (nick server username realname logging-stream channels)
+ (let ((conn (connect :nickname nick :server server
+ :username username :realname realname
+ :logging-stream logging-stream)))
+ (mapc #'(lambda (channel) (join conn channel)) channels)
+ (add-hook conn 'irc::irc-privmsg-message 'privmsg-hook)
+ (add-hook conn 'irc::ctcp-action-message 'action-hook)
+ (add-hook conn 'irc::irc-nick-message 'nick-hook)
+ (add-hook conn 'irc::irc-part-message 'part-hook)
+ (add-hook conn 'irc::irc-quit-message 'quit-hook)
+ (add-hook conn 'irc::irc-join-message 'join-hook)
+ (add-hook conn 'irc::irc-kick-message 'kick-hook)
+ (add-hook conn 'irc::irc-mode-message 'mode-hook)
+ (add-hook conn 'irc::irc-topic-message 'topic-hook)
+ (add-hook conn 'irc::irc-notice-message 'notice-hook)
+ (add-hook conn 'irc::irc-error-message 'error-hook)
+ (add-hook conn 'irc::irc-ping-message 'ping-hook)
+ (add-hook conn 'irc::irc-pong-message 'pong-hook)
+ (add-hook conn 'irc::irc-kill-message 'kill-hook)
+ (add-hook conn 'irc::irc-invite-message 'invite-hook)
+ (add-hook conn 'irc::irc-rpl_killdone-message 'warning-hook)
+ (add-hook conn 'irc::irc-rpl_closing-message 'warning-hook)
+ (add-hook conn 'irc::irc-rpl_topic-message 'rpl_topic-hook)
+ (add-hook conn 'irc::irc-rpl_namreply-message 'rpl_namreply-hook)
+ (add-hook conn 'irc::irc-rpl_endofnames-message 'rpl_endofnames-hook)
+ (add-hook conn 'irc::irc-rpl_topicwhotime-message 'rpl_topicwhotime-hook)
+ conn))
+
+(defmethod cl-irc::irc-message-event :around ((msg cl-irc::irc-message))
+ (let ((result (call-next-method msg)))
+ (typecase msg
+ ((or irc::irc-privmsg-message irc::ctcp-action-message irc::irc-nick-message
+ irc::irc-part-message irc::irc-quit-message irc::irc-join-message
+ irc::irc-kick-message irc::irc-mode-message irc::irc-topic-message
+ irc::irc-notice-message irc::irc-error-message irc::irc-ping-message
+ irc::irc-pong-message irc::irc-kill-message irc::irc-invite-message
+ irc::irc-rpl_killdone-message irc::irc-rpl_closing-message
+ irc::irc-rpl_topic-message irc::irc-rpl_namreply-message
+ irc::irc-rpl_endofnames-message irc::irc-rpl_topicwhotime-message
+ irc::irc-rpl_motd-message irc::irc-rpl_motdstart-message
+ irc::irc-rpl_endofmotd-message)
+ ;; nothing to do
+ )
+ (t
+ (let ((logger (find-logger-with-connection (connection msg))))
+ (format (get-unknown-log-stream
+ (find-logger-with-connection (connection msg)))
+ "~A ~A~%"
+ (format-date-time (received-time msg ))
+ (raw-message-string msg))
+ (force-output (get-unknown-log-stream logger)))))
+ result))
+