public void execute(DBTransaction transaction) throws SQLException {
CharacterDAO characterdao = DAORegister.get().get(CharacterDAO.class);
accountName = characterdao.getAccountName(transaction, target);
// should not really happen with taxman, but check anyway
if (accountName != null) {
PostmanDAO postmandao = DAORegister.get().get(PostmanDAO.class);
List<ChatMessage> oldMessages = postmandao.getChatMessages(transaction, target);
for (ChatMessage msg : oldMessages) {
if (msg.getSource().equals(source) && msg.getMessage().equals(message) && msg.getMessagetype().equals("N")) {
/*
* If a player has already an equal undelivered message,
* don't send a new one. It is presumably from a
* previous check and the new one happened after a
* reboot.
*/
logger.debug("NOT sending a notice to '" + target + "': " + message);
return;
}
}
logger.info("sending a notice to '" + target + "': " + message);
postmandao.storeMessage(source, target, message, "N");
} else {
logger.error("Not sending a Taxman notice to '" + target
+ ", because the account does not exist. Message': " + message);
}
}