Send/receive functions refactoring part 2

* make on-group-message to use msg-history
* refactor msg-history to lock editor when inserting, hopefully this will remove bug with editor throwing exceptions
* move parsing code from chat and group sending functions to msg-history