XEP-0079 implementation

I rebased all my changes on top of new master and fixed some minor issues like StringBuilder where string concat is possible.