diff options
Diffstat (limited to 'src/rooms.clj')
| -rw-r--r-- | src/rooms.clj | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/rooms.clj b/src/rooms.clj index c1b596b..a7fe933 100644 --- a/src/rooms.clj +++ b/src/rooms.clj @@ -91,13 +91,16 @@ (alter (room :users) assoc (user :nick) user)) ; Note: To ensure that the msg's timestamp is consistent -; with other msg creations, build-msg should be called -; from within a dosync. +; with other msg creations, build-msg should be used +; within a dosync. (defn build-msg [nick content msg-id] (struct message-struct nick content (new Date) msg-id)) + +(def message-count-limit 200) + (defn add-message [msg room] - (alter (room :messages) (swap cons) msg)) + (insert-and-truncate! (room :messages) msg message-count-limit)) (defn insert-message-into-db! [user-id room-id content is-image] (:message_id |
