Commit 8c7aee5a authored by Daniel Henninger's avatar Daniel Henninger Committed by dhenninger

Fixed multi-resource login support. Not entirely tested yet. Also minor...

Fixed multi-resource login support.  Not entirely tested yet.  Also minor tweak collection handling.

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk/src/plugins/gateway@4950 b35dd754-fafc-0310-a699-88a17e54d16e
parent b6523b0d
...@@ -194,7 +194,7 @@ public abstract class BaseTransport implements Component { ...@@ -194,7 +194,7 @@ public abstract class BaseTransport implements Component {
try { try {
if (to.getNode() == null) { if (to.getNode() == null) {
Collection<Registration> registrations = registrationManager.getRegistrations(from, this.transportType); Collection<Registration> registrations = registrationManager.getRegistrations(from, this.transportType);
if (!registrations.iterator().hasNext()) { if (registrations.isEmpty()) {
// User is not registered with us. // User is not registered with us.
Log.debug("Unable to find registration."); Log.debug("Unable to find registration.");
return reply; return reply;
...@@ -212,7 +212,7 @@ public abstract class BaseTransport implements Component { ...@@ -212,7 +212,7 @@ public abstract class BaseTransport implements Component {
session.updateStatus(getPresenceType(packet), packet.getStatus()); session.updateStatus(getPresenceType(packet), packet.getStatus());
} }
catch (NotFoundException e) { catch (NotFoundException e) {
session = this.registrationLoggedIn(registration, from, getPresenceType(packet), packet.getStatus()); session = this.registrationLoggedIn(registration, from, getPresenceType(packet), packet.getStatus(), packet.getPriority());
//sessionManager.storeSession(registration.getJID(), session); //sessionManager.storeSession(registration.getJID(), session);
sessionManager.storeSession(from, session); sessionManager.storeSession(from, session);
} }
...@@ -1031,7 +1031,7 @@ public abstract class BaseTransport implements Component { ...@@ -1031,7 +1031,7 @@ public abstract class BaseTransport implements Component {
* @param verboseStatus Longer status description. * @param verboseStatus Longer status description.
* @return A session instance for the new login. * @return A session instance for the new login.
*/ */
public abstract TransportSession registrationLoggedIn(Registration registration, JID jid, PresenceType presenceType, String verboseStatus); public abstract TransportSession registrationLoggedIn(Registration registration, JID jid, PresenceType presenceType, String verboseStatus, Integer priority);
/** /**
* Will handle logging out of the legacy service. * Will handle logging out of the legacy service.
......
...@@ -35,9 +35,12 @@ public class MSNSession extends TransportSession { ...@@ -35,9 +35,12 @@ public class MSNSession extends TransportSession {
* Create a MSN Session instance. * Create a MSN Session instance.
* *
* @param registration Registration informationed used for logging in. * @param registration Registration informationed used for logging in.
* @param jid JID associated with this session.
* @param transport Transport instance associated with this session.
* @param priority Priority of this session.
*/ */
public MSNSession(Registration registration, JID jid, MSNTransport transport) { public MSNSession(Registration registration, JID jid, MSNTransport transport, Integer priority) {
super(registration, jid, transport); super(registration, jid, transport, priority);
msnMessenger = MsnMessengerFactory.createMsnMessenger(registration.getUsername(), registration.getPassword()); msnMessenger = MsnMessengerFactory.createMsnMessenger(registration.getUsername(), registration.getPassword());
msnMessenger.setSupportedProtocol(new MsnProtocol[] { MsnProtocol.MSNP11 }); msnMessenger.setSupportedProtocol(new MsnProtocol[] { MsnProtocol.MSNP11 });
......
...@@ -37,9 +37,9 @@ public class MSNTransport extends BaseTransport { ...@@ -37,9 +37,9 @@ public class MSNTransport extends BaseTransport {
* @param presenceType Type of presence. * @param presenceType Type of presence.
* @param verboseStatus Longer status description. * @param verboseStatus Longer status description.
*/ */
public TransportSession registrationLoggedIn(Registration registration, JID jid, PresenceType presenceType, String verboseStatus) { public TransportSession registrationLoggedIn(Registration registration, JID jid, PresenceType presenceType, String verboseStatus, Integer priority) {
Log.debug("Logging in to MSN gateway."); Log.debug("Logging in to MSN gateway.");
TransportSession session = new MSNSession(registration, jid, this); TransportSession session = new MSNSession(registration, jid, this, priority);
// Thread sessionThread = new Thread(session); // Thread sessionThread = new Thread(session);
// sessionThread.start(); // sessionThread.start();
((MSNSession)session).logIn(presenceType, verboseStatus); ((MSNSession)session).logIn(presenceType, verboseStatus);
......
...@@ -52,10 +52,12 @@ public class OSCARSession extends TransportSession { ...@@ -52,10 +52,12 @@ public class OSCARSession extends TransportSession {
* Initialize a new session object for OSCAR * Initialize a new session object for OSCAR
* *
* @param registration The registration information to use during login. * @param registration The registration information to use during login.
* @param jid The JID associated with this session.
* @param transport The transport that created this session. * @param transport The transport that created this session.
* @param priority Priority of this session.
*/ */
public OSCARSession(Registration registration, JID jid, OSCARTransport transport) { public OSCARSession(Registration registration, JID jid, OSCARTransport transport, Integer priority) {
super(registration, jid, transport); super(registration, jid, transport, priority);
} }
private BOSConnection bosConn = null; private BOSConnection bosConn = null;
......
...@@ -34,8 +34,8 @@ public class OSCARTransport extends BaseTransport { ...@@ -34,8 +34,8 @@ public class OSCARTransport extends BaseTransport {
* @param presenceType Type of presence. * @param presenceType Type of presence.
* @param verboseStatus Longer status description. * @param verboseStatus Longer status description.
*/ */
public TransportSession registrationLoggedIn(Registration registration, JID jid, PresenceType presenceType, String verboseStatus) { public TransportSession registrationLoggedIn(Registration registration, JID jid, PresenceType presenceType, String verboseStatus, Integer priority) {
TransportSession session = new OSCARSession(registration, jid, this); TransportSession session = new OSCARSession(registration, jid, this, priority);
// Thread sessionThread = new Thread(session); // Thread sessionThread = new Thread(session);
// sessionThread.start(); // sessionThread.start();
((OSCARSession)session).logIn(presenceType, verboseStatus); ((OSCARSession)session).logIn(presenceType, verboseStatus);
......
...@@ -43,9 +43,12 @@ public class YahooSession extends TransportSession { ...@@ -43,9 +43,12 @@ public class YahooSession extends TransportSession {
* Create a Yahoo Session instance. * Create a Yahoo Session instance.
* *
* @param registration Registration informationed used for logging in. * @param registration Registration informationed used for logging in.
* @param jid JID associated with this session.
* @param transport Transport instance associated with this session
* @param priority Priority of this session
*/ */
public YahooSession(Registration registration, JID jid, YahooTransport transport) { public YahooSession(Registration registration, JID jid, YahooTransport transport, Integer priority) {
super(registration, jid, transport); super(registration, jid, transport, priority);
yahooSession = new Session(); yahooSession = new Session();
yahooSession.addSessionListener(new YahooSessionListener(this)); yahooSession.addSessionListener(new YahooSessionListener(this));
......
...@@ -37,9 +37,9 @@ public class YahooTransport extends BaseTransport { ...@@ -37,9 +37,9 @@ public class YahooTransport extends BaseTransport {
* @param presenceType Type of presence. * @param presenceType Type of presence.
* @param verboseStatus Longer status description. * @param verboseStatus Longer status description.
*/ */
public TransportSession registrationLoggedIn(Registration registration, JID jid, PresenceType presenceType, String verboseStatus) { public TransportSession registrationLoggedIn(Registration registration, JID jid, PresenceType presenceType, String verboseStatus, Integer priority) {
Log.debug("Logging in to Yahoo gateway."); Log.debug("Logging in to Yahoo gateway.");
TransportSession session = new YahooSession(registration, jid, this); TransportSession session = new YahooSession(registration, jid, this, priority);
// Thread sessionThread = new Thread(session); // Thread sessionThread = new Thread(session);
// sessionThread.start(); // sessionThread.start();
((YahooSession)session).logIn(presenceType, verboseStatus); ((YahooSession)session).logIn(presenceType, verboseStatus);
......
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