MT#5349 API: Implement domain preferences. WIP.

Missing sanity checks and special handling for certain preferences.