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