When adding a friend fails because of a problem subscribing to XMPP notifications, the user's friending quota is decremented none-the-less
Related to #2022
The problem is here
Upon adding a friend, we immediately sync friends, which immediately pushes the update to the server, whereupon the server decrements your friending quota.
Only after this do we attempt to subscribe to XMPP presence and if that fails, we remove the friend. However, removing a friend doesn't restore the friend quota because at that point an email has already gone to the friend. This logic is a holdover from the days when we assigned fallbacks to specific users. Now that we have open downloads, it would actually be okay to increment the friend quota whenever someone unfriends a user.
To put this succinctly, now that we have open downloads, invitations should be essentially free. We may still want to use the friends quota to cap the total number of active friends at any given time for kscope purposes, but that's a different consideration than invitations.
If we ever redesign the UI to clearly distinguish between the activities of "trusting" and "inviting", this may also become easier to explain to the user.
I think (not 100% sure) that given how the logic works, one will always get this error when adding non-Google friends.
there are lots of confusion caused by this friending legacy. if downloading is free, why don't we also remove the invitation as well, and use google talk friend directly.
Moving to be with #2006 under the theory that that's the root cause.
Actually, note: although fixing #2006 will hopefully reduce the frequency with which this codepath is executed, it sounds like the logic of this codepath is still a bit weird (and may be triggered whenever non-Google users are invited).
Given that most users don't bump up against the current friend limits and we have plans to replace our use of XMPP soon, propose that sort out the proper logic in the eventual parallel invitation case in the new codebase and UI later.