Fixed html encoding for chat messages

* Used the same technique as JabbR for html encoding
  javascript messages
* Fixed minor ui bug that caused chatbox to scroll up
* Added local message handling to prevent flickers
Fixes

* Replaced 0 with ChatMessageType.User for readability
* Added comment to explain suspicious code for appending
  new messages
Merge pull request #42 from Buildstarted/master

Fixed html encoding for chat messages.  Contributed by @Buildstarted.