This Question is Answered

7 Replies Last post: May 16, 2008 4:25 AM by thewildprophet  
Click to view thewildprophet's profile Bronze 12 posts since
Apr 12, 2008

May 9, 2008 11:17 AM

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

Click to view Op3racional's profile Gold 281 posts since
Oct 21, 2005
May 12, 2008 4:21 AM in response to: thewildprophet
Re: Roster Subsciption problem
I set the SubscriptionMode after login and initial presence, but before registering the RosterListener.

    lRoster.setSubscriptionMode(Roster.SubscriptionMode.manual);
    lRoster.addRosterListener(this);
Click to view zabalet's profile Bronze 19 posts since
Apr 29, 2008
May 15, 2008 7:34 AM in response to: Op3racional
Re: Roster Subsciption problem

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

Roster.setDefaultSubscriptionMode(Roster.SubscriptionMode.manual);

Click to view zabalet's profile Bronze 19 posts since
Apr 29, 2008
May 15, 2008 8:59 AM in response to: thewildprophet
Re: Roster Subsciption problem
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.
Click to view Op3racional's profile Gold 281 posts since
Oct 21, 2005
May 16, 2008 3:57 AM in response to: thewildprophet
Re: Roster Subsciption problem
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