示例#1
0
 @ServiceHandler(RequestCmd.REMOTE_CONTROL)
 public void remoteControl(DataInputX din, DataOutputX dout, boolean login) throws IOException {
   MapPack param = (MapPack) din.readPack();
   long session = param.getLong("toSession");
   RemoteControl control =
       new RemoteControl( //
           param.getText("command"), //
           System.currentTimeMillis(), //
           param,
           param.getLong("fromSession"));
   boolean result = RemoteControlManager.add(session, control);
   Logger.println(
       "["
           + RequestCmd.REMOTE_CONTROL
           + "]"
           + control.commnad()
           + " from "
           + LoginManager.getUser(control.commander()).ip()
           + " to "
           + LoginManager.getUser(session).ip()
           + " "
           + result);
   MapPack m = new MapPack();
   if (result) {
     m.put("success", new BooleanValue(true));
     dout.writeByte(TcpFlag.HasNEXT);
     dout.writePack(m);
   } else {
     m.put("success", new BooleanValue(false));
     dout.writeByte(TcpFlag.HasNEXT);
     dout.writePack(m);
   }
 }
示例#2
0
 @ServiceHandler(RequestCmd.CHECK_JOB)
 public void checkJob(DataInputX din, DataOutputX dout, boolean login) throws IOException {
   MapPack param = (MapPack) din.readPack();
   long session = param.getLong("session");
   RemoteControl control = RemoteControlManager.getCommand(session);
   if (control != null) {
     TextPack t = new TextPack();
     t.text = control.commnad();
     dout.writeByte(TcpFlag.HasNEXT);
     dout.writePack(t);
     dout.writeByte(TcpFlag.HasNEXT);
     dout.writePack(control.param());
   }
 }
示例#3
0
 @ServiceHandler(RequestCmd.REMOTE_CONTROL_ALL)
 public void remoteControlAll(DataInputX din, DataOutputX dout, boolean login) throws IOException {
   MapPack param = (MapPack) din.readPack();
   RemoteControl control =
       new RemoteControl( //
           param.getText("command"), //
           System.currentTimeMillis(), //
           param,
           param.getLong("fromSession"));
   LoginUser[] users = LoginManager.getLoginUserList();
   for (int i = 0, len = (users != null ? users.length : 0); i < len; i++) {
     long session = users[i].session();
     RemoteControlManager.add(session, control);
   }
   Logger.println(
       "["
           + RequestCmd.REMOTE_CONTROL_ALL
           + "]"
           + control.commnad()
           + " from "
           + LoginManager.getUser(control.commander()).ip());
 }