Changes in chat and channel presence

1. Some server and client refactoring in chat functionality
2. Added server hook points for detecting user presence