summaryrefslogtreecommitdiff
path: root/src/rooms.clj
diff options
context:
space:
mode:
authorScott Ostler <sbsotler@gmail.com>2010-11-29 01:15:49 -0500
committerScott Ostler <sbsotler@gmail.com>2010-11-29 01:15:49 -0500
commitdd46cb29fa939546908db15fc92491bc49f3130f (patch)
tree50b8f74086728540cbc49249d4b98aacb9040d12 /src/rooms.clj
parentd82ee6e32595edef8b7c5782f72eacac24d8a0c2 (diff)
Commit initial vip-only direct messaging
Diffstat (limited to 'src/rooms.clj')
-rw-r--r--src/rooms.clj13
1 files changed, 3 insertions, 10 deletions
diff --git a/src/rooms.clj b/src/rooms.clj
index 574532a..3367ea9 100644
--- a/src/rooms.clj
+++ b/src/rooms.clj
@@ -6,7 +6,7 @@
utils
user))
-(defstruct message-struct :nick :content :created_on :msg_id)
+(defstruct message-struct :nick :content :created_on :msg_id :recips)
(def *run-flusher* true)
(def *flusher-sleep* (seconds 4))
@@ -99,19 +99,12 @@
; Note: To ensure that the msg's timestamp is consistent
; with other msg creations, build-msg must be used
; within a dosync.
-(defn build-msg [nick content msg-id]
- (struct message-struct nick content (new Date) msg-id))
+(defn build-msg [nick content msg-id recips]
+ (struct message-struct nick content (new Date) msg-id recips))
(defn add-message [msg room]
(insert-and-truncate! (room :messages) msg message-count-limit))
-(defn insert-message-into-db! [user-id room-id content is-image]
- (:message_id
- (first
- (do-select ["INSERT INTO messages (user_id, room_id, content, is_image)
- VALUES (?, ?, ?, ?) RETURNING message_id"
- user-id room-id content is-image]))))
-
(defn create-and-add-room! [key]
(do-select ["INSERT INTO rooms (key, name, description)
VALUES (?, ?, ?) RETURNING room_id"