Fix crash if XMPP connection unsuccessful

Also rework the patches to match the cloudprint git repo.