Support grouping by contact

I'd suggest to add a feature to group relays by contact. Only non-empty contacts should be grouped together.

It will likely result in similar groups as defined in #6662 (moved).