Message systems - Various parts of them..

C++, C#, Java, PHP, ect...
Post Reply
User avatar
Zerk
Posts: 58
Joined: Wed Jan 20, 2010 2:59 am

Message systems - Various parts of them..

Post by Zerk »

I'm trying to set up a message system to tone my skillz. I have an Inbox, Outbox, Compose thing, and you can read or delete any message in your Inbox. I am, however, having a few problems.

I used a table called Mail that has 7 fields. A message id, receiving player's id and name (so I don't have to do unnecessary queries for random players), sending player's id and name, message, and title.

Every time you compose, it increments the message id, plugs in the receiving player, plugs in the sending player, and throws the message/title in the data base. This message is both viewable from the sender's Outbox and the receiver's Inbox. This is where we get started with problems..


Problem---- If the receiver chooses to delete a message (to make things more tidy), it also deletes it from the sender's Outbox. Should I make a new field called "type" and use it to identify whether the message is from the Inbox or Outbox? If I do this, I will have to insert the message twice..will this slow down the server or clog it up in any way?


Question---- How do I implement a time/date sent? I know it probably has something to do with the time() function but I can't find anything that keeps it from changing: staying on the time it was sent instead of just being a clock.



Lol, any help would be appreciated.
Coding - Unity3d JS, PHP, and small amount of C#.
Art stuff - GIMP, Blender
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Message systems - Various parts of them..

Post by hallsofvallhalla »

I would make 2 fields, inbox, outbox. make it a tiny integer, 1 = valid, 0 = deleted

when the receiving player checks his mailbox it queries also where inbox = 1
when the sending player checks his mailbox it queries also where outbox = 1

when the receiving player deletes the message it changes to 0, also make it check if outbox also = 0 the delete message completely.

same goes with sending player except if inbox also = 0 then delete.

time function is seconds, you just need to convert it to time.
User avatar
Zerk
Posts: 58
Joined: Wed Jan 20, 2010 2:59 am

Re: Message systems - Various parts of them..

Post by Zerk »

hallsofvallhalla wrote:I would make 2 fields, inbox, outbox. make it a tiny integer, 1 = valid, 0 = deleted

when the receiving player checks his mailbox it queries also where inbox = 1
when the sending player checks his mailbox it queries also where outbox = 1

when the receiving player deletes the message it changes to 0, also make it check if outbox also = 0 the delete message completely.

same goes with sending player except if inbox also = 0 then delete.

time function is seconds, you just need to convert it to time.
Whoa..that helps o.O

Thanks a lot :) I'll get to work on it.
Coding - Unity3d JS, PHP, and small amount of C#.
Art stuff - GIMP, Blender
Post Reply

Return to “Coding”