Roster Subsciption problem

hi,

i’m using the lastest smack 3.0.4 library. The problem i am experiencing is the following. Every time I connect, the roster subscription seems to be set on accept_all. although i set it to manual, it’s already too late !

Can someone shed some light ?

Thanks in advance

Luka

i think i’ve solved the mystery mylself. well you need to set the subscription mode between you login call and sending your presence back to the server.

pls confirm … thank you !

enjoy ! :stuck_out_tongue:

I set the SubscriptionMode after login and initial presence, but before registering the RosterListener.

lRoster.setSubscriptionMode(Roster.SubscriptionMode.manual);
    lRoster.addRosterListener(this);

You also can change the “Default” subscription mode, that is the mode for a new Roster when is created.

Roster.setDefaultSubscriptionMode(Roster.SubscriptionMode.manual);

Thank you both !

one question though, since i’m setting the default subscription mode, where do I need to call it, since i suppose it just needs to be called once ?

thanks again

luka

The “static” things in Java are unique for each running Virtual Machine (more specifically, each class loader). So, you need to call it only once, somewhere, when your application start, before creating rosters.

I do all this on application startup. Here’s a pseudo-code

create XMPP connection with configuration

connect

set packetfilter

set packetlistener

login

if logged in

create roster object

get roster from connection

set subscription mode

set roster listener

get rostergroups

set chat manager

Thank you very much for the psuedo-code! very much appreciated ! i wish a good day to all !