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
.
`public static void main(String[] args) {
try {
Connection connection = new XMPPConnection(“localhost”);
connection.connect();
connection.login(“sanika”, “tester”);
Roster r = connection.getRoster();
r.setSubscriptionMode(Roster.SubscriptionMode.accept_all);
Presence p = new Presence(Presence.Type.available);
p.setStatus("Having Lunch :)");
connection.sendPacket(p);
connectTester();
Thread.sleep(30000);
} catch(Exception exc) {
exc.printStackTrace();
}
}
public static void connectTester() {
try {
Connection connection = new XMPPConnection("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 ?