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 {
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.
*
......@@ -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 {
}
}
}
else if (property.equals("plugin.gateway.legacymode")) {
if (running) {
disableLegacyMode();
}
}
}
}
......
......@@ -71,12 +71,10 @@ public class IRCListener implements IRCEventListener {
public void onRegistered() {
Log.debug("IRC registered");
getSession().getRegistration().setLastLogin(new Date());
if (getSession().getTransport().getLegacyMode()) {
Presence p = new Presence();
p.setFrom(getSession().getTransport().getJID());
p.setTo(getSession().getJID());
getSession().getTransport().sendPacket(p);
}
statusCheck = new StatusCheck();
timer.schedule(statusCheck, timerInterval, timerInterval);
getSession().setLoginStatus(TransportLoginStatus.LOGGED_IN);
......@@ -84,12 +82,10 @@ public class IRCListener implements IRCEventListener {
public void onDisconnected() {
Log.debug("IRC disconnected");
if (getSession().getTransport().getLegacyMode()) {
Presence p = new Presence(Presence.Type.unavailable);
p.setTo(getSession().getJID());
p.setFrom(getSession().getTransport().getJID());
getSession().getTransport().sendPacket(p);
}
getSession().getConnection().close();
timer.cancel();
getSession().setLoginStatus(TransportLoginStatus.LOGGED_OUT);
......@@ -188,12 +184,10 @@ public class IRCListener implements IRCEventListener {
public void onQuit(IRCUser ircUser, String string) {
Log.debug("IRC quit: "+ircUser+", "+string);
if (getSession().getTransport().getLegacyMode()) {
Presence p = new Presence(Presence.Type.unavailable);
p.setTo(getSession().getJID());
p.setFrom(getSession().getTransport().getJID());
getSession().getTransport().sendPacket(p);
}
getSession().getConnection().close();
getSession().setLoginStatus(TransportLoginStatus.LOGGED_OUT);
}
......
......@@ -166,16 +166,13 @@ public class IRCSession extends TransportSession {
String awayMsg = ((IRCTransport)getTransport()).convertJabStatusToIRC(presenceType, verboseStatus);
if (awayMsg == null) {
conn.doAway();
if (getTransport().getLegacyMode()) {
Presence p = new Presence();
p.setTo(getJID());
p.setFrom(getTransport().getJID());
getTransport().sendPacket(p);
}
}
else {
conn.doAway(awayMsg);
if (getTransport().getLegacyMode()) {
Presence p = new Presence();
p.setShow(Presence.Show.away);
p.setTo(getJID());
......@@ -183,7 +180,6 @@ public class IRCSession extends TransportSession {
getTransport().sendPacket(p);
}
}
}
/**
* @see org.jivesoftware.wildfire.gateway.TransportSession#addContact(org.jivesoftware.wildfire.roster.RosterItem)
......
......@@ -170,14 +170,12 @@ public class MSNListener extends MsnAdapter {
* Owner status has changed.
*/
public void ownerStatusChanged(MsnMessenger messenger) {
if (msnSession.getTransport().getLegacyMode()) {
Presence p = new Presence();
p.setTo(msnSession.getJID());
p.setFrom(msnSession.getTransport().getJID());
((MSNTransport)msnSession.getTransport()).setUpPresencePacket(p, messenger.getOwner().getStatus());
msnSession.getTransport().sendPacket(p);
}
}
/**
* Catches MSN exceptions.
......
......@@ -101,12 +101,10 @@ public class MSNSession extends TransportSession {
setLoginStatus(TransportLoginStatus.LOGGING_OUT);
msnMessenger.logout();
}
if (getTransport().getLegacyMode()) {
Presence p = new Presence(Presence.Type.unavailable);
p.setTo(getJID());
p.setFrom(getTransport().getJID());
getTransport().sendPacket(p);
}
setLoginStatus(TransportLoginStatus.LOGGED_OUT);
}
......
......@@ -123,12 +123,10 @@ public class BOSConnection extends BasicFlapConnection {
request(new ActivateSsiCmd());
clientReady();
if (oscarSession.getTransport().getLegacyMode()) {
Presence p = new Presence();
p.setTo(oscarSession.getJID());
p.setFrom(oscarSession.getTransport().getJID());
oscarSession.getTransport().sendPacket(p);
}
oscarSession.setLoginStatus(TransportLoginStatus.LOGGED_IN);
oscarSession.gotCompleteSSI();
......
......@@ -165,13 +165,11 @@ public class LoginConnection extends BaseFlapConnection {
m.setBody(errormsg);
getMainSession().getTransport().sendPacket(m);
if (getMainSession().getTransport().getLegacyMode()) {
Presence p = new Presence();
p.setTo(getMainSession().getJID());
p.setFrom(getMainSession().getTransport().getJID());
p.setType(Presence.Type.unavailable);
getMainSession().getTransport().sendPacket(p);
}
getMainSession().setLoginStatus(TransportLoginStatus.LOGGED_OUT);
}
else {
......
......@@ -127,12 +127,10 @@ public class OSCARSession extends TransportSession {
// Ignore.
}
}
if (getTransport().getLegacyMode()) {
Presence p = new Presence(Presence.Type.unavailable);
p.setTo(getJID());
p.setFrom(getTransport().getJID());
getTransport().sendPacket(p);
}
setLoginStatus(TransportLoginStatus.LOGGED_OUT);
}
}
......@@ -475,23 +473,19 @@ public class OSCARSession extends TransportSession {
awayMsg = verboseStatus;
}
request(new SetInfoCmd(new InfoData(awayMsg, null, MY_CAPS, null)));
if (getTransport().getLegacyMode()) {
Presence p = new Presence();
p.setShow(Presence.Show.away);
p.setTo(getJID());
p.setFrom(getTransport().getJID());
getTransport().sendPacket(p);
}
}
else {
request(new SetInfoCmd(new InfoData(InfoData.NOT_AWAY, null, MY_CAPS, null)));
if (getTransport().getLegacyMode()) {
Presence p = new Presence();
p.setTo(getJID());
p.setFrom(getTransport().getJID());
getTransport().sendPacket(p);
}
}
this.presenceType = presenceType;
this.verboseStatus = verboseStatus;
......
......@@ -104,12 +104,10 @@ public class YahooSession extends TransportSession {
yahooSession.login(registration.getUsername(), registration.getPassword());
setLoginStatus(TransportLoginStatus.LOGGED_IN);
if (getTransport().getLegacyMode()) {
Presence p = new Presence();
p.setTo(getJID());
p.setFrom(getTransport().getJID());
getTransport().sendPacket(p);
}
yahooSession.setStatus(((YahooTransport)getTransport()).convertJabStatusToYahoo(pType));
......@@ -158,13 +156,11 @@ public class YahooSession extends TransportSession {
Log.debug("Failed to log out from Yahoo.");
}
yahooSession.reset();
if (getTransport().getLegacyMode()) {
Presence p = new Presence(Presence.Type.unavailable);
p.setTo(getJID());
p.setFrom(getTransport().getJID());
getTransport().sendPacket(p);
}
}
/**
* Syncs up the yahoo roster with the jabber roster.
......
......@@ -94,7 +94,7 @@
return;
}
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");
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