📄 changenicknameaction.java
字号:
/**
*
*/
package cn.humanmonth.chat.server.protocol.requestaction;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import cn.humanmonth.chat.server.domain.RequestData;
import cn.humanmonth.chat.server.protocol.Protocol;
import cn.humanmonth.chat.server.protocol.RequestAction;
import cn.humanmonth.chat.server.protocol.response.SendALlUserList;
import cn.humanmonth.chat.server.protocol.response.SendMsgToAll;
/**
* @author Piterlin
*
* 处理用户更改用户呢称的请求
*/
public class ChangeNickNameAction implements RequestAction {
private Log log=LogFactory.getLog(this.getClass());
private static String action = "changeNickname";
private SendALlUserList sendAllUserList = new SendALlUserList();
private SendMsgToAll sendMsgToAll=new SendMsgToAll();
public boolean canDeal(RequestData requestData) {
log.info("changeNaickName被调用,请求的action为:"+requestData.getCAction());
return action.equals(requestData.getCAction());
}
public void dealReqeust(RequestData requestData, Protocol protocol) {
protocol.getUser().setNickName(requestData.getRequestString());
this.sendAllUserList.deal(protocol);
this.sendMsgToAll.sendSystemMsg("用户“"+protocol.getUser().getUserNameDetail()+"”更改了昵称", protocol);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -