Make contact list presence subscription aware
Review Request #101134 - Created April 15, 2011 and submitted
This is a simple hack to make contact list aware of new presence subscription requests. It consists of a modal dialog - in a bright future where this will be moved out, it will be displayed as a KNotification instead. To ease the user's life, on acceptance the request is accepted and a subscription is made (a-la-windows live).
Briefly tested and working, needs more testing.
We're missing a step before we can close the bug report. "Thus, in addition to listening to presencePublicationRequested(), you should check the initial state after connecting to it, by looping over allKnownContacts() and checking for any state = Ask contacts. These would be in particular contacts that previously requested your presence, perhaps when you were offline, or when you were connected to the account earlier (maybe even with another client), but didn't approve or reject the request then." - Oggis, mailing list thread "Add/Remove Contacts" You can do this to build a list, then simply call your onPresencePublicationRequested method. You can ship this as it is, as long as this doesn't get forgotten about. Also I noticed there was nothing in the "Testing Done" field, could we make sure we give this a quick test before merging.
"The contact firstname.lastname@example.org added you to its contact list." In English we don't refer to someone as "it" and it is normally considered rude to do so. -- "Do you want to allow him to see your presence" Also we can't say "him" without assuming only men are being added to your contact list. -- Suggestion: "The contact %1 added you to their contact list. Do you want to allow this person to see your presence and add them to your contact list."
Review request changed
Updated diff, including suggested changes by David. This one includes multithreaded lookup of contact properties - first testing shows no issues whatsoever, but the beta cycle will tell the truth Please, review and TEST. I had the chance to test this just briefly due to lack of accounts.
Revision 2 (+66 -1)
I think this code has a really easy to make flaw, (that I know about my doing it wrong myself a few times) other than that it's good (even if you are showing off a bit with your QtConcurrents..)
It's possible for the account to be ready and connected before the ContactManager is ready (ContactListStateSuccess). At which point allKnownContacts() returns an empty list if you use it too early. I think this code falls into that trap, at which point we may miss contacts that were added whilst we were offline.