Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When session is logout and on session relogin PresenceManager doesn't fire available status #17

Open
danigb opened this issue Mar 11, 2011 · 3 comments
Labels
Milestone

Comments

@danigb
Copy link
Member

danigb commented Mar 11, 2011

Reported by [email protected], Jan 25, 2011
What steps will reproduce the problem?

  1. Logout from the session
  2. Connection error or disconnected
  3. Relogin using this session

What is the expected output? What do you see instead?
On session relogin the Presence Manager should fire available. The PresenceManager doesn't fire available presence.
In source code the PresenceManager fire presence available if the session state is "rosterReady". But in XmppRosterLogin, the session rosterReady state is changed only once, based on boolean "rosterReady". May be, if you have missed to change the boolean "rosterReady" to false when the session state is loggginOut,error,disconnected.

What version of the product are you using? On what operating system?

@danigb
Copy link
Member Author

danigb commented Mar 11, 2011

Comment 1 by project member danigb, Jan 25, 2011
Thanks! We will work on that one. Can you give more details about where in the source code is that bug? (patches welcomed)
Bests,
Dani

@danigb
Copy link
Member Author

danigb commented Mar 11, 2011

Comment 3 by [email protected], Jan 25, 2011
This patches sets the rosterReady flag to true. It is never changed eventhough the session is logout. The rosterReady flag is set in XmppRosterBoilerplate.java constructor and used in XmppRosterLogin.java. May this patches be clear????

code patches.
rosterReady is set to "true"

XmppRosterLogic.java
public void reRequestRoster() {
if (session.getCurrentUser() != null) {
IQ iq = new IQ(IQ.Type.get, null).WithQuery("jabber:iq:roster");
session.sendIQ("roster", iq, new IQResponseHandler() {
@OverRide
public void onIQ(IQ iq) {
if (IQ.isSuccess(iq)) {
clearGroupAll();
final List<? extends IPacket> children = iq.getFirstChild("query").getChildren();
for (final IPacket child : children) {
final RosterItem item = RosterItem.parse(child);
storeItem(item);
}
if (!rosterReady) {
rosterReady = true;
session.setSessionState(SessionStates.rosterReady);
}
eventBus.fireEvent(new RosterRetrievedEvent(getItems()));
} else {
eventBus
.fireEvent(new RequestFailedEvent("roster request", "couldn't retrieve the roster", iq));
}
}
});
}

@vtsaplin
Copy link

Hi,
The 'rosterReady' state is not only affecting the PresenceManager behavior. The important 'ready' state is also fired only once at your first login because it is fired right after the 'rosterReady' state is fired. In addition when you logout the roster is still ready which cannot be true. I don't know whether the actual patch was provided or not but here is the code for the patch:

XmppRosterLogic.java
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
session.addSessionStateChangedHandler(true, new StateChangedHandler() {
@OverRide
public void onStateChanged(final StateChangedEvent event) {
if (event.is(SessionStates.loggedIn)) {
reRequestRoster();
} else if (event.is(SessionStates.disconnected)) { // +++ this was added +++
rosterReady = false; // +++ this was added +++
}
}
});
Best,
Vitaly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants