                                  (conj text))))))))
 
 (defn add-msg [room-name msg]
-  (println :adding msg :to room-name)
   (send msg-db-agent
         (add-msg-fn {:room room-name :msg msg})))
 

        ;; have the room already
        (do
          (swap! (db room) (fn update-msg-atom [q]
                             (conj (if (>= (count q) max-msgs-per-room)
                                     (pop q)
                                     q)
                                   text)))

(add-hook ::catchup 'nick-hook catchup-log)
(add-hook ::catchup 'topic-hook catchup-log)

(defcommand catchup [channel args]
  (let [[room size] (.split args " ")
        size (try (Integer/parseInt size)
                  (catch Exception _
                    (config :catchup :default-catchup-size)))]
    (if room
      (do
        (send-to-client channel 999 (str "*** Catchup Playback for " room ":"))
        (doseq [msg (take (or size (config :catchup :default-catchup-size))
                          (messages-for room))]
          (send-to-client channel 999 msg))
        (send-to-client channel 999 "*** Catchup Complete."))
      (raise {:type :client-error
              :code 999
              :msg ":No room given"}))))
