Reactions of N-chloramines and N-haloamides with unsaturated compounds