- fix for major memory leak;
- event cycle optimization

git-svn-id: http://svn.miranda-ng.org/main/trunk@10915 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
- common message archiving code extracted to a separate function;
- manual memory allocation code removed;

git-svn-id: http://svn.miranda-ng.org/main/trunk@10916 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
git-svn-id: http://svn.miranda-ng.org/main/trunk@10917 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c