Commit d82df9ea authored by Daniel Henninger's avatar Daniel Henninger Committed by dhenninger

[GATE-76] Fixed stupid placement bug that left multiple sessions logged in.

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk/src/plugins/gateway@5588 b35dd754-fafc-0310-a699-88a17e54d16e
parent f73049f3
......@@ -61,6 +61,7 @@ public class OSCARSession extends TransportSession {
}
private BOSConnection bosConn = null;
private LoginConnection loginConn = null;
private Set<ServiceConnection> services = new HashSet<ServiceConnection>();
private PresenceType presenceType = null;
private String verboseStatus = null;
......@@ -74,9 +75,9 @@ public class OSCARSession extends TransportSession {
private Integer highestGroupId = -1;
public void logIn(PresenceType presenceType, String verboseStatus) {
setLoginStatus(TransportLoginStatus.LOGGING_IN);
if (!isLoggedIn()) {
LoginConnection loginConn = new LoginConnection(new ConnDescriptor("login.oscar.aol.com", 5190), this);
setLoginStatus(TransportLoginStatus.LOGGING_IN);
loginConn = new LoginConnection(new ConnDescriptor("login.oscar.aol.com", 5190), this);
loginConn.connect();
this.presenceType = presenceType;
......@@ -88,17 +89,42 @@ public class OSCARSession extends TransportSession {
}
public synchronized void logOut() {
setLoginStatus(TransportLoginStatus.LOGGING_OUT);
if (isLoggedIn()) {
setLoginStatus(TransportLoginStatus.LOGGING_OUT);
if (loginConn != null) {
loginConn.disconnect();
loginConn = null;
}
if (bosConn != null) {
bosConn.disconnect();
bosConn = null;
}
for (ServiceConnection conn : getServiceConnections()) {
try {
conn.disconnect();
}
catch (Exception e) {
// Ignore.
}
try {
services.remove(conn);
}
catch (Exception e) {
// Ignore.
}
try {
snacMgr.unregister(conn);
}
catch (Exception e) {
// Ignore.
}
}
Presence p = new Presence(Presence.Type.unavailable);
p.setTo(getJID());
p.setFrom(getTransport().getJID());
getTransport().sendPacket(p);
setLoginStatus(TransportLoginStatus.LOGGED_OUT);
}
setLoginStatus(TransportLoginStatus.LOGGED_OUT);
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment