Commit 29bb43c3 authored by Daniel Henninger's avatar Daniel Henninger Committed by dhenninger

[GATE-114] Returned to having persistent roster items for transports.

[GATE-115] If a special flag is sent during registration, we don't put the transport in the user's roster.
[GATE-116] If you are registered with the transport, disco info now indicates as such.
[GATE-117] Presence for the transport is always sent on to the client (if a session is active)
Legacy mode and non-persistent transport items are now extinct.

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@6013 b35dd754-fafc-0310-a699-88a17e54d16e
parent e660a9d7
...@@ -161,32 +161,6 @@ public class TransportInstance implements PropertyEventListener { ...@@ -161,32 +161,6 @@ public class TransportInstance implements PropertyEventListener {
running = false; running = false;
} }
/**
* Enables legacy roster mode on the transport.
*/
public void enableLegacyMode() {
if (!running || transport == null) {
return;
}
Log.info("Enabling legacy mode: "+type.toString());
transport.setLegacyMode(true);
}
/**
* Disables legacy roster mode on the transport.
*/
public void disableLegacyMode() {
if (!running || transport == null) {
return;
}
Log.info("Disabling legacy mode: "+type.toString());
transport.setLegacyMode(false);
}
/** /**
* Retrieves actual transport associated with this instance. * Retrieves actual transport associated with this instance.
* *
...@@ -221,19 +195,6 @@ public class TransportInstance implements PropertyEventListener { ...@@ -221,19 +195,6 @@ public class TransportInstance implements PropertyEventListener {
} }
} }
} }
else if (property.equals("plugin.gateway.legacymode")) {
enabled = Boolean.parseBoolean((String)params.get("value"));
if (enabled) {
if (!running) {
enableLegacyMode();
}
}
else {
if (running) {
disableLegacyMode();
}
}
}
} }
} }
...@@ -254,11 +215,6 @@ public class TransportInstance implements PropertyEventListener { ...@@ -254,11 +215,6 @@ public class TransportInstance implements PropertyEventListener {
} }
} }
} }
else if (property.equals("plugin.gateway.legacymode")) {
if (running) {
disableLegacyMode();
}
}
} }
} }
......
...@@ -71,12 +71,10 @@ public class IRCListener implements IRCEventListener { ...@@ -71,12 +71,10 @@ public class IRCListener implements IRCEventListener {
public void onRegistered() { public void onRegistered() {
Log.debug("IRC registered"); Log.debug("IRC registered");
getSession().getRegistration().setLastLogin(new Date()); getSession().getRegistration().setLastLogin(new Date());
if (getSession().getTransport().getLegacyMode()) {
Presence p = new Presence(); Presence p = new Presence();
p.setFrom(getSession().getTransport().getJID()); p.setFrom(getSession().getTransport().getJID());
p.setTo(getSession().getJID()); p.setTo(getSession().getJID());
getSession().getTransport().sendPacket(p); getSession().getTransport().sendPacket(p);
}
statusCheck = new StatusCheck(); statusCheck = new StatusCheck();
timer.schedule(statusCheck, timerInterval, timerInterval); timer.schedule(statusCheck, timerInterval, timerInterval);
getSession().setLoginStatus(TransportLoginStatus.LOGGED_IN); getSession().setLoginStatus(TransportLoginStatus.LOGGED_IN);
...@@ -84,12 +82,10 @@ public class IRCListener implements IRCEventListener { ...@@ -84,12 +82,10 @@ public class IRCListener implements IRCEventListener {
public void onDisconnected() { public void onDisconnected() {
Log.debug("IRC disconnected"); Log.debug("IRC disconnected");
if (getSession().getTransport().getLegacyMode()) {
Presence p = new Presence(Presence.Type.unavailable); Presence p = new Presence(Presence.Type.unavailable);
p.setTo(getSession().getJID()); p.setTo(getSession().getJID());
p.setFrom(getSession().getTransport().getJID()); p.setFrom(getSession().getTransport().getJID());
getSession().getTransport().sendPacket(p); getSession().getTransport().sendPacket(p);
}
getSession().getConnection().close(); getSession().getConnection().close();
timer.cancel(); timer.cancel();
getSession().setLoginStatus(TransportLoginStatus.LOGGED_OUT); getSession().setLoginStatus(TransportLoginStatus.LOGGED_OUT);
...@@ -188,12 +184,10 @@ public class IRCListener implements IRCEventListener { ...@@ -188,12 +184,10 @@ public class IRCListener implements IRCEventListener {
public void onQuit(IRCUser ircUser, String string) { public void onQuit(IRCUser ircUser, String string) {
Log.debug("IRC quit: "+ircUser+", "+string); Log.debug("IRC quit: "+ircUser+", "+string);
if (getSession().getTransport().getLegacyMode()) {
Presence p = new Presence(Presence.Type.unavailable); Presence p = new Presence(Presence.Type.unavailable);
p.setTo(getSession().getJID()); p.setTo(getSession().getJID());
p.setFrom(getSession().getTransport().getJID()); p.setFrom(getSession().getTransport().getJID());
getSession().getTransport().sendPacket(p); getSession().getTransport().sendPacket(p);
}
getSession().getConnection().close(); getSession().getConnection().close();
getSession().setLoginStatus(TransportLoginStatus.LOGGED_OUT); getSession().setLoginStatus(TransportLoginStatus.LOGGED_OUT);
} }
......
...@@ -166,16 +166,13 @@ public class IRCSession extends TransportSession { ...@@ -166,16 +166,13 @@ public class IRCSession extends TransportSession {
String awayMsg = ((IRCTransport)getTransport()).convertJabStatusToIRC(presenceType, verboseStatus); String awayMsg = ((IRCTransport)getTransport()).convertJabStatusToIRC(presenceType, verboseStatus);
if (awayMsg == null) { if (awayMsg == null) {
conn.doAway(); conn.doAway();
if (getTransport().getLegacyMode()) {
Presence p = new Presence(); Presence p = new Presence();
p.setTo(getJID()); p.setTo(getJID());
p.setFrom(getTransport().getJID()); p.setFrom(getTransport().getJID());
getTransport().sendPacket(p); getTransport().sendPacket(p);
} }
}
else { else {
conn.doAway(awayMsg); conn.doAway(awayMsg);
if (getTransport().getLegacyMode()) {
Presence p = new Presence(); Presence p = new Presence();
p.setShow(Presence.Show.away); p.setShow(Presence.Show.away);
p.setTo(getJID()); p.setTo(getJID());
...@@ -183,7 +180,6 @@ public class IRCSession extends TransportSession { ...@@ -183,7 +180,6 @@ public class IRCSession extends TransportSession {
getTransport().sendPacket(p); getTransport().sendPacket(p);
} }
} }
}
/** /**
* @see org.jivesoftware.wildfire.gateway.TransportSession#addContact(org.jivesoftware.wildfire.roster.RosterItem) * @see org.jivesoftware.wildfire.gateway.TransportSession#addContact(org.jivesoftware.wildfire.roster.RosterItem)
......
...@@ -170,14 +170,12 @@ public class MSNListener extends MsnAdapter { ...@@ -170,14 +170,12 @@ public class MSNListener extends MsnAdapter {
* Owner status has changed. * Owner status has changed.
*/ */
public void ownerStatusChanged(MsnMessenger messenger) { public void ownerStatusChanged(MsnMessenger messenger) {
if (msnSession.getTransport().getLegacyMode()) {
Presence p = new Presence(); Presence p = new Presence();
p.setTo(msnSession.getJID()); p.setTo(msnSession.getJID());
p.setFrom(msnSession.getTransport().getJID()); p.setFrom(msnSession.getTransport().getJID());
((MSNTransport)msnSession.getTransport()).setUpPresencePacket(p, messenger.getOwner().getStatus()); ((MSNTransport)msnSession.getTransport()).setUpPresencePacket(p, messenger.getOwner().getStatus());
msnSession.getTransport().sendPacket(p); msnSession.getTransport().sendPacket(p);
} }
}
/** /**
* Catches MSN exceptions. * Catches MSN exceptions.
......
...@@ -101,12 +101,10 @@ public class MSNSession extends TransportSession { ...@@ -101,12 +101,10 @@ public class MSNSession extends TransportSession {
setLoginStatus(TransportLoginStatus.LOGGING_OUT); setLoginStatus(TransportLoginStatus.LOGGING_OUT);
msnMessenger.logout(); msnMessenger.logout();
} }
if (getTransport().getLegacyMode()) {
Presence p = new Presence(Presence.Type.unavailable); Presence p = new Presence(Presence.Type.unavailable);
p.setTo(getJID()); p.setTo(getJID());
p.setFrom(getTransport().getJID()); p.setFrom(getTransport().getJID());
getTransport().sendPacket(p); getTransport().sendPacket(p);
}
setLoginStatus(TransportLoginStatus.LOGGED_OUT); setLoginStatus(TransportLoginStatus.LOGGED_OUT);
} }
......
...@@ -123,12 +123,10 @@ public class BOSConnection extends BasicFlapConnection { ...@@ -123,12 +123,10 @@ public class BOSConnection extends BasicFlapConnection {
request(new ActivateSsiCmd()); request(new ActivateSsiCmd());
clientReady(); clientReady();
if (oscarSession.getTransport().getLegacyMode()) {
Presence p = new Presence(); Presence p = new Presence();
p.setTo(oscarSession.getJID()); p.setTo(oscarSession.getJID());
p.setFrom(oscarSession.getTransport().getJID()); p.setFrom(oscarSession.getTransport().getJID());
oscarSession.getTransport().sendPacket(p); oscarSession.getTransport().sendPacket(p);
}
oscarSession.setLoginStatus(TransportLoginStatus.LOGGED_IN); oscarSession.setLoginStatus(TransportLoginStatus.LOGGED_IN);
oscarSession.gotCompleteSSI(); oscarSession.gotCompleteSSI();
......
...@@ -165,13 +165,11 @@ public class LoginConnection extends BaseFlapConnection { ...@@ -165,13 +165,11 @@ public class LoginConnection extends BaseFlapConnection {
m.setBody(errormsg); m.setBody(errormsg);
getMainSession().getTransport().sendPacket(m); getMainSession().getTransport().sendPacket(m);
if (getMainSession().getTransport().getLegacyMode()) {
Presence p = new Presence(); Presence p = new Presence();
p.setTo(getMainSession().getJID()); p.setTo(getMainSession().getJID());
p.setFrom(getMainSession().getTransport().getJID()); p.setFrom(getMainSession().getTransport().getJID());
p.setType(Presence.Type.unavailable); p.setType(Presence.Type.unavailable);
getMainSession().getTransport().sendPacket(p); getMainSession().getTransport().sendPacket(p);
}
getMainSession().setLoginStatus(TransportLoginStatus.LOGGED_OUT); getMainSession().setLoginStatus(TransportLoginStatus.LOGGED_OUT);
} }
else { else {
......
...@@ -127,12 +127,10 @@ public class OSCARSession extends TransportSession { ...@@ -127,12 +127,10 @@ public class OSCARSession extends TransportSession {
// Ignore. // Ignore.
} }
} }
if (getTransport().getLegacyMode()) {
Presence p = new Presence(Presence.Type.unavailable); Presence p = new Presence(Presence.Type.unavailable);
p.setTo(getJID()); p.setTo(getJID());
p.setFrom(getTransport().getJID()); p.setFrom(getTransport().getJID());
getTransport().sendPacket(p); getTransport().sendPacket(p);
}
setLoginStatus(TransportLoginStatus.LOGGED_OUT); setLoginStatus(TransportLoginStatus.LOGGED_OUT);
} }
} }
...@@ -475,23 +473,19 @@ public class OSCARSession extends TransportSession { ...@@ -475,23 +473,19 @@ public class OSCARSession extends TransportSession {
awayMsg = verboseStatus; awayMsg = verboseStatus;
} }
request(new SetInfoCmd(new InfoData(awayMsg, null, MY_CAPS, null))); request(new SetInfoCmd(new InfoData(awayMsg, null, MY_CAPS, null)));
if (getTransport().getLegacyMode()) {
Presence p = new Presence(); Presence p = new Presence();
p.setShow(Presence.Show.away); p.setShow(Presence.Show.away);
p.setTo(getJID()); p.setTo(getJID());
p.setFrom(getTransport().getJID()); p.setFrom(getTransport().getJID());
getTransport().sendPacket(p); getTransport().sendPacket(p);
} }
}
else { else {
request(new SetInfoCmd(new InfoData(InfoData.NOT_AWAY, null, MY_CAPS, null))); request(new SetInfoCmd(new InfoData(InfoData.NOT_AWAY, null, MY_CAPS, null)));
if (getTransport().getLegacyMode()) {
Presence p = new Presence(); Presence p = new Presence();
p.setTo(getJID()); p.setTo(getJID());
p.setFrom(getTransport().getJID()); p.setFrom(getTransport().getJID());
getTransport().sendPacket(p); getTransport().sendPacket(p);
} }
}
this.presenceType = presenceType; this.presenceType = presenceType;
this.verboseStatus = verboseStatus; this.verboseStatus = verboseStatus;
......
...@@ -104,12 +104,10 @@ public class YahooSession extends TransportSession { ...@@ -104,12 +104,10 @@ public class YahooSession extends TransportSession {
yahooSession.login(registration.getUsername(), registration.getPassword()); yahooSession.login(registration.getUsername(), registration.getPassword());
setLoginStatus(TransportLoginStatus.LOGGED_IN); setLoginStatus(TransportLoginStatus.LOGGED_IN);
if (getTransport().getLegacyMode()) {
Presence p = new Presence(); Presence p = new Presence();
p.setTo(getJID()); p.setTo(getJID());
p.setFrom(getTransport().getJID()); p.setFrom(getTransport().getJID());
getTransport().sendPacket(p); getTransport().sendPacket(p);
}
yahooSession.setStatus(((YahooTransport)getTransport()).convertJabStatusToYahoo(pType)); yahooSession.setStatus(((YahooTransport)getTransport()).convertJabStatusToYahoo(pType));
...@@ -158,13 +156,11 @@ public class YahooSession extends TransportSession { ...@@ -158,13 +156,11 @@ public class YahooSession extends TransportSession {
Log.debug("Failed to log out from Yahoo."); Log.debug("Failed to log out from Yahoo.");
} }
yahooSession.reset(); yahooSession.reset();
if (getTransport().getLegacyMode()) {
Presence p = new Presence(Presence.Type.unavailable); Presence p = new Presence(Presence.Type.unavailable);
p.setTo(getJID()); p.setTo(getJID());
p.setFrom(getTransport().getJID()); p.setFrom(getTransport().getJID());
getTransport().sendPacket(p); getTransport().sendPacket(p);
} }
}
/** /**
* Syncs up the yahoo roster with the jabber roster. * Syncs up the yahoo roster with the jabber roster.
......
...@@ -94,7 +94,7 @@ ...@@ -94,7 +94,7 @@
return; return;
} }
try { try {
plugin.getTransportInstance(typeStr).getTransport().addNewRegistration(jid, username, password, nickname); plugin.getTransportInstance(typeStr).getTransport().addNewRegistration(jid, username, password, nickname, false);
response.sendRedirect("gateway-registrations.jsp?success=true"); response.sendRedirect("gateway-registrations.jsp?success=true");
return; return;
} }
......
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