Commit 23885647 authored by Matt Tucker's avatar Matt Tucker Committed by matt

Don't send two messages during bounce, just an error.


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@897 b35dd754-fafc-0310-a699-88a17e54d16e
parent d3afd192
...@@ -18,7 +18,7 @@ import org.xmpp.packet.Message; ...@@ -18,7 +18,7 @@ import org.xmpp.packet.Message;
import org.xmpp.packet.PacketError; import org.xmpp.packet.PacketError;
/** /**
* <p>Implements the strategy as a basic server module.</p> * Controls what is done with offline messages.
* *
* @author Iain Shigeoka * @author Iain Shigeoka
*/ */
...@@ -28,7 +28,6 @@ public class OfflineMessageStrategy extends BasicModule { ...@@ -28,7 +28,6 @@ public class OfflineMessageStrategy extends BasicModule {
private static Type type = Type.store_and_bounce; private static Type type = Type.store_and_bounce;
private SessionManager sessionManager; private SessionManager sessionManager;
private XMPPServer xmppServer;
private OfflineMessageStore messageStore; private OfflineMessageStore messageStore;
public OfflineMessageStrategy() { public OfflineMessageStrategy() {
...@@ -103,14 +102,7 @@ public class OfflineMessageStrategy extends BasicModule { ...@@ -103,14 +102,7 @@ public class OfflineMessageStrategy extends BasicModule {
private void bounce(Message message) { private void bounce(Message message) {
// Generate a rejection response to the sender // Generate a rejection response to the sender
try { try {
Message response = new Message();
response.setTo(message.getFrom());
response.setFrom(xmppServer.createJID(null, null));
response.setBody("Message could not be delivered to " + message.getTo() +
". User is offline or unreachable.");
Session session = sessionManager.getSession(message.getFrom()); Session session = sessionManager.getSession(message.getFrom());
session.getConnection().deliver(response);
Message errorResponse = message.createCopy(); Message errorResponse = message.createCopy();
errorResponse.setError(new PacketError(PacketError.Condition.item_not_found, errorResponse.setError(new PacketError(PacketError.Condition.item_not_found,
...@@ -124,7 +116,6 @@ public class OfflineMessageStrategy extends BasicModule { ...@@ -124,7 +116,6 @@ public class OfflineMessageStrategy extends BasicModule {
public void initialize(XMPPServer server) { public void initialize(XMPPServer server) {
super.initialize(server); super.initialize(server);
xmppServer = server;
messageStore = server.getOfflineMessageStore(); messageStore = server.getOfflineMessageStore();
sessionManager = server.getSessionManager(); sessionManager = server.getSessionManager();
......
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