if (userMessage == null) {
didSendUserMessage(con, daos, it, envelope, userMessage, MessageDelivery.FAIL);
return;
}
UserEx receiver = UserDAOFacade.getUserEx(con, daos, userMessage.getReceiverId());
if (receiver == null) {
didSendUserMessage(con, daos, it, envelope, userMessage, MessageDelivery.FAIL);
return;
}
UserPreference pref = daos.getUserPreferenceAccess().find(con, receiver.getId());
if (pref == null)
pref = UserPreference.getDefaultPreference(receiver.getId());
// twitter message を受け取らない設定になっていれば送らない。
if (!pref.isReceivingTwitterMessage()) {
didSendUserMessage(con, daos, it, envelope, userMessage, MessageDelivery.NOT_DELIVERED);
return;
}
UserTwitterLink twitterLinkage = receiver.getTwitterLinkage();
if (twitterLinkage == null || !twitterLinkage.isAuthorized()) {
Logger.warn("sendDirectMessage : envelope id " + envelope.getId() + " could not be sent : No access token");
didSendUserMessage(con, daos, it, envelope, userMessage, MessageDelivery.FAIL);
return;
}