Last week there were changes / fixes to GnuPG's get_best_pubkey_by_name (not sure if that is the exact function name). This is the code gnupg uses when you do a
gpg -er aheinecke@gnupg.org
to find the best key to encrypt to.
Or which key gpg --locate-key aheinecke@gnupg.org would return.
They are defined by checking for a single mailbox.
We have mirrored code in libkleo with KeyCache::findBestByMailBox . Which was a crutch at the time as I didn't know where to better place it. I would rather have some key comparison in GpgME++ and then use it to basically only sort in Libkleo's keycache. But I didn't know how to then also add group support so I did it in the Keycache.
I'm using the function in the newkeyresolver in libkleo and by extension in GpgOL.
This deserves at least a look to check what has been changed in GnuPG.