big refactor to threads/allegro events
buf_init() to initialise pre-allocated buffer
fix initialisation of user event

the nested structs/unions were conflicting
initialise buffer after creating message
detect client disconnection