Commit 6c66a7f1 authored by Daniel Henninger's avatar Daniel Henninger Committed by dhenninger

[GATE-58] Respond by saying you are not logged in when you are not.

git-svn-id: http://svn.igniterealtime.org/svn/repos/wildfire/trunk@5729 b35dd754-fafc-0310-a699-88a17e54d16e
parent 3ca1b67e
...@@ -160,31 +160,32 @@ public abstract class BaseTransport implements Component, RosterEventListener, P ...@@ -160,31 +160,32 @@ public abstract class BaseTransport implements Component, RosterEventListener, P
JID from = packet.getFrom(); JID from = packet.getFrom();
JID to = packet.getTo(); JID to = packet.getTo();
if (to.getNode() == null) {
// Message to gateway itself. Throw away for now.
try { try {
TransportSession session = sessionManager.getSession(from); TransportSession session = sessionManager.getSession(from);
if (!session.isLoggedIn()) {
Message m = new Message();
m.setError(Condition.service_unavailable);
m.setTo(from);
m.setFrom(getJID());
m.setBody("You are not currently logged into the transport.");
reply.add(m);
}
else if (to.getNode() == null) {
// Message to gateway itself. Throw away for now.
if (packet.getBody() != null) { if (packet.getBody() != null) {
session.sendServerMessage(packet.getBody()); session.sendServerMessage(packet.getBody());
} }
} }
catch (NotFoundException e) {
// TODO: Should return an error packet here
Log.debug("Unable to find session.");
}
}
else { else {
try {
TransportSession session = sessionManager.getSession(from);
if (packet.getBody() != null) { if (packet.getBody() != null) {
session.sendMessage(to, packet.getBody()); session.sendMessage(to, packet.getBody());
} }
} }
}
catch (NotFoundException e) { catch (NotFoundException e) {
// TODO: Should return an error packet here // TODO: Should return an error packet here
Log.debug("Unable to find session."); Log.debug("Unable to find session.");
} }
}
return reply; return reply;
} }
......
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