Fork from http://code.google.com/p/xmpphp/