diff --git a/server/authoriz.cpp b/server/authoriz.cpp index 31cd3fd0e..86f7516a9 100755 --- a/server/authoriz.cpp +++ b/server/authoriz.cpp @@ -22,10 +22,8 @@ public: }; TUserInfo::TUserInfo(const wxChar* user, const wxChar* host) - : m_strName(user), m_strHost(host), - m_time(wxDateTime::Now()), m_nPrograms(0) -{ -} + : m_strName(user), m_strHost(host), m_time(wxDateTime::Now()), m_nPrograms(0) +{ } WX_DECLARE_HASH_MAP( wxString, TUserInfo*, wxStringHash, wxStringEqual, TUsersHashMap ); @@ -239,9 +237,7 @@ wxString TAuthorizationServer::GarbleMD5(unsigned short n, const wxDateTime& dat // Implementare almeno queste due funzioni pure virtuali const wxChar* TAuthorizationServer::GetAppName() const -{ - return "Authorization"; -} +{ return wxT("Authorization"); } bool TAuthorizationServer::IsMagicName(wxString& strFilename) const { @@ -365,11 +361,11 @@ void TAuthorizationServer::GenerateIndex(wxString& strFilename) TXmlItem& tr6 = body.AddChild("tr"); TXmlItem& al = tr6.AddChild("td").AddChild("a"); al.SetAttr("href", "Log"); al << "Log File"; + tr6.AddChild("td") << GetLogFileName(); - TXmlItem& tr7 = body.AddChild("tr"); - TXmlItem& as = tr7.AddChild("td").AddChild("a"); - as.SetAttr("href", "stop.cgi"); as << "Stop the Server"; - + TXmlItem& tr7 = body.AddChild("tr").AddChild("td").SetAttr("align", "center"); + AddLinkButton(tr7, _("Stop the Server"), wxT("stop.cgi")); + strFilename = GetTempFilename(); html.Save(strFilename); } @@ -673,7 +669,7 @@ void TAuthorizationServer::ProcessActivation(int nModule, bool act, wxSocketBase m_Dongle.Burn(); InitModules(); } - wxString strFileName = "Modules"; + wxString strFileName = wxT("Modules"); GenerateFile(strFileName); SendFile(strFileName, outs); } @@ -961,7 +957,7 @@ bool TAuthorizationServer::Initialization() ::GlobalAddAtom(ATOMIC_SEMAPHORE); // Same as old Frontend.exe #endif const int delay = GetConfigInt("Delay", 10); - m_MaxTries = GetConfigInt("MaxTries", 8); + m_MaxTries = GetConfigInt("MaxTries", 8); if (m_MaxTries < 8) m_MaxTries = 8; @@ -981,7 +977,7 @@ bool TAuthorizationServer::Initialization() bool TAuthorizationServer::Deinitialization() { m_Dongle.Logout(); -#ifdef WIN32 +#ifdef __WXMSW__ // Definitely kill global atom for (ATOM a = ::GlobalFindAtom(ATOMIC_SEMAPHORE); a != NULL; diff --git a/server/baseserv.cpp b/server/baseserv.cpp index 68ee7fdb7..60866bdee 100755 --- a/server/baseserv.cpp +++ b/server/baseserv.cpp @@ -243,14 +243,25 @@ TXmlItem& TBaseServerApp::CreatePageBody(TXmlItem& html, wxString header) const TXmlItem& TBaseServerApp::AddLinkButton(TXmlItem& body, const wxChar* strCaption, const wxChar* strHref) const { + /* TXmlItem& table = body.AddChild("table"); table.SetAttr("border", "2"); table.SetAttr("bgcolor", "#C0C0C0"); TXmlItem& td = table.AddChild("tr").AddChild("td"); td.SetAttr("align", "center"); td.AddChild("a").SetAttr("href", strHref) << strCaption; - return table; + */ + + TXmlItem& b = body.AddChild("button"); + b.SetAttr("type", "button"); + wxString strScript; + strScript += "window.open('"; + strScript += strHref; + strScript += "', '_self')"; + b.SetAttr("onClick", strScript); + b << strCaption; + return b; } void TBaseServerApp::MessageBox(const wxChar* caption, const wxChar* msg, wxSocketBase& outs) @@ -266,9 +277,12 @@ void TBaseServerApp::MessageBox(const wxChar* caption, const wxChar* msg, wxSock td0.SetAttr("align", "justify"); td0.AddChild("h3") << msg; - TXmlItem& td1 = table.AddChild("tr").AddChild("td"); - td1.SetAttr("align", "center"); - AddLinkButton(td1, "Return to main page", "index.htm"); + if (m_bRunning) // Aggiungi il bottone di ritorno solo se il server non si sta spegnendo + { + TXmlItem& td1 = table.AddChild("tr").AddChild("td"); + td1.SetAttr("align", "center"); + AddLinkButton(td1, _("Return to main page"), "index.htm"); + } const wxString strTmp = GetTempFilename(); html.Save(strTmp); @@ -567,12 +581,15 @@ void TBaseServerApp::OnIdle(wxIdleEvent& evt) if (CanProcessCommand(str, sock)) { - const wxSocketFlags flags = sock.GetFlags(); if (valid_socket) + { + const wxSocketFlags flags = sock.GetFlags(); sock.SetFlags(wxSOCKET_WAITALL); - ProcessCommand(str, sock); - if (valid_socket) + ProcessCommand(str, sock); sock.SetFlags(flags); + } + else + ProcessCommand(str, sock); // Comandi come "UserLogout" vanno processati anche per socket non validi } // Enable input events again. diff --git a/server/lurch.cpp b/server/lurch.cpp index 2c53ecdcb..49805722d 100755 --- a/server/lurch.cpp +++ b/server/lurch.cpp @@ -79,12 +79,12 @@ bool TLurchServer::PingProcess(const wxString& strApp) if (nPort > 0) { int nTimeOut = m_PingTimer.GetInterval()/3; // msec - if (nTimeOut < 1000) nTimeOut = 1000; else + if (nTimeOut < 1000) nTimeOut = 1000; else if (nTimeOut > 5000) nTimeOut = 5000; wxIPV4address ipAddress; - // ipAddress.AnyAddress(); // Vadim Zetim lo consiglia ma non sempre funziona - ipAddress.LocalHost(); // Vadim Zetim lo sconsiglia ma pare funzionare + //ipAddress.AnyAddress(); // NON funziona con ESET + ipAddress.LocalHost(); // Pare funzionare sempre ipAddress.Service(nPort); wxSocketClient sSock(wxSOCKET_NOWAIT); sSock.Connect(ipAddress, false); @@ -99,7 +99,7 @@ bool TLurchServer::PingProcess(const wxString& strApp) char buffer[8]; memset(buffer, 0, sizeof(buffer)); sSock.Read(buffer, 4); if (sSock.WaitForRead(0, 1)) // ... ma poi non aspetto qua :-) - bPinged = wxStrncmp(buffer, "PONG", 4) == 0; + bPinged = wxStrncmp(buffer, wxT("PONG"), 4) == 0; sSock.Discard(); // Tralascia ulteriori dati in arrivo } else @@ -324,8 +324,8 @@ void TLurchServer::GenerateFile(wxString& strFilename) wxString strVer; strVer.Printf(wxT("%d.%d.%d"), v, t, p); AddTableRow(panel, wxT("Version"), strVer); - wxString strFreq; strFreq << m_PingTimer.GetInterval()/1000; - AddTableRow(panel, wxT("Ping Frequency"), strFreq); + wxString strFreq; strFreq << m_PingTimer.GetInterval()/1000; + AddTableRow(panel, wxT("Ping Frequency"), strFreq); html.Save(strFilename); }