lib: handle events after canceling transfers

Otherwise the new transfer status does not propagate
into the xfer->status and we try to cancel all transfers
twice.

Also replace the ifdefs with a single macro for backwards
compatibility.

Signed-off-by: Steve Markgraf <steve@steve-m.de>