Check plugin when adding or removing chat

Adding a new IRC-chat got me SIGABRT:

terminate called after throwing an instance of 'std::logic_error'
  what():  basic_string::_S_construct null not valid
Merge pull request #58 from nesciens/crash-adding-non-wa-chat

SIGABRT when adding non-whatsapp chat
Some memory leaks fixed.
Tested a little bit only... Feel free to revert