Update room list when user leaves a room.

Also moved rooms array and associated functions to wsapi module.