Quantcast
Channel: Ignite Realtime : Discussion List - All Communities
Viewing all articles
Browse latest Browse all 10742

Why am I getting status as subscribe when the recipient subscription mode is set to accept_all?

$
0
0

User  named tester added another user sanika in his roster as :

        String group[]={"Friend List"};

        r.createGroup("Friend List");

        r.createEntry("sanika@sanika.com","sanika", group);

 

The subscription mode for sanika is set to be Roster.SubscriptionMode.accept_all. But when tester checks the status of sanika he gets subscribe. Why is that ?

In the function main,sanika sets her status and in the function connectTester tester,tries to get the status of sanika.

 

publicstaticvoid main(String[] args){
        
try{
            
Connection connection =newXMPPConnection("localhost");
             connection
.connect();
             connection
.login("sanika","tester");

            
Roster r = connection.getRoster();

             r
.setSubscriptionMode(Roster.SubscriptionMode.accept_all);

            
Presence p =newPresence(Presence.Type.available);
             p
.setStatus("Having Lunch :)");

             connection
.sendPacket(p);

             connectTester
();

            
Thread.sleep(30000);

        
}   catch(Exception exc){
              exc
.printStackTrace();
            
}  
}

   
publicstaticvoid connectTester(){
       
try{
            
Connection connection =newXMPPConnection("localhost");
             connection
.connect();
             connection
.login("tester","tester");

           
Roster r = connection.getRoster();
           
RosterEntry re = r.getEntry("sanika@sanika.com");
           
System.out.println(re.getStatus().toString());
           
// PRINTS SUBSCRIBE

       
}catch(Exception exc){}

 

Where am I making a mistake ?


Viewing all articles
Browse latest Browse all 10742

Trending Articles