zhongxan / emite

Automatically exported from code.google.com/p/emite
0 stars 0 forks source link

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

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
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?
emite0.6 . Fedora13

Please provide any additional information below.

Original issue reported on code.google.com by jiunara...@gmail.com on 25 Jan 2011 at 10:03

GoogleCodeExporter commented 8 years ago
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

Original comment by danigb on 25 Jan 2011 at 10:32

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
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));
            }
        }
        });
    }

Original comment by jiunara...@gmail.com on 25 Jan 2011 at 1:42