powered by Jive Software

Dummy subscription problem

Hi, I’‘m awaiting for packet of type TYPE.SUBSCRIBE. To be warned when I’'m in mode SUBSCRIPTION_MANUAL

I can catch them well. But my question is what shall I do do reject a user’'s request or accept it.

Any thing I tried didn’'t worked.

thanks

ofupien,

Below you can find how Smack can be used to accept or reject all the subscriptions. Take a look at this code and you’'ll get the idea.

if (subscriptionMode == SUBSCRIPTION_ACCEPT_ALL) {
        // Accept all subscription requests.
        Presence response = new Presence(Presence.Type.SUBSCRIBED);
        response.setTo(presence.getFrom());
        connection.sendPacket(response);
    }
    else if (subscriptionMode == SUBSCRIPTION_REJECT_ALL) {
        // Reject all subscription requests.
        Presence response = new Presence(Presence.Type.UNSUBSCRIBED);
        response.setTo(presence.getFrom());
        connection.sendPacket(response);
    }

Regards,

– Gato

Hi Gato, thanks, I forgot to notify that I already looked at Roster.java

Thank you.