*/
protected ActionForward doReplyMsgAndDeleteOld(ActionMapping mapping, ActionForm form,
HttpServletRequest request, HttpServletResponse response)
throws Exception
{
MessageForm msgform = (MessageForm)form;
super.validateClientId(request, msgform);
ActionMessages msgs = new ActionMessages();
while(true){
if(msgform.getExpiredTime()!=null && msgform.getExpiredTime().before(new Date())){
msgs.add("message", new ActionMessage("error.expired_time_not_available"));
break;
}
if(StringUtils.isEmpty(msgform.getContent())){
msgs.add("content", new ActionMessage("error.empty_content"));
break;
}
if(msgform.getReceiverId()==0 || msgform.getSid()==0){
msgs.add("message", new ActionMessage("error.param"));
break;
}
UserBean loginUser = super.getLoginUser(request, response);
if(loginUser==null){
msgs.add("message", new ActionMessage("error.user_not_login"));
break;
}
else if(loginUser.getStatus()!=UserBean.STATUS_NORMAL){
msgs.add("message", new ActionMessage("error.user_not_available"));
break;
}
else if(DLOGSecurityManager.IllegalGlossary.existIllegalWord(msgform.getContent())){
msgs.add("message", new ActionMessage("error.illegal_glossary"));
break;
}
UserBean receiver = UserDAO.getUserByID(msgform.getReceiverId());
if(receiver==null || receiver.getStatus()!=UserBean.STATUS_NORMAL){
msgs.add("message", new ActionMessage("error.user_not_available"));
break;
}
//�жϽ������Ƿ��Ѿ���������Ϊ������
if(UserDAO.isUserInBlackList(receiver.getId(), loginUser.getId())){
msgs.add("message", new ActionMessage("message.sent"));
break;
}
MessageBean msgbean = new MessageBean();
String content = StringUtils.abbreviate(super.autoFiltrate(null,
msgform.getContent()), MAX_MESSAGE_LENGTH);
msgbean.setContent(super.filterScriptAndStyle(content));
msgbean.setExpiredTime(msgform.getExpiredTime());
msgbean.setFromUser(loginUser);
msgbean.setToUser(receiver);
msgbean.setStatus(MessageBean.STATUS_NEW);
msgbean.setSendTime(new Date());
try{
MessageDAO.replyAndDeleteMessage(msgform.getMsgID(), msgbean);
msgs.add("message", new ActionMessage("message.sent"));
}catch(HibernateException e){
context().log("undelete diary failed.", e);
msgs.add("message", new ActionMessage("error.database", e.getMessage()));
}