Ive written quite a few of these and have ended up with the following base
data structure...

messageID
senderID (tied to userID in a user table)
recipientID (tied to userID in a user table)
messageSubject
messageText
dateSent
readStatus
senderDeleted
recipientDeleted

Most of the fields are obvious im sure... but readStatus is just a bit flag
to decide whether or not the recipientID has viewed the message (1 being
yes, 0 being no)

senderDeleted and recipientDeleted are also just bit flags to indicate yes
or no.

when a sender deletes the message, you flag senderDeleted as 1
when a recipient deletes the message, you flag recipientDeleted as 1

When both deleted flags are 1, it's ok to remove the record completely

To populate an 'Outbox' (messages you've sent) you grab all messages where
the senderID is you and senderDeleted is 0
To populate an 'Inbox' (all messages to you) you grab all messages where the
recipientID is you and recipientDeleted is 0

As for an alert, you just query the message table where recipientID =
currentUser and readStatus = 0 to get new, unread messages and display a JS
alert or whatever.

You could also use some ajax to check for new messages every XX
seconds/minutes or whatever and display a message

..:.:.:.:.:.:.:.:.:.:.:.
Bobby Hartsfield
http://acoderslife.com



-----Original Message-----
From: Toby King [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, February 20, 2008 7:50 AM
To: CF-Talk
Subject: messages in an application

I have an application (almost fully developed) well the key functionality is
in place and working.  I have been asked to build in some type of messaging
functionality.

Basically there are approx 8 key users who use the system regularly.  They
would like to have the functionality in the system where by they can send
and receive messages.  As the users work different shifts they woould like
to be able to be advised when they login as to whether there are any
messages for them to read.  If there are any messages they want to be able
to read the messages and reply if necessary.

Just wondering what the best way is to do this.  I also want to be able to
check that a user has looked at the message.

Thanks in advance.

T 



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:299408
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to