问题
In my chat application when I have to add a friend I have to follow this process -
Suppose A->B ist : A will send subscribe packet to B ( server entry shows NONE subscription ) iind - B will send subscribed packet to A ( server entry will be - TO/FROM) iiird - B will again send subscribe packet to A ( server entry TO/FROM ) ivth - A will send subscribed packet to B ( server entry BOTH )
Each time a notification is sent to the concerned user and after allowing corresponding packet is sent.
I want to do it like this -
When A sends a friend request to B ( a notification To B will be sent - and the server entry should be TO/FROM ) and its upto B to accept or not, If he accepts it then immediately the server entry should be BOTH.
Please tell me how can I achieve the same by sending only two sets of subscription packets.
Thanks
回答1:
AFAIK this can only be done on the client/library level: You have to implement the client so that for every confirmed subscription request, another subscription request is send back to the initial requester.
But you will always have 4 steps/packets to be send to "friend" to JIDs.
回答2:
This would be implemented according to the appropriate specification, so it doesn't make sense to try and change it.
This is not Smack defined behaviour, it is XMPP specification defined behaviour.
来源:https://stackoverflow.com/questions/13302178/xmpp-with-smack-adding-friend