[libcontacts] Simplify name group determination