I know this question has been asked before, but only a partial answer was given by mschonaker here . On my site, the user can add people to his list, then the friend must accept and finally connect. The first person (user a) uses the famous
roster.createEntry(jid, name, groups);
which works and adds an entry to my list, but then I'm a little confused about what to do:
How do I get a request at the other end? I tried implementing PacketListener, overriding processPacket () and checking for a package whose type is Presence.Type.subscribe or Presence.Type.subscribed, but it seems to run only for user a, but not the one that should listen to subscriptions - user b .
then I have another function that can search for all requests at the login, so if I log in again, I will see the request, but how to accept it? firstly, I thought user b should also add the user to his roster.createEntry(jid, name, groups); list roster.createEntry(jid, name, groups);
but it did not work, and nothing happened. I also tried to do
Presence subscribed = new Presence(Presence.Type.subscribed); subscribed.setTo(jid); xMPPConnection.sendPacket(subscribed);
but does not work. I'm sure there should be a good and easy way to do this, but I havenβt found it anywhere, and having tried one thing at a time, I had too many headaches. Does anyone know the correct thread for this? thanks in advance!
source share