Closed himselfv closed 5 years ago
Also, from what I can tell, each time a new contact requests subscription, XMPPRosterManager::sendRIE()
runs sendBuddySubscribePresence()
on every buddy in the server list, including the rejected ones, which linger probably since they got Buddy::Both
back at rejection, though I'm not sure. Anyway, all rejected friend requests, ever, get redelivered!
Does handleBuddyUpdatedRequest() really only get called after the subscription had been accepted?
It's called on every presence change, not only subscription.
For anyone having the same questions later, here's how it works:
Spectrum follows Pidgin model where
Spectrum keeps its own permanent list of buddies separate from the frontend (XMPP roster) if "remote roster" is disabled, and the backend (legacy network friends). Entries can only be:
It forwards all friend/unfriend requests to the backend but does not care about the results. Anyone you call a friend becomes a mutual friend in Spectrum's eyes. It produces the required XMPP notifications to keep your roster aligned with this model:
It does not remove the contact from your XMPP roster unless "remote roster" with necessary privileges is active (in which case it manages that part of your roster). You keep it unless you explicitly delete it.
The XMPP semantics are converged to:
So the backend is required to handle only two actions: remove buddy (handleBuddyRemoved
) and add buddy (handleBuddyUpdatedRequest
).
The last one is called on any changes in a buddy's groups or a buddy's privacy lists. Since you cannot make these changes without having that buddy present, it's also used as an indicator of buddy addition.
It does not and cannot remove the contact from your XMPP roster
This is not true when remote_roster/privileges are active
Ok, fixed.
(The lingering rejected subscriptions issue should be fixed by https://github.com/SpectrumIM/spectrum2/pull/327 )
I'm using spectrum2 (xmpp gateway)+purple_skypeweb and debugging a problem where friend request denials are ignored and the request simply reappears the next time I reconnect.
As far as I've managed to figure, the friend request accept/deny scheme in spectrum works like this:
libpurple_backend registers purple callbacks
accountRequestAuth
andaccountRemoveAuth
. It stores auth requests with theiraccept_cb
anddeny_cb
callbacks and sends<presence type=subscribe>
on their behalf.The only way these callbacks are called are:
accept_cb
in anyhandleBuddyUpdatedRequest()
, anddeby_cb
only inhandleBuddyRemoved()
.This raises a few questions:
Does
handleBuddyUpdatedRequest()
really only get called after the subscription had been accepted? Can't it be called just because something about this buddy has changed, even though it's not yet accepted?Does
handleBuddyRemoved()
really happen when the frontend receives<presence type=unsubscribed>
from the user?The second thing doesn't seem to happen. User
<presence>
handling goes throughUserManager::handlePresence()
,UserManager::handleSubscription()
,User::handleSubscription()
toRosterManager::handleSubscription()
where onPresence::Unsubscribed
it simply sends back<presence type=unsubscribe>
(why?) and sets buddy's subscription type toBuddy::Both
(why? x2).So... What I'm missing? Shouldn't there be a message to send from the frontend to the backend to tell it to accept or reject a subscription request on the backend network?