Commit 72136c79 authored by Daniel Henninger's avatar Daniel Henninger Committed by dhenninger

[GATE-185] Catching forced disconnect from MSN.

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk/src/plugins/gateway@7488 b35dd754-fafc-0310-a699-88a17e54d16e
parent c19ce847
......@@ -181,6 +181,9 @@
## Removed key: 'gateway.web.registrations.regsuccess'
## Removed key: 'gateway.web.registrations.regfailure'
## Added key: 'global.delete'
##
## 1.0
## Added key: 'gateway.msn.otherloggedin'
# Temporary Tags Until Fixed Properly
......@@ -243,6 +246,7 @@ gateway.msn.illegalaccount=You are registered with the MSN transport with an ill
gateway.msn.disconnect=You were disconnected from the MSN service.
gateway.msn.wink=You have received an MSN wink.
gateway.msn.nudge=You have received an MSN nudge.
gateway.msn.otherloggedin=You were disconnected from MSN because your account signed in at another location.
# Yahoo Transport
gateway.yahoo.shortservice=Yahoo
......
......@@ -161,4 +161,5 @@ gateway.web.registrations.invaliduser=Invalid username specified for legacy serv
gateway.web.registrations.deletesuccess=Registration successfully deleted.
gateway.web.registrations.updatesuccess=Registration successfully updated.
gateway.web.registrations.addsuccess=Registration successfully added.
global.delete=Delete
\ No newline at end of file
global.delete=Delete
gateway.msn.otherloggedin=You were disconnected from MSN because your account signed in at another location.
\ No newline at end of file
......@@ -161,4 +161,5 @@ gateway.web.registrations.invaliduser=Invalid username specified for legacy serv
gateway.web.registrations.deletesuccess=Registration successfully deleted.
gateway.web.registrations.updatesuccess=Registration successfully updated.
gateway.web.registrations.addsuccess=Registration successfully added.
global.delete=Delete
\ No newline at end of file
global.delete=Delete
gateway.msn.otherloggedin=You were disconnected from MSN because your account signed in at another location.
\ No newline at end of file
......@@ -161,4 +161,5 @@ gateway.web.registrations.invaliduser=Invalid username specified for legacy serv
gateway.web.registrations.deletesuccess=Registration successfully deleted.
gateway.web.registrations.updatesuccess=Registration successfully updated.
gateway.web.registrations.addsuccess=Registration successfully added.
global.delete=Delete
\ No newline at end of file
global.delete=Delete
gateway.msn.otherloggedin=You were disconnected from MSN because your account signed in at another location.
\ No newline at end of file
......@@ -161,4 +161,5 @@ gateway.web.registrations.invaliduser=Invalid username specified for legacy serv
gateway.web.registrations.deletesuccess=Registration successfully deleted.
gateway.web.registrations.updatesuccess=Registration successfully updated.
gateway.web.registrations.addsuccess=Registration successfully added.
global.delete=Delete
\ No newline at end of file
global.delete=Delete
gateway.msn.otherloggedin=You were disconnected from MSN because your account signed in at another location.
\ No newline at end of file
......@@ -395,14 +395,14 @@ public class MSNSession extends TransportSession {
* @see org.jivesoftware.wildfire.gateway.TransportSession#sendChatState(org.xmpp.packet.JID, org.jivesoftware.wildfire.gateway.ChatStateType)
*/
public void sendChatState(JID jid, ChatStateType chatState) {
Email jidEmail = Email.parseStr(getTransport().convertJIDToID(jid));
MsnControlMessage mcm = new MsnControlMessage();
if (chatState.equals(ChatStateType.composing)) {
Email jidEmail = Email.parseStr(getTransport().convertJIDToID(jid));
MsnControlMessage mcm = new MsnControlMessage();
mcm.setTypingUser(msnMessenger.getOwner().getEmail().getEmailAddress());
}
for (MsnSwitchboard sb : msnMessenger.getActiveSwitchboards()) {
if (sb.containContact(jidEmail)) {
sb.sendMessage(mcm, true);
for (MsnSwitchboard sb : msnMessenger.getActiveSwitchboards()) {
if (sb.containContact(jidEmail)) {
sb.sendMessage(mcm, true);
}
}
}
}
......
......@@ -14,6 +14,7 @@ import net.sf.cindy.SessionAdapter;
import net.sf.cindy.Session;
import net.sf.cindy.Message;
import org.jivesoftware.util.Log;
import org.jivesoftware.util.LocaleUtils;
/**
* MSN Session Listener Interface.
......@@ -40,6 +41,27 @@ public class MsnSessionListener extends SessionAdapter {
public void messageReceived(Session arg0, Message message) throws Exception {
Log.debug("MSN: Session messageReceived for "+msnSession.getRegistration().getUsername()+" : "+message);
// TODO: Kinda hacky, would like to improve on this later.
if (message.equals("OUT OTH")) {
// Forced disconnect because account logged in elsewhere
msnSession.getTransport().sendMessage(
msnSession.getJIDWithHighestPriority(),
msnSession.getTransport().getJID(),
LocaleUtils.getLocalizedString("gateway.msn.otherloggedin", "gateway"),
org.xmpp.packet.Message.Type.error
);
msnSession.logOut();
}
else if (message.equals("OUT SDH")) {
// Forced disconnect from server for maintenance
msnSession.getTransport().sendMessage(
msnSession.getJIDWithHighestPriority(),
msnSession.getTransport().getJID(),
LocaleUtils.getLocalizedString("gateway.msn.disconnect", "gateway"),
org.xmpp.packet.Message.Type.error
);
msnSession.logOut();
}
}
public void messageSent(Session arg0, Message message) throws Exception {
......
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