Stopped handling echos as new events
@@ -12,6 +12,7 @@ import won.bot.framework.bot.Bot;
import won.bot.framework.manager.BotManager;
import won.owner.protocol.message.OwnerCallback;
import won.protocol.message.WonMessage;
+import won.protocol.message.WonMessageDirection;
import won.protocol.model.Connection;
import won.protocol.model.Match;
@@ -43,11 +44,15 @@ public class BotOwnerCallback implements OwnerCallback {
public void onHintFromMatcher(final Match match, final WonMessage wonMessage) {
taskScheduler.schedule(new Runnable() {
public void run() {
+ if (wonMessage.getEnvelopeType() != WonMessageDirection.FROM_OWNER) {
try {
getBotForAtomUri(match.getFromAtom()).onHintFromMatcher(match, wonMessage);
} catch (Exception e) {
logger.warn("error while handling onHintFromMatcher()", e);
}
+ } else {
+ logger.debug("Received echo for onHintFromMatcher");
+ }
}
}, new Date());
}
@@ -56,13 +61,17 @@ public class BotOwnerCallback implements OwnerCallback {
public void onConnectFromOtherAtom(final Connection con, final WonMessage wonMessage) {
taskScheduler.schedule(new Runnable() {
public void run() {
+ if (wonMessage.getEnvelopeType() != WonMessageDirection.FROM_OWNER) {
try {
- logger.debug("onConnectFromOtherAtom called for connection {}, message {}", con.getConnectionURI(),
- wonMessage.getMessageURI());
+ logger.debug("onConnectFromOtherAtom called for connection {}, message {}",
+ con.getConnectionURI(), wonMessage.getMessageURI());
getBotForAtomUri(con.getAtomURI()).onConnectFromOtherAtom(con, wonMessage);
} catch (Exception e) {
logger.warn("error while handling onConnectFromOtherAtom()", e);
}
+ } else {
+ logger.debug("Received echo for onConnectFromOtherAtom");
+ }
}
}, new Date());
}
@@ -71,11 +80,15 @@ public class BotOwnerCallback implements OwnerCallback {
public void onOpenFromOtherAtom(final Connection con, final WonMessage wonMessage) {
taskScheduler.schedule(new Runnable() {
public void run() {
+ if (wonMessage.getEnvelopeType() != WonMessageDirection.FROM_OWNER) {
try {
getBotForAtomUri(con.getAtomURI()).onOpenFromOtherAtom(con, wonMessage);
} catch (Exception e) {
logger.warn("error while handling onOpenFromOtherAtom()", e);
}
+ } else {
+ logger.debug("Received echo for onOpenFromOtherAtom");
+ }
}
}, new Date());
}
@@ -84,6 +97,7 @@ public class BotOwnerCallback implements OwnerCallback {
public void onMessageFromOtherAtom(final Connection con, final WonMessage wonMessage) {
taskScheduler.schedule(new Runnable() {
public void run() {
+ if (wonMessage.getEnvelopeType() != WonMessageDirection.FROM_OWNER) {
try {
logger.debug("onMessageFromOtherAtom for Connection {}, message {}", con.getConnectionURI(),
wonMessage.getMessageURI());
@@ -91,6 +105,9 @@ public class BotOwnerCallback implements OwnerCallback {
} catch (Exception e) {
logger.warn("error while handling onMessageFromOtherAtom()", e);
}
+ } else {
+ logger.debug("Received echo for onMessageFromOtherAtom");
+ }
}
}, new Date());
}
