This Question is Answered

7 Replies Last post: May 16, 2008 4:25 AM by thewildprophet  
thewildprophet Bronze 13 posts since
Apr 12, 2008
Currently Being Moderated

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

 

 

Sabine Dinis Blochberger Gold 285 posts since
Oct 21, 2005
Currently Being Moderated
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);

 

Marcelo Zabalet Bronze 19 posts since
Apr 29, 2008
Currently Being Moderated
May 15, 2008 7:34 AM in response to: Sabine Dinis Blochberger
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);

 

 

Marcelo Zabalet Bronze 19 posts since
Apr 29, 2008
Currently Being Moderated
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.

Sabine Dinis Blochberger Gold 285 posts since
Oct 21, 2005
Currently Being Moderated
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

More Like This

  • Retrieving data ...