Beispiel #1
0
/** Adds the server
  * 
  * This method uses the dialog's informations with CurlServerAdd to
  * submit an administration form to add the server. It is called by
  * the onOkClicked callback is the controls found no error.
  *
  */
void RainbruRPG::Gui::AddServer::addServer(){
  std::string name(tfServerName->getText().text());
  std::string uniqueName(tfServerUniqueName->getText().text());
  std::string type=StringConv::getSingleton()
    .itos(cbServerType->getCurrentItem()+1);
  std::string ip  (tfServerIp->getText().text());
  std::string port(tfServerPort->getText().text());
  std::string ftp (tfServerFtp->getText().text());
  std::string cli (tfServerCli->getText().text());
  std::string desc(txtDesc->getText().text());
  std::string tech(txtTech->getText().text());
  LOGI("Setting posted data :");

  LOGCATS("Server name : '");
  LOGCATS(name.c_str());
  LOGCATS("'");
  LOGCAT();

  LOGCATS("Server IP : '");
  LOGCATS(ip.c_str());
  LOGCATS("'");
  LOGCAT();

  LOGCATS("Server port : '");
  LOGCATS(port.c_str());
  LOGCATS("'");
  LOGCAT();

  LOGCATS("Server maxClients : '");
  LOGCATS(cli.c_str());
  LOGCATS("'");
  LOGCAT();

  CurlServerAdd csa;
  csa.setName(name);
  csa.setUniqueName(uniqueName);
  csa.setType(type);
  csa.setIpAddress(ip);
  csa.setPort(port);
  csa.setFtpPort(ftp);
  csa.setMaxClients(cli);
  csa.setDescription( desc);
  csa.setTechNote( tech);
  //  csa.setPostedData("technote", tech);
  bool per=csa.perform();

  if (per){
    LOGI("The form was correctly posted");
  }
  else{
    HttpResponse hr;
    long resp=csa.getServerResponse();
    const char* mes=hr.getMessage(resp);
    LOGCATS("HTTP rsponse :");
    LOGCATS(mes);
  }
}