Server-side. I'm assuming, of course, that the messages are being stored in a database.
If that's the case, some SS languages have Scheduled Tasks (ColdFusion, for sure) that can be run to check time and perform "clean up".
If anyone knows of a website that can offer ColdFusion help that isn't controlled by neurotic, pedantic jerks* (stackoverflow.com), please PM me with a link.
* The neurotic, pedantic jerks are not the owners; just the people who are in control of the "popularity contest".