added infrastructure for chat room message trimming. only trims when:
- message count exceeds 500
- room is "trimmable"
- user has typed in the room since last history fetch