Merge pull request #2529 from ddobrev/19520

Improvements to chat
Restored code that Git had somehow deleted.