Refactored available presence handler
Refactored parsing caps
Merge branch 'master' into plugins