myserver-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[myserver-commit] [SCM] GNU MyServer branch, master, updated. 6f9f8c5b6e


From: Giuseppe Scrivano
Subject: [myserver-commit] [SCM] GNU MyServer branch, master, updated. 6f9f8c5b6e38a19813f4408c6fad2edf5f24d065
Date: Wed, 12 Aug 2009 20:58:05 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU MyServer".

The branch, master has been updated
       via  6f9f8c5b6e38a19813f4408c6fad2edf5f24d065 (commit)
       via  90cb83ecf65cced0e6479b8c94d991bcd3a1c807 (commit)
      from  6004dab381a466346cc246592cde4be0cf800dfb (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------


commit 6f9f8c5b6e38a19813f4408c6fad2edf5f24d065
Author: Giuseppe Scrivano <address@hidden>
Date:   Wed Aug 12 22:51:40 2009 +0200

    The server class logs using a formatting string.

diff --git a/myserver/include/server/server.h b/myserver/include/server/server.h
index e78299e..320bdc3 100644
--- a/myserver/include/server/server.h
+++ b/myserver/include/server/server.h
@@ -135,6 +135,7 @@ public:
   void stop();
   void finalCleanup();
   int terminate();
+  int logWriteln (LoggingLevel level, const char *fmt, ...);
   int logWriteln(char const*, LoggingLevel level = MYSERVER_LOG_MSG_INFO);
   int logWriteln(string const &str)
     {return logWriteln(str.c_str());};
diff --git a/myserver/src/conf/vhost/vhost.cpp 
b/myserver/src/conf/vhost/vhost.cpp
index 315aa23..9ca27cf 100644
--- a/myserver/src/conf/vhost/vhost.cpp
+++ b/myserver/src/conf/vhost/vhost.cpp
@@ -26,9 +26,9 @@
 #include <include/conf/vhost/ip.h>
 
 #ifdef HAVE_IDN
-#include <stringprep.h>
-#include <punycode.h>
-#include <idna.h>
+# include <stringprep.h>
+# include <punycode.h>
+# include <idna.h>
 #endif
 
 
@@ -37,7 +37,7 @@ const string Vhost::warningLogType ("WARNINGLOG");
 
 
 /*!
- *vhost costructor
+ * Vhost costructor
  */
 Vhost::Vhost(LogManager* lm)
 {
@@ -50,9 +50,9 @@ Vhost::Vhost(LogManager* lm)
   protocolData = 0;
 
   /*
-   *By default use a non specified value for the throttling rate. -1 means 
-   *that the throttling rate was not specified, while 0 means it was 
-   *specified but there is not a limit.
+   * By default use a non specified value for the throttling rate. -1 means
+   * that the throttling rate was not specified, while 0 means it was
+   * specified but there is not a limit.
    */
   throttlingRate = (u_long) -1;
   refCount = 0;
@@ -63,7 +63,7 @@ Vhost::Vhost(LogManager* lm)
 
 
 /*!
- *Destroy the vhost. 
+ * Destroy the vhost.
  */
 Vhost::~Vhost()
 {
@@ -90,9 +90,9 @@ Vhost::~Vhost()
   logManager->remove (this);
 }
 
-/*! 
- *Clear the data dictionary. 
- *Returns zero on success.
+/*!
+ * Clear the data dictionary.
+ * Returns zero on success.
  */
 int Vhost::freeHashedData()
 {
@@ -116,7 +116,7 @@ int Vhost::freeHashedData()
 }
 
 /*!
- *Check if a MIME type file is defined for the virtual host.
+ * Check if a MIME type file is defined for the virtual host.
  */
 int Vhost::isMIME()
 {
@@ -124,7 +124,7 @@ int Vhost::isMIME()
 }
 
 /*!
- *Get the MIME manager for the virtual host.
+ * Get the MIME manager for the virtual host.
  */
 MimeManager* Vhost::getMIME()
 {
@@ -132,7 +132,7 @@ MimeManager* Vhost::getMIME()
 }
 
 /*!
- *Clear the list of the hosts.
+ * Clear the list of the hosts.
  */
 void Vhost::clearHostList()
 {
@@ -147,7 +147,7 @@ void Vhost::clearHostList()
 }
 
 /*!
- *Clear the list of IPs.
+ * Clear the list of IPs.
  */
 void Vhost::clearIPList()
 {
@@ -182,15 +182,15 @@ Vhost::openWarningLog (string location, list<string>& 
filters, u_long cycle)
 
 int
 Vhost::openLogFiles ()
-{ 
+{
   return logManager->count (this, accessLogType) == 0 ||
     logManager->count (this, warningLogType) == 0;
 }
 
 /*!
- *Add an IP address to the list.
- *\param ip The ip to add.
- *\param isRegex Specify if the ip is specified as a regex.
+ * Add an IP address to the list.
+ * \param ip The ip to add.
+ * \param isRegex Specify if the ip is specified as a regex.
  */
 void Vhost::addIP (const char *ip, int isRegex)
 {
@@ -201,39 +201,20 @@ void Vhost::addIP (const char *ip, int isRegex)
 }
 
 /*!
- *Remove the IP address to the list.
- *\param ip The ip to remove.
+ * Remove the IP address to the list.
+ * \param ip The ip to remove.
  */
 void Vhost::removeIP(const char *ip)
 {
-  std::string sTempIp(ip);
-  ipListDeny.push_back(IpRange::RangeFactory(sTempIp));
-
-  /*
-  list<StringRegex*>::iterator i = ipList.begin();
-
-  while(i != ipList.end())
-    {
-      StringRegex* sr = *i;
-      / *
-       *If this is the virtual host with the right IP.
-       * /
-      if(!stringcmp(sr->name,ip))
-        {
-          ipList.erase(i);
-          return;
-        }
-    
-      i++;
-    }
-  */
+  std::string sTempIp (ip);
+  ipListDeny.push_back (IpRange::RangeFactory (sTempIp));
 }
 
 /*!
- *Remove the host address to the list.
- *\param host The hostname to remove.
+ * Remove the host address to the list.
+ * \param host The hostname to remove.
  */
-void Vhost::removeHost(const char *host)
+void Vhost::removeHost (const char *host)
 {
   list<StringRegex*>::iterator i = hostList.begin();
 
@@ -241,27 +222,27 @@ void Vhost::removeHost(const char *host)
     {
       StringRegex* sr = *i;
       /*
-       *If this is the virtual host with the right IP.
+       * If this is the virtual host with the right IP.
        */
       if(!stringcmp(sr->name, host))
         {
           hostList.erase(i);
           return;
         }
-    
+
       i++;
     }
 }
 /*!
- *Check if an host is allowed to the connection
- *\param host hostname to check.
+ * Check if an host is allowed to the connection
+ * \param host hostname to check.
  */
 int Vhost::isHostAllowed(const char* host)
 {
   /* If no hosts are specified then every host is allowed to connect here.  */
   if(!hostList.size() || !host)
     return 1;
-    
+
   list<StringRegex*>::iterator i = hostList.begin();
   while(i != hostList.end())
     {
@@ -274,17 +255,17 @@ int Vhost::isHostAllowed(const char* host)
               return 1;
             }
         }
-    
+
       if(!stringcmp(sr->name, host))
         return 1;
-      
+
       i++;
     }
   return 0;
 }
 
 /*!
- *Check if all the host are allowed to the connection.
+ * Check if all the host are allowed to the connection.
  */
 int Vhost::areAllHostAllowed()
 {
@@ -294,23 +275,19 @@ int Vhost::areAllHostAllowed()
 }
 
 /*!
- *Check if all the IPs are allowed to the connection.
+ * Check if all the IPs are allowed to the connection.
  */
 int Vhost::areAllIPAllowed()
 {
-  /*
-  if(ipList.size() == 0)
-    return 1;
-  */
   if ( ipListDeny.empty() && ipListAllow.empty() )
     return 1;
   return 0;
 }
 
 /*!
- *Check if the network is allowed to the connection(control the network 
- *by the local IP).
- *\param ip The IP to check.
+ * Check if the network is allowed to the connection(control the network
+ * by the local IP).
+ * \param ip The IP to check.
  */
 int Vhost::isIPAllowed(const char* ip)
 {
@@ -341,37 +318,12 @@ int Vhost::isIPAllowed(const char* ip)
     }
   delete pTempIp;
   return 0;
-  /*
-  / * If no IPs are specified then every host is allowed to connect here.  * /
-  if(!ipList.size() || !ip)
-    return 1;
-    
-  list<StringRegex*>::iterator i = ipList.begin();
-  while(i != ipList.end())
-    {
-      StringRegex* sr = *i;
-      regmatch_t pm;
-      if(sr->regex.isCompiled())
-        {
-          if (!sr->regex.exec(ip ,1, &pm, REG_NOTBOL))
-            {
-              return 1;
-            }
-        }
-    
-      if(!stringcmp(sr->name, ip))
-        return 1;
-      
-      i++;
-    }
-  */
-  return 0;
 }
 
 /*!
- *Add an host to the allowed host list.
- *\param host hostname to add.
- *\param isRegex Is the host a regex?
+ * Add an host to the allowed host list.
+ * \param host hostname to add.
+ * \param isRegex Is the host a regex?
  */
 void Vhost::addHost(const char *host, int isRegex)
 {
@@ -394,9 +346,9 @@ void Vhost::addHost(const char *host, int isRegex)
   ret = idna_to_ascii_4z (ucs4, &ascii, 0);
 
   free(ucs4);
-  
+
   if (ret != IDNA_SUCCESS)
-    {   
+    {
       delete hl;
       return;
     }
@@ -420,7 +372,7 @@ void Vhost::addHost(const char *host, int isRegex)
  * Write to the accesses log.
  * \param str The line to log.
  */
-int 
+int
 Vhost::accessesLogWrite (const char* str)
 {
   string msg (str);
@@ -442,9 +394,9 @@ Vhost::warningsLogWrite (const char* str)
 }
 
 /*!
- *Set the null reference callback function. It is called when the reference
- *counter for the virtual host is zero. 
- *\param cb The null references callback function.
+ * Set the null reference callback function. It is called when the reference
+ * counter for the virtual host is zero.
+ * \param cb The null references callback function.
  */
 void Vhost::setNullRefCB(NULL_REFERENCECB cb)
 {
@@ -452,15 +404,15 @@ void Vhost::setNullRefCB(NULL_REFERENCECB cb)
 }
 
 /*!
- *Get the null reference callback function used by the virtual host.
+ * Get the null reference callback function used by the virtual host.
  */
 NULL_REFERENCECB Vhost::getNullRefCB()
 {
-  return nullReferenceCb;               
+  return nullReferenceCb;
 }
 
 /*!
- *Increment current references counter by 1.
+ * Increment current references counter by 1.
  */
 void Vhost::addRef()
 {
@@ -470,15 +422,15 @@ void Vhost::addRef()
 }
 
 /*!
- *Decrement current references counter by 1.
+ * Decrement current references counter by 1.
  */
 void Vhost::removeRef()
 {
   refMutex.lock(0);
   refCount--;
-  /*! 
-   *If the reference count reaches zero and a callback 
-   *function is defined call it.
+  /*!
+   * If the reference count reaches zero and a callback
+   * function is defined call it.
    */
   if(refCount == 0 && nullReferenceCb)
     nullReferenceCb(this);
@@ -486,7 +438,7 @@ void Vhost::removeRef()
 }
 
 /*!
- *Get the references counter.
+ * Get the references counter.
  */
 int Vhost::getRef()
 {
@@ -494,17 +446,17 @@ int Vhost::getRef()
 }
 
 /*!
- *Set the reference counter for the virtual host.
- *\param n The new reference counter.
+ * Set the reference counter for the virtual host.
+ * \param n The new reference counter.
  */
 void Vhost::setRef(int n)
 {
   refCount = n;
 }
 
-/*! 
- *Get the value for name in the hash dictionary.
- *\param name The hashed entry key.
+/*!
+ * Get the value for name in the hash dictionary.
+ * \param name The hashed entry key.
  */
 const char* Vhost::getHashedData(const char* name)
 {
@@ -512,9 +464,9 @@ const char* Vhost::getHashedData(const char* name)
 
   return s ? s->getValue ()->c_str() : 0;
 }
-  
+
 /*!
- *Initialize SSL on the virtual host.
+ * Initialize SSL on the virtual host.
  */
 int Vhost::initializeSSL()
 {
@@ -523,16 +475,16 @@ int Vhost::initializeSSL()
   protocol = Server::getInstance()->getProtocol(protocolName.c_str());
   if(!protocol)
     return 0;
-    
+
   if(!(protocol->getProtocolOptions() & PROTOCOL_USES_SSL))
     return 0;
 
   return sslContext.initialize();
-}  
+}
 
 
 /*!
- *Get the SSL context.
+ * Get the SSL context.
  */
 SSL_CTX* Vhost::getSSLContext()
 {
@@ -541,7 +493,7 @@ SSL_CTX* Vhost::getSSLContext()
 
 
 /*!
- *Clean the memory used by the SSL context.
+ * Clean the memory used by the SSL context.
  */
 int Vhost::freeSSL()
 {
diff --git a/myserver/src/server/server.cpp b/myserver/src/server/server.cpp
index 451abfa..957cc8d 100644
--- a/myserver/src/server/server.cpp
+++ b/myserver/src/server/server.cpp
@@ -35,23 +35,25 @@ along with this program.  If not, see 
<http://www.gnu.org/licenses/>.
 
 #include <include/conf/xml_conf.h>
 
+#include <cstdarg>
+
 
 extern "C"
 {
 #ifdef WIN32
-#include <direct.h>
+# include <direct.h>
 #else
-#include <unistd.h>
-#include <string.h>
-#include <signal.h>
-#include <stdlib.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-#ifdef HAVE_PTHREAD
-#include <pthread.h>
-#endif
+# include <unistd.h>
+# include <string.h>
+# include <signal.h>
+# include <stdlib.h>
+# include <sys/socket.h>
+# include <netinet/in.h>
+# include <arpa/inet.h>
+
+# ifdef HAVE_PTHREAD
+#  include <pthread.h>
+# endif
 
 #endif
 }
@@ -66,7 +68,7 @@ const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT;
  */
 Server* Server::instance = 0;
 
-Server::Server() : connectionsScheduler (this),
+Server::Server () : connectionsScheduler (this),
                    listenThreads (&connectionsScheduler, this),
                    authMethodFactory (),
                    validatorFactory (),
@@ -113,34 +115,34 @@ Server::initLogManager ()
  *Reinitialize the configuration paths, setting them to the specified ones.
  *Returns false on error.
  */
-bool Server::resetConfigurationPaths(string &mainConf, string &mimeConf,
+bool Server::resetConfigurationPaths (string &mainConf, string &mimeConf,
                                     string &vhostConf, string &externPath,
                                     string &langPath)
 {
   if (!mainConfigurationFile)
-    mainConfigurationFile = new string(mainConf);
+    mainConfigurationFile = new string (mainConf);
   else
-    mainConfigurationFile->assign(mainConf);
+    mainConfigurationFile->assign (mainConf);
 
   if (!mimeConfigurationFile)
-    mimeConfigurationFile = new string(mimeConf);
+    mimeConfigurationFile = new string (mimeConf);
   else
-    mimeConfigurationFile->assign(mimeConf);
+    mimeConfigurationFile->assign (mimeConf);
 
   if (!vhostConfigurationFile)
-    vhostConfigurationFile = new string(vhostConf);
+    vhostConfigurationFile = new string (vhostConf);
   else
-    vhostConfigurationFile->assign(vhostConf);
+    vhostConfigurationFile->assign (vhostConf);
 
   if (!externalPath)
-    externalPath = new string(externPath);
+    externalPath = new string (externPath);
   else
-    externalPath->assign(externPath);
+    externalPath->assign (externPath);
 
   if (!languagesPath)
-    languagesPath = new string(langPath);
+    languagesPath = new string (langPath);
   else
-    languagesPath->assign(langPath);
+    languagesPath->assign (langPath);
 
   return true;
 }
@@ -150,37 +152,37 @@ bool Server::resetConfigurationPaths(string &mainConf, 
string &mimeConf,
  *the default ones.
  *Returns nonzero on error.
  */
-int Server::checkConfigurationPaths()
+int Server::checkConfigurationPaths ()
 {
   if (mainConfigurationFile->length() == 0)
   {
-    mainConfigurationFile->assign("myserver.xml");
+    mainConfigurationFile->assign ("myserver.xml");
 
-    if (copyConfigurationFromDefault("myserver.xml"))
+    if (copyConfigurationFromDefault ("myserver.xml"))
     {
-      logWriteln("Error loading configuration file", MYSERVER_LOG_MSG_ERROR);
+      logWriteln (MYSERVER_LOG_MSG_ERROR, _("Error loading configuration 
file"));
       return -1;
     }
   }
 
   if (mimeConfigurationFile->length() == 0)
   {
-    mimeConfigurationFile->assign("MIMEtypes.xml");
+    mimeConfigurationFile->assign ("MIMEtypes.xml");
 
-    if (copyConfigurationFromDefault("MIMEtypes.xml"))
+    if (copyConfigurationFromDefault ("MIMEtypes.xml"))
     {
-      logWriteln(languageParser.getValue("ERR_LOADMIME"), 
MYSERVER_LOG_MSG_ERROR);
+      logWriteln (MYSERVER_LOG_MSG_ERROR, _("Error loading MIME configuration 
file"));
       return -1;
     }
   }
 
   if (vhostConfigurationFile->length() == 0)
   {
-    vhostConfigurationFile->assign("virtualhosts.xml");
+    vhostConfigurationFile->assign ("virtualhosts.xml");
 
-    if (copyConfigurationFromDefault("virtualhosts.xml") != 0)
+    if (copyConfigurationFromDefault ("virtualhosts.xml") != 0)
     {
-      logWriteln(languageParser.getValue("ERR_LOADVHOSTS"), 
MYSERVER_LOG_MSG_ERROR);
+      logWriteln (MYSERVER_LOG_MSG_ERROR, _("Error loading virtual hosts 
configuration file"));
       return -1;
     }
   }
@@ -192,7 +194,7 @@ int Server::checkConfigurationPaths()
  *Copy a configuration file from the default one.
  *Return nonzero on errors.
  */
-int Server::copyConfigurationFromDefault(const char *fileName)
+int Server::copyConfigurationFromDefault (const char *fileName)
 {
   File inputF;
   File outputF;
@@ -228,26 +230,21 @@ int Server::copyConfigurationFromDefault(const char 
*fileName)
 /*!
  *Load here all the libraries.
  */
-int Server::loadLibraries()
+int Server::loadLibraries ()
 {
-  Process::initialize();
+  Process::initialize ();
 
   XmlParser::startXML();
-  myserver_safetime_init();
+  myserver_safetime_init ();
 
   gnutls_global_init ();
 
-  /* Startup the socket library.  */
-  logWriteln(languageParser.getValue("MSG_ISOCK") );
-
-  if(Socket::startupSocketLib() != 0)
+  if (Socket::startupSocketLib () != 0)
   {
-    logWriteln( languageParser.getValue ("MSG_SERVER_CONF"), 
MYSERVER_LOG_MSG_ERROR);
+    logWriteln (MYSERVER_LOG_MSG_ERROR, _("Error loading the socket library"));
     return 1;
   }
 
-  logWriteln(languageParser.getValue("MSG_SOCKSTART") );
-
   return 0;
 }
 
@@ -255,16 +252,16 @@ int Server::loadLibraries()
 /*!
  *Destroy the object.
  */
-Server::~Server()
+Server::~Server ()
 {
-  if(languagesPath)
+  if (languagesPath)
     delete languagesPath;
   languagesPath = 0;
 
-  if(languageFile)
+  if (languageFile)
     delete languageFile;
   languageFile = 0;
-  if(vhostList)
+  if (vhostList)
     delete vhostList;
 
   delete vhostConfigurationFile;
@@ -276,15 +273,15 @@ Server::~Server()
   delete mimeConfigurationFile;
   mimeConfigurationFile = 0;
 
-  if(externalPath)
+  if (externalPath)
     delete externalPath;
   externalPath = 0;
 
-  if(path)
+  if (path)
     delete path;
   path = 0;
 
-  if(ipAddresses)
+  if (ipAddresses)
     delete ipAddresses;
 
   if (logManager)
@@ -296,7 +293,7 @@ Server::~Server()
 /*!
  *Start the server.
  */
-void Server::start(string &mainConf, string &mimeConf, string &vhostConf,
+void Server::start (string &mainConf, string &mimeConf, string &vhostConf,
                   string &externPath, string &langPath)
 {
   int err = 0;
@@ -305,197 +302,157 @@ void Server::start(string &mainConf, string &mimeConf, 
string &vhostConf,
   INPUT_RECORD irInBuf[128];
 #endif
 
-  displayBoot();
+  displayBoot ();
 
   try
   {
-    if(loadLibraries())
+    if (loadLibraries ())
       return;
 
     /*
-     *Setup the server configuration.
+     * Setup the server configuration.
      */
-    logWriteln("Initializing server configuration...");
+    logWriteln (MYSERVER_LOG_MSG_INFO, _("Initializing server 
configuration..."));
 
-    if (!resetConfigurationPaths(mainConf, mimeConf, vhostConf, externPath, 
langPath))
+    if (!resetConfigurationPaths (mainConf, mimeConf, vhostConf, externPath, 
langPath))
       return;
 
-    err = checkConfigurationPaths();
+    err = checkConfigurationPaths ();
     if (err)
       return;
 
-    err = initialize();
-    if(err)
+    err = initialize ();
+    if (err)
       return;
 
     /* Initialize the SSL library.  */
     initializeSSL();
 
-    logWriteln( languageParser.getValue("MSG_SERVER_CONF") );
+    logWriteln (MYSERVER_LOG_MSG_INFO, _("Loading server configuration..."));
 
-    if(postLoad())
+    if (postLoad ())
       return;
 
-    setProcessPermissions();
+    setProcessPermissions ();
 
     if (getGid ()[0])
-    {
-      ostringstream out;
-      out << "gid: " << gid;
-      logWriteln(out.str().c_str());
-    }
+      logWriteln (MYSERVER_LOG_MSG_INFO, _("Using gid: %s"), gid.c_str ());
 
     if (getUid ()[0])
-    {
-      ostringstream out;
-      out << "uid: " << uid;
-      logWriteln(out.str().c_str());
-    }
+      logWriteln (MYSERVER_LOG_MSG_INFO, _("Using uid: %s"), uid.c_str ());
 
-    logWriteln(languageParser.getValue("MSG_READY"));
+    logWriteln (MYSERVER_LOG_MSG_INFO, _("Server is ready!"));
 
     if (logLocation.find ("console://") != string::npos)
-      {
-        logWriteln (languageParser.getValue ("MSG_BREAK"));
-      }
+      logWriteln (MYSERVER_LOG_MSG_INFO, _("Press Ctrl-C to terminate its 
execution"));
 
     serverReady = true;
 
     /* Finally we can give control to the main loop.  */
-    mainLoop();
+    mainLoop ();
 
   }
   catch(bad_alloc &ba)
-  {
-    ostringstream s;
-    s << "Bad alloc: " << ba.what();
-    logWriteln(s.str().c_str());
-  }
+    {
+      logWriteln (MYSERVER_LOG_MSG_ERROR, _("Bad alloc: %s"), ba.what ());
+    }
   catch(exception &e)
-  {
-    ostringstream s;
-    s << "Error: " << e.what();
-    logWriteln(s.str().c_str());
-  };
-  this->terminate();
-  finalCleanup();
+    {
+      logWriteln (MYSERVER_LOG_MSG_ERROR, _("Error: %s"), e.what ());
+    };
+  this->terminate ();
+  finalCleanup ();
 
 #ifdef WIN32
-  WSACleanup();
-#endif// WIN32
+  WSACleanup ();
+#endif
 }
 
 /*!
- *Complete the loading phase.
+ * Complete the loading phase.
  */
-int Server::postLoad()
+int Server::postLoad ()
 {
-  ostringstream nCPU;
   string strCPU;
   string buffer;
 
-  /*
-   *Get the name of the local machine.
-   */
-  memset(serverName, 0, HOST_NAME_MAX+1);
-  Socket::gethostname(serverName, HOST_NAME_MAX);
+  /* Get the name of the local machine.  */
+  memset (serverName, 0, HOST_NAME_MAX+1);
+  Socket::gethostname (serverName, HOST_NAME_MAX);
 
-  buffer.assign(languageParser.getValue("MSG_GETNAME"));
-  buffer.append(" ");
-  buffer.append(serverName);
-  logWriteln(buffer.c_str());
+  logWriteln (MYSERVER_LOG_MSG_INFO, _("Host name: %s"), serverName);
 
-  /*
-   *Find the IP addresses of the local machine.
-   */
-  if(ipAddresses)
+  /* Find the IP addresses of the local machine.  */
+  if (ipAddresses)
     delete ipAddresses;
-  ipAddresses = new string();
-  buffer.assign("Host: ");
-  buffer.append(serverName);
-  logWriteln(buffer.c_str() );
+  ipAddresses = new string ();
 
-  if(Socket::getLocalIPsList(*ipAddresses))
-  {
-    string msg;
-    msg.assign(languageParser.getValue("ERR_ERROR"));
-    msg.append(" : Reading IP list");
-    logWriteln(msg.c_str(), MYSERVER_LOG_MSG_ERROR);
-    return -1;
-  }
-  else
-  {
-    string msg;
-    msg.assign("IP: ");
-    msg.append(*ipAddresses);
-    logWriteln(msg.c_str());
-  }
+  if (Socket::getLocalIPsList (*ipAddresses))
+    {
+      logWriteln (MYSERVER_LOG_MSG_ERROR, _("Error reading IP list"));
+      return -1;
+    }
+
+  logWriteln (MYSERVER_LOG_MSG_INFO, _("IP: %s"), ipAddresses->c_str ());
 
   /* Load the MIME types.  */
-  logWriteln(languageParser.getValue("MSG_LOADMIME"));
+  logWriteln (MYSERVER_LOG_MSG_INFO, _("Loading MIME types..."));
 
-  if(mimeManager)
+  if (mimeManager)
     delete mimeManager;
 
-  mimeManager = new MimeManager();
+  mimeManager = new MimeManager ();
 
-  if(int nMIMEtypes = mimeManager->loadXML(mimeConfigurationFile->c_str()))
-  {
-    ostringstream stream;
-    stream << languageParser.getValue("MSG_MIMERUN") << ": " << nMIMEtypes;
-    logWriteln(stream.str().c_str());
-  }
+  if (int nMIMEtypes = mimeManager->loadXML(mimeConfigurationFile->c_str ()))
+    logWriteln (MYSERVER_LOG_MSG_INFO, _("Using %i MIME types"), nMIMEtypes);
   else
-  {
-    logWriteln(languageParser.getValue("ERR_LOADMIME"), 
MYSERVER_LOG_MSG_ERROR);
-  }
-
-  nCPU << (u_int)getCPUCount();
+    logWriteln (MYSERVER_LOG_MSG_ERROR, _("Error while loading MIME types"));
 
-  strCPU.assign(languageParser.getValue("MSG_NUM_CPU"));
-  strCPU.append(" ");
-  strCPU.append(nCPU.str());
-  logWriteln(strCPU.c_str());
+  logWriteln (MYSERVER_LOG_MSG_INFO, _("Detected %i CPUs"), (int) getCPUCount 
());
 
-  connectionsScheduler.restart();
+  connectionsScheduler.restart ();
 
-  listenThreads.initialize(&languageParser);
+  listenThreads.initialize (&languageParser);
 
-  if(vhostList)
+  if (vhostList)
     delete vhostList;
 
-  vhostList = new VhostManager(&listenThreads, logManager);
+  vhostList = new VhostManager (&listenThreads, logManager);
 
-  if(vhostList == NULL)
+  if (vhostList == NULL)
     return -1;
 
-  getProcessServerManager()->load();
+  getProcessServerManager ()->load ();
 
   /* Load the home directories configuration.  */
-  homeDir.load();
+  homeDir.load ();
 
-  loadPlugins();
+  loadPlugins ();
 
   /* Load the virtual hosts configuration from the xml file.  */
-  vhostList->loadXMLConfigurationFile(vhostConfigurationFile->c_str());
+  vhostList->loadXMLConfigurationFile (vhostConfigurationFile->c_str ());
 
-  if(path == 0)
-    path = new string();
+  if (path == 0)
+    path = new string ();
 
-  if(getdefaultwd(*path))
+  if (getdefaultwd (*path))
     return -1;
 
-  for(u_long i = 0; i < nStaticThreads; i++)
-  {
-    logWriteln(languageParser.getValue("MSG_CREATET"));
-    if(addThread(true))
-      return -1;
+  for (u_long i = 0; i < nStaticThreads; i++)
+    {
+      logWriteln (MYSERVER_LOG_MSG_INFO, _("Creating thread %i..."), (int) (i 
+ 1));
 
-    logWriteln(languageParser.getValue("MSG_THREADR"));
-  }
+      if (addThread (true))
+        {
+          logWriteln (MYSERVER_LOG_MSG_ERROR, _("Error while creating 
thread"));
+          return -1;
+        }
+
+      logWriteln (MYSERVER_LOG_MSG_INFO, _("Thread %i created"),  (int)(i + 
1));
+    }
 
 
-  configurationFileManager.close();
+  configurationFileManager.close ();
 
   return 0;
 }
@@ -503,21 +460,17 @@ int Server::postLoad()
 /*!
  *Load the plugins.
  */
-void Server::loadPlugins()
+void Server::loadPlugins ()
 {
-  string xml("xml");
+  string xml ("xml");
   //FIXME: xmlV is never freed.
   XmlValidator *xmlV = new XmlValidator ();
 
   validatorFactory.addValidator (xml, xmlV);
   authMethodFactory.addAuthMethod (xml, (AuthMethod*) xmlV);
 
-  if(filtersFactory.insert("gzip", Gzip::factory))
-  {
-    ostringstream stream;
-    stream <<  languageParser.getValue("ERR_ERROR") << ": Gzip Filter";
-    logWriteln(stream.str().c_str(), MYSERVER_LOG_MSG_ERROR);
-  }
+  if (filtersFactory.insert ("gzip", Gzip::factory))
+    logWriteln (MYSERVER_LOG_MSG_ERROR, _("Error while loading plugins"));
 
   Protocol *protocolsSet[] = {new HttpProtocol(),
                               new HttpsProtocol(),
@@ -526,23 +479,21 @@ void Server::loadPlugins()
                               0};
 
   for (int j = 0; protocolsSet[j]; j++)
-  {
-    char protocolName[32];
-    Protocol *protocol = protocolsSet[j];
-    protocol->loadProtocol(&languageParser);
-    protocol->registerName(protocolName, 32);
-    getProtocolsManager()->addProtocol(protocolName, protocol);
-  }
-
-
+    {
+      char protocolName[32];
+      Protocol *protocol = protocolsSet[j];
+      protocol->loadProtocol (&languageParser);
+      protocol->registerName (protocolName, 32);
+      getProtocolsManager ()->addProtocol (protocolName, protocol);
+    }
 
-  getPluginsManager()->preLoad(this, *externalPath);
-  getPluginsManager()->load(this);
-  getPluginsManager()->postLoad(this, &languageParser);
+  getPluginsManager ()->preLoad (this, *externalPath);
+  getPluginsManager ()->load (this);
+  getPluginsManager ()->postLoad (this, &languageParser);
 }
 
 /*!
- *Server main loop.
+ * Server main loop.
  */
 void Server::mainLoop()
 {
@@ -552,198 +503,183 @@ void Server::mainLoop()
 
   u_long purgeThreadsCounter = 0;
 
-  mainConfTime =
-    FilesUtility::getLastModTime(mainConfigurationFile->c_str());
+  mainConfTime = FilesUtility::getLastModTime (mainConfigurationFile->c_str 
());
   hostsConfTime =
-    FilesUtility::getLastModTime(vhostConfigurationFile->c_str());
-  mimeConfTime =
-    FilesUtility::getLastModTime(mimeConfigurationFile->c_str());
+    FilesUtility::getLastModTime (vhostConfigurationFile->c_str ());
+  mimeConfTime = FilesUtility::getLastModTime (mimeConfigurationFile->c_str 
());
 
   /*
-   *Keep thread alive.
-   *When the endServer flag is set to True exit
-   *from the loop and terminate the server execution.
+   * Keep thread alive.
+   * When the endServer flag is set to True exit
+   * from the loop and terminate the server execution.
    */
-  while(!endServer)
-  {
-    Thread::wait(1000000);
-
-    /* Check threads.  */
-    if(purgeThreadsCounter++ >= 10)
+  while (!endServer)
     {
-      purgeThreadsCounter = 0;
-      purgeThreads();
-    }
+      Thread::wait (1000000);
 
-    if(autoRebootEnabled)
-    {
-      time_t mainConfTimeNow =
-        FilesUtility::getLastModTime(mainConfigurationFile->c_str());
-      time_t hostsConfTimeNow =
-        FilesUtility::getLastModTime(vhostConfigurationFile->c_str());
-      time_t mimeConfNow =
-        FilesUtility::getLastModTime(mimeConfigurationFile->c_str());
-
-      /* If a configuration file was modified reboot the server. */
-      if(((mainConfTimeNow != -1) && (hostsConfTimeNow != -1)  &&
-          (mimeConfNow != -1)) || toReboot)
-      {
-        if( (mainConfTimeNow  != mainConfTime) || toReboot)
+      /* Check threads.  */
+      if (purgeThreadsCounter++ >= 10)
         {
-          string msg("main-conf-changed");
-          notifyMulticast(msg, 0);
-
-          reboot();
-          /* Store new mtime values.  */
-          mainConfTime = mainConfTimeNow;
-          mimeConfTime = mimeConfNow;
+          purgeThreadsCounter = 0;
+          purgeThreads ();
         }
-        else if(mimeConfNow != mimeConfTime)
-        {
-          string msg("mime-conf-changed");
-          notifyMulticast(msg, 0);
 
-          if (logLocation.find ("console://") != string::npos)
+      if (autoRebootEnabled)
+        {
+          time_t mainConfTimeNow =
+            FilesUtility::getLastModTime (mainConfigurationFile->c_str ());
+          time_t hostsConfTimeNow =
+            FilesUtility::getLastModTime (vhostConfigurationFile->c_str ());
+          time_t mimeConfNow =
+            FilesUtility::getLastModTime (mimeConfigurationFile->c_str ());
+
+          /* If a configuration file was modified reboot the server. */
+          if (((mainConfTimeNow != -1) && (hostsConfTimeNow != -1)  &&
+               (mimeConfNow != -1)) || toReboot)
             {
-              char beep[] = { static_cast<char>(0x7), '\0' };
-              string beepStr (beep);
-              logManager->log (this, "MAINLOG", logLocation, beepStr);
-            }
-          logWriteln("Reloading MIMEtypes.xml");
+              if ( (mainConfTimeNow  != mainConfTime) || toReboot)
+                {
+                  string msg ("main-conf-changed");
+                  notifyMulticast (msg, 0);
 
-          getMimeManager()->loadXML(getMIMEConfFile());
+                  reboot ();
+                  /* Store new mtime values.  */
+                  mainConfTime = mainConfTimeNow;
+                  mimeConfTime = mimeConfNow;
+                }
+              else if (mimeConfNow != mimeConfTime)
+                {
+                  string msg ("mime-conf-changed");
+                  notifyMulticast (msg, 0);
 
-          logWriteln("Reloaded");
+                  if (logLocation.find ("console://") != string::npos)
+                    {
+                      char beep[] = { static_cast<char>(0x7), '\0' };
+                      string beepStr (beep);
+                      logManager->log (this, "MAINLOG", logLocation, beepStr);
+                    }
+                  logWriteln (MYSERVER_LOG_MSG_INFO, _("Reloading MIME 
types"));
 
-          mimeConfTime = mimeConfNow;
-        }
-        else if(hostsConfTimeNow != hostsConfTime)
-        {
-          VhostManager* oldvhost = vhostList;
-          string msg("vhosts-conf-changed");
-          notifyMulticast(msg, 0);
+                  getMimeManager ()->loadXML (getMIMEConfFile ());
 
-          /* Do a beep if outputting to console.  */
-          if (logLocation.find ("console://") != string::npos)
-            {
-              char beep[] = { static_cast<char>(0x7), '\0' };
-              string beepStr (beep);
-              logManager->log (this, "MAINLOG", logLocation, beepStr);
-            }
+                  logWriteln (MYSERVER_LOG_MSG_INFO, _("Reloaded"));
 
-          logWriteln("Rebooting...");
+                  mimeConfTime = mimeConfNow;
+                }
+              else if (hostsConfTimeNow != hostsConfTime)
+                {
+                  VhostManager* oldvhost = vhostList;
+                  string msg ("vhosts-conf-changed");
+                  notifyMulticast (msg, 0);
 
-          Socket::stopBlockingOperations(true);
+                  /* Do a beep if outputting to console.  */
+                  if (logLocation.find ("console://") != string::npos)
+                    {
+                      char beep[] = { static_cast<char>(0x7), '\0' };
+                      string beepStr (beep);
+                      logManager->log (this, "MAINLOG", logLocation, beepStr);
+                    }
 
-          connectionsScheduler.release();
+                  logWriteln (MYSERVER_LOG_MSG_INFO, _("Rebooting..."));
 
-          listenThreads.beginFastReboot();
+                  Socket::stopBlockingOperations (true);
 
-          listenThreads.terminate();
+                  connectionsScheduler.release ();
 
-          clearAllConnections();
+                  listenThreads.beginFastReboot ();
 
-          Socket::stopBlockingOperations(false);
+                  listenThreads.terminate ();
 
-          connectionsScheduler.restart();
-          listenThreads.initialize(&languageParser);
+                  clearAllConnections ();
 
-          vhostList = new VhostManager(&listenThreads, logManager);
+                  Socket::stopBlockingOperations (false);
 
-          if(vhostList == 0)
-            continue;
+                  connectionsScheduler.restart ();
+                  listenThreads.initialize (&languageParser);
 
-          delete oldvhost;
+                  vhostList = new VhostManager (&listenThreads, logManager);
 
-            /* Load the virtual hosts configuration from the xml file.  */
-          
if(vhostList->loadXMLConfigurationFile(vhostConfigurationFile->c_str()))
-          {
-            listenThreads.rollbackFastReboot();
-          }
-          else
-          {
-            listenThreads.commitFastReboot();
-          }
+                  if (!vhostList)
+                    continue;
 
-          hostsConfTime = hostsConfTimeNow;
-          logWriteln("Reloaded");
-        }
-      }
-    }//end  if(autoRebootEnabled)
+                  delete oldvhost;
 
-  }
+                  /* Load the virtual hosts configuration from the xml file.  
*/
+                  if (vhostList->loadXMLConfigurationFile 
(vhostConfigurationFile->c_str ()))
+                    listenThreads.rollbackFastReboot ();
+                  else
+                    listenThreads.commitFastReboot ();
+
+                  hostsConfTime = hostsConfTimeNow;
+                  logWriteln (MYSERVER_LOG_MSG_INFO, _("Reloaded"));
+                }
+            }
+        }//end  if (autoRebootEnabled)
+
+    }
 }
 
-void Server::logWriteNTimes(string str, unsigned n)
+void Server::logWriteNTimes (string str, unsigned n)
 {
   while (n--)
     logManager->log (this, "MAINLOG", logLocation, str);
 
-  string msg("");
+  string msg ("");
   logManager->log (this, "MAINLOG", logLocation, msg, true);
 }
 
 /*!
  *Display the MyServer boot.
  */
-void Server::displayBoot()
+void Server::displayBoot ()
 {
 
 #ifdef CLEAR_BOOT_SCREEN
 
   if (logLocation.find ("console://") != string::npos)
-  {
+    {
 #ifdef WIN32
-
-    /*
-     *Under the windows platform use the cls operating-system
-     *command to clear the screen.
-     */
-    _flushall();
-    system("cls");
+      _flushall();
+      system ("cls");
 #else
-  /*
-   *Under an UNIX environment, clearing the screen
-   *can be done in a similar method
-   */
-    sync();
-    system("clear");
+      sync ();
+      system ("clear");
 #endif
-  }
+    }
 
 #endif /* CLEAR_BOOT_SCREEN.  */
 
   /*
    *Print the MyServer signature only if the log writes to the console.
    */
-  if(logLocation.find ("console://") != string::npos)
-  {
-    try
-    {
-      size_t length;
-      string softwareSignature;
-      softwareSignature.assign("************ GNU MyServer ");
-      softwareSignature.append(MYSERVER_VERSION);
-      softwareSignature.append(" ************");
-      length = softwareSignature.length();
-
-      logWriteNTimes("*", length);
-      logManager->log (this, "MAINLOG", logLocation, softwareSignature, true);
-      logWriteNTimes("*", length);
-    }
-    catch(exception& e)
+  if (logLocation.find ("console://") != string::npos)
     {
-      ostringstream err;
-      err << "Error: " << e.what();
-      string str = err.str ();
-      logManager->log (this, "MAINLOG", logLocation, str, true);
-      return;
+      try
+        {
+          size_t length;
+          string softwareSignature;
+          softwareSignature.assign ("************ GNU MyServer ");
+          softwareSignature.append (MYSERVER_VERSION);
+          softwareSignature.append (" ************");
+          length = softwareSignature.length();
+
+          logWriteNTimes ("*", length);
+          logManager->log (this, "MAINLOG", logLocation, softwareSignature, 
true);
+          logWriteNTimes ("*", length);
+        }
+      catch(exception& e)
+        {
+          ostringstream err;
+          err << "Error: " << e.what ();
+          string str = err.str ();
+          logManager->log (this, "MAINLOG", logLocation, str, true);
+          return;
+        }
+      catch(...)
+        {
+          return;
+        };
     }
-    catch(...)
-    {
-      return;
-    };
-  }
 
 }
 
@@ -761,42 +697,42 @@ int Server::purgeThreads ()
   threadsMutex->lock ();
   for (list<ClientsThread*>::iterator it = threads.begin ();
        it != threads.end ();)
-  {
-    ClientsThread* thread = *it;
+    {
+      ClientsThread* thread = *it;
 
 
-    /*
-     *Shutdown all threads that can be destroyed.
-     */
-    if (thread->isStopped ())
-      {
-        ClientsThread* thread = *it;
-        list<ClientsThread*>::iterator next = it;
-        next++;
-
-        thread->join ();
-        threads.erase (it);
-        delete thread;
-
-        destroyed++;
-        it = next;
-      }
-    else if (thread->isToDestroy ())
-      {
-        if (destroyed < purgeThreadsThreshold)
-          thread->stop ();
-
-        it++;
-      }
-    else
-      {
-        if (!thread->isStatic ())
-          if (ticks - thread->getTimeout () > MYSERVER_SEC (15))
-            thread->setToDestroy (1);
-
-        it++;
-      }
-  }
+      /*
+       *Shutdown all threads that can be destroyed.
+       */
+      if (thread->isStopped ())
+        {
+          ClientsThread* thread = *it;
+          list<ClientsThread*>::iterator next = it;
+          next++;
+
+          thread->join ();
+          threads.erase (it);
+          delete thread;
+
+          destroyed++;
+          it = next;
+        }
+      else if (thread->isToDestroy ())
+        {
+          if (destroyed < purgeThreadsThreshold)
+            thread->stop ();
+
+          it++;
+        }
+      else
+        {
+          if (!thread->isStatic ())
+            if (ticks - thread->getTimeout () > MYSERVER_SEC (15))
+              thread->setToDestroy (1);
+
+          it++;
+        }
+    }
   threadsMutex->unlock ();
 
   return threads.size ();
@@ -841,7 +777,7 @@ XmlParser* Server::getLanguageParser ()
  */
 u_long Server::getNumConnections ()
 {
-  return connectionsScheduler.getConnectionsNumber();
+  return connectionsScheduler.getConnectionsNumber ();
 }
 
 /*!
@@ -890,8 +826,7 @@ void Server::stop ()
  */
 int Server::terminate ()
 {
-  if (verbosity > 1)
-    logWriteln(languageParser.getValue ("MSG_STOPT"));
+  logWriteln (MYSERVER_LOG_MSG_INFO, _("Stopping threads"));
 
   listenThreads.terminate ();
 
@@ -918,12 +853,9 @@ int Server::terminate ()
   /* Clear the home directories data.  */
   homeDir.clear ();
 
-  if (verbosity > 1)
-    logWriteln (languageParser.getValue ("MSG_TSTOPPED"));
-
+  logWriteln (MYSERVER_LOG_MSG_INFO, _("Threads stopped"));
 
-  if (verbosity > 1)
-    logWriteln (languageParser.getValue ("MSG_MEMCLEAN"));
+  logWriteln (MYSERVER_LOG_MSG_INFO, _("Cleaning memory"));
 
   freeHashedData ();
 
@@ -969,8 +901,8 @@ int Server::terminate ()
   delete threadsMutex;
 
   nStaticThreads = 0;
-  if (verbosity > 1)
-    logWriteln ("MyServer is stopped");
+
+  logWriteln (MYSERVER_LOG_MSG_INFO, _("MyServer has stopped"));
 
   logManager->clear ();
 
@@ -1020,7 +952,7 @@ int Server::initialize ()
   if (configurationFileManager.open (mainConfigurationFile->c_str ()))
     return -1;
 
-  readHashedData (xmlDocGetRootElement(configurationFileManager.getDoc 
())->xmlChildrenNode);
+  readHashedData (xmlDocGetRootElement (configurationFileManager.getDoc 
())->xmlChildrenNode);
 
   /*
    * Process console colors information.
@@ -1035,158 +967,132 @@ int Server::initialize ()
       string fullBg ("log_color." + *it + "_bg");
       data = getHashedData (fullFg.c_str ());
       if (data)
-        {
-          consoleColors[fg] = string (data);
-        }
+        consoleColors[fg] = string (data);
 
       data = getHashedData (fullBg.c_str ());
       if (data)
-        {
-          consoleColors[bg] = string (data);
-        }
+        consoleColors[bg] = string (data);
     }
 
   initLogManager ();
 
   data = getHashedData ("server.language");
-  if(languageFile)
+  if (languageFile)
     delete languageFile;
-  languageFile = new string();
-  if(data)
-  {
-    languageFile->assign(*languagesPath);
-    languageFile->append("/");
-    languageFile->append(data);
-  }
+  languageFile = new string ();
+  if (data)
+    {
+      languageFile->assign (*languagesPath);
+      languageFile->append ("/");
+      languageFile->append (data);
+    }
   else
-  {
-    languageFile->assign("languages/english.xml");
-  }
+    languageFile->assign ("languages/english.xml");
 
-  if(languageParser.open(languageFile->c_str()))
-  {
-    string err;
-    err.assign("Error loading: ");
-    logWriteln(err.c_str(), MYSERVER_LOG_MSG_ERROR);
-    return -1;
-  }
-  logWriteln(languageParser.getValue("MSG_LANGUAGE"));
+
+  /* XXX: IT IS NOT USED, AT LEAST IN THIS CLASS.  */
+  if (languageParser.open (languageFile->c_str ()))
+    {
+      logWriteln (MYSERVER_LOG_MSG_ERROR, _("Error loading language file"));
+      return -1;
+    }
+  logWriteln (MYSERVER_LOG_MSG_INFO, _("Using %s"),
+              languageParser.getValue ("MSG_LANGUAGE"));
 
   data = getHashedData ("server.verbosity");
-  if(data)
-  {
+  if (data)
     verbosity = (u_long)atoi(data);
-  }
 
   data = getHashedData ("server.buffer_size");
-  if(data)
-  {
-    buffersize=secondaryBufferSize= (atol(data) > 81920) ?  atol(data) :  
81920 ;
-  }
+  if (data)
+    buffersize = secondaryBufferSize= (atol(data) > 81920) ?  atol(data) :  
81920 ;
 
   data = getHashedData ("server.connection_timeout");
-  if(data)
-  {
-    connectionTimeout = MYSERVER_SEC((u_long)atol(data));
-  }
+  if (data)
+    connectionTimeout = MYSERVER_SEC ((u_long)atol(data));
 
   data = getHashedData ("server.static_threads");
-  if(data)
-  {
+  if (data)
     nStaticThreads = atoi(data);
-  }
 
   data = getHashedData ("server.max_threads");
-  if(data)
-  {
+  if (data)
     nMaxThreads = atoi(data);
-  }
 
   /* Get the max connections number to allow.  */
   data = getHashedData ("server.max_connections");
-  if(data)
-  {
+  if (data)
     maxConnections = atoi(data);
-  }
 
   /* Get the max connections number to accept.  */
   data = getHashedData ("server.max_accepted_connections");
-  if(data)
-  {
+  if (data)
     maxConnectionsToAccept = atoi(data);
-  }
 
   data = getHashedData ("server.connections_pool.size");
-  if(data)
-  {
+  if (data)
     connectionsPool.init (atoi (data));
-  }
 
   /* Get the default throttling rate to use on connections.  */
   data = getHashedData ("connection.throttling");
-  if(data)
-  {
+  if (data)
     throttlingRate = (u_long)atoi(data);
-  }
-
 
   data = getHashedData ("server.max_log_size");
-  if(data)
-  {
+  if (data)
     maxLogFileSize=(u_long)atol(data);
-  }
 
-  data = configurationFileManager.getValue("server.max_files_cache");
-  if(data)
-  {
-    u_long maxSize = (u_long)atol(data);
-    cachedFiles.initialize(maxSize);
-  }
+  data = configurationFileManager.getValue ("server.max_files_cache");
+  if (data)
+    {
+      u_long maxSize = (u_long)atol(data);
+      cachedFiles.initialize (maxSize);
+    }
   else
-    cachedFiles.initialize(1 << 23);
+    cachedFiles.initialize (1 << 23);
 
   data = getHashedData ("server.temp_directory");
   if (data)
-  {
-    string tmpPath (data);
-    FilesUtility::completePath (tmpPath);
-    FilesUtility::setTmpPath (tmpPath);
-  }
+    {
+      string tmpPath (data);
+      FilesUtility::completePath (tmpPath);
+      FilesUtility::setTmpPath (tmpPath);
+    }
   else
     FilesUtility::resetTmpPath ();
 
   data = getHashedData ("server.max_file_cache");
-  if(data)
-  {
-    u_long maxSize = (u_long)atol(data);
-    cachedFiles.setMaxSize(maxSize);
-  }
+  if (data)
+    {
+      u_long maxSize = (u_long)atol(data);
+      cachedFiles.setMaxSize (maxSize);
+    }
 
   data = getHashedData ("server.min_file_cache");
-  if(data)
-  {
-    u_long minSize = (u_long)atol(data);
-    cachedFiles.setMinSize(minSize);
-  }
+  if (data)
+    {
+      u_long minSize = (u_long)atol(data);
+      cachedFiles.setMinSize (minSize);
+    }
 
   data = getHashedData ("server.uid");
-  if(data)
+  if (data)
     uid.assign (data);
   else
     uid.assign ("");
 
   data = getHashedData ("server.gid");
-  if(data)
+  if (data)
     gid.assign (data);
   else
     gid.assign ("");
 
   data = getHashedData ("server.max_servers");
-  if(data)
-  {
-    int maxServersProcesses = atoi(data);
-    getProcessServerManager()->setMaxServers(maxServersProcesses);
-  }
+  if (data)
+    {
+      int maxServersProcesses = atoi(data);
+      getProcessServerManager ()->setMaxServers (maxServersProcesses);
+    }
 
   return 0;
 }
@@ -1206,24 +1112,24 @@ void Server::readHashedData (xmlNodePtr lcur)
  *Check if there are free threads to handle a new request.  If there
  *are not enough threads create a new one.
  */
-void Server::checkThreadsNumber()
+void Server::checkThreadsNumber ()
 {
-  threadsMutex->lock();
+  threadsMutex->lock ();
 
   /*
    *Create a new thread if there are not available threads and
    *we did not reach the limit.
    */
-  if((threads.size() < nMaxThreads) && (freeThreads < 1))
-    addThread(false);
+  if ((threads.size () < nMaxThreads) && (freeThreads < 1))
+    addThread (false);
 
-  threadsMutex->unlock();
+  threadsMutex->unlock ();
 }
 
 /*!
  *Get the default throttling rate to use with connections to the server.
  */
-u_long Server::getThrottlingRate()
+u_long Server::getThrottlingRate ()
 {
   return throttlingRate;
 }
@@ -1232,7 +1138,7 @@ u_long Server::getThrottlingRate()
  *This function returns the max size of the logs file as defined in the
  *configuration file.
  */
-int Server::getMaxLogFileSize()
+int Server::getMaxLogFileSize ()
 {
   return maxLogFileSize;
 }
@@ -1240,7 +1146,7 @@ int Server::getMaxLogFileSize()
 /*!
  *Returns the connection timeout.
  */
-u_long Server::getTimeout()
+u_long Server::getTimeout ()
 {
   return connectionTimeout;
 }
@@ -1248,7 +1154,7 @@ u_long Server::getTimeout()
 /*!
  *This function add a new connection to the list.
  */
-int Server::addConnection(Socket s, MYSERVER_SOCKADDRIN *asockIn)
+int Server::addConnection (Socket s, MYSERVER_SOCKADDRIN *asockIn)
 {
 
   int ret = 0;
@@ -1272,91 +1178,91 @@ int Server::addConnection(Socket s, MYSERVER_SOCKADDRIN 
*asockIn)
        (asockIn->ss_family != AF_INET && asockIn->ss_family != AF_INET6))
     return 0;
 
-  memset(ip, 0, MAX_IP_STRING_LEN);
-  memset(localIp, 0, MAX_IP_STRING_LEN);
+  memset (ip, 0, MAX_IP_STRING_LEN);
+  memset (localIp, 0, MAX_IP_STRING_LEN);
 
-  if( s.getHandle() == 0 )
+  if ( s.getHandle () == 0 )
     return 0;
 
   /*
    *Do not accept this connection if a MAX_CONNECTIONS_TO_ACCEPT limit is
    *defined.
    */
-  if(maxConnectionsToAccept &&
-     ((u_long)connectionsScheduler.getConnectionsNumber() >= 
maxConnectionsToAccept))
+  if (maxConnectionsToAccept &&
+      ((u_long)connectionsScheduler.getConnectionsNumber () >= 
maxConnectionsToAccept))
     return 0;
 
 #if ( HAVE_IPV6 )
   if ( asockIn->ss_family == AF_INET )
-    ret = getnameinfo(reinterpret_cast<const sockaddr *>(asockIn),
-                      sizeof(sockaddr_in),
-                      ip, MAX_IP_STRING_LEN, NULL, 0, NI_NUMERICHOST);
+    ret = getnameinfo (reinterpret_cast<const sockaddr *>(asockIn),
+                       sizeof(sockaddr_in),
+                       ip, MAX_IP_STRING_LEN, NULL, 0, NI_NUMERICHOST);
   else
-    ret = getnameinfo(reinterpret_cast<const sockaddr *>(asockIn),
-                      sizeof(sockaddr_in6),  ip, MAX_IP_STRING_LEN,
-                      NULL, 0, NI_NUMERICHOST);
-  if(ret)
-     return 0;
+    ret = getnameinfo (reinterpret_cast<const sockaddr *>(asockIn),
+                       sizeof(sockaddr_in6),  ip, MAX_IP_STRING_LEN,
+                       NULL, 0, NI_NUMERICHOST);
+  if (ret)
+    return 0;
 
   if ( asockIn->ss_family == AF_INET )
     dim = sizeof(sockaddr_in);
   else
     dim = sizeof(sockaddr_in6);
-  s.getsockname((MYSERVER_SOCKADDR*)&localSockIn, &dim);
+  s.getsockname ((MYSERVER_SOCKADDR*)&localSockIn, &dim);
 
   if ( asockIn->ss_family == AF_INET )
-    ret = getnameinfo(reinterpret_cast<const sockaddr *>(&localSockIn),
-                      sizeof(sockaddr_in), localIp, MAX_IP_STRING_LEN,
-                      NULL, 0, NI_NUMERICHOST);
+    ret = getnameinfo (reinterpret_cast<const sockaddr *>(&localSockIn),
+                       sizeof(sockaddr_in), localIp, MAX_IP_STRING_LEN,
+                       NULL, 0, NI_NUMERICHOST);
   else// AF_INET6
-    ret = getnameinfo(reinterpret_cast<const sockaddr *>(&localSockIn),
-                      sizeof(sockaddr_in6), localIp, MAX_IP_STRING_LEN,
-                      NULL, 0, NI_NUMERICHOST);
-  if(ret)
-     return 0;
+    ret = getnameinfo (reinterpret_cast<const sockaddr *>(&localSockIn),
+                       sizeof(sockaddr_in6), localIp, MAX_IP_STRING_LEN,
+                       NULL, 0, NI_NUMERICHOST);
+  if (ret)
+    return 0;
 #else// !HAVE_IPV6
   dim = sizeof(localSockIn);
-  s.getsockname((MYSERVER_SOCKADDR*)&localSockIn, &dim);
-  strncpy(ip,  inet_ntoa(((sockaddr_in *)asockIn)->sin_addr),
-          MAX_IP_STRING_LEN);
-  strncpy(localIp,  inet_ntoa(((sockaddr_in *)&localSockIn)->sin_addr),
-          MAX_IP_STRING_LEN);
+  s.getsockname ((MYSERVER_SOCKADDR*)&localSockIn, &dim);
+  strncpy (ip,  inet_ntoa (((sockaddr_in *)asockIn)->sin_addr),
+           MAX_IP_STRING_LEN);
+  strncpy (localIp,  inet_ntoa (((sockaddr_in *)&localSockIn)->sin_addr),
+           MAX_IP_STRING_LEN);
 #endif//HAVE_IPV6
 
   /* Port used by the client.  */
-    if ( asockIn->ss_family == AF_INET )
-      port = ntohs(((sockaddr_in *)(asockIn))->sin_port);
+  if ( asockIn->ss_family == AF_INET )
+    port = ntohs (((sockaddr_in *)(asockIn))->sin_port);
 #if HAVE_IPV6
   else
-    port = ntohs(((sockaddr_in6 *)(asockIn))->sin6_port);
+    port = ntohs (((sockaddr_in6 *)(asockIn))->sin6_port);
 #endif
 
   /* Port used by the server. */
   if ( localSockIn.ss_family == AF_INET )
-      myPort = ntohs(((sockaddr_in *)(&localSockIn))->sin_port);
+    myPort = ntohs (((sockaddr_in *)(&localSockIn))->sin_port);
 #if HAVE_IPV6
   else
-    myPort = ntohs(((sockaddr_in6 *)(&localSockIn))->sin6_port);
+    myPort = ntohs (((sockaddr_in6 *)(&localSockIn))->sin6_port);
 #endif
 
-  if(!addConnectionToList(&s, asockIn, &ip[0], &localIp[0], port, myPort, 1))
-  {
-    /* If we report error to add the connection to the thread.  */
-    ret = 0;
+  if (!addConnectionToList (&s, asockIn, &ip[0], &localIp[0], port, myPort, 1))
+    {
+      /* If we report error to add the connection to the thread.  */
+      ret = 0;
 
-    /* Shutdown the socket both on receive that on send.  */
-    s.shutdown(2);
+      /* Shutdown the socket both on receive that on send.  */
+      s.shutdown (2);
 
-    /* Then close it.  */
-    s.close();
-  }
+      /* Then close it.  */
+      s.close ();
+    }
   return ret;
 }
 
 /*!
  *Return the max number of threads that the server can start.
  */
-int Server::getMaxThreads()
+int Server::getMaxThreads ()
 {
   return nMaxThreads;
 }
@@ -1365,11 +1271,11 @@ int Server::getMaxThreads()
  *Add a new connection.
  *A connection is defined using a connection struct.
  */
-ConnectionPtr Server::addConnectionToList(Socket* s,
-                                          MYSERVER_SOCKADDRIN* /*asockIn*/,
-                                          char *ipAddr, char *localIpAddr,
-                                          u_short port, u_short localPort,
-                                          int /*id*/)
+ConnectionPtr Server::addConnectionToList (Socket* s,
+                                           MYSERVER_SOCKADDRIN* /*asockIn*/,
+                                           char *ipAddr, char *localIpAddr,
+                                           u_short port, u_short localPort,
+                                           int /*id*/)
 {
   int doSSLhandshake = 0;
   int doFastCheck = 0;
@@ -1382,101 +1288,98 @@ ConnectionPtr Server::addConnectionToList(Socket* s,
   newConnection = connectionsPool.forcedGet ();
   connectionsPoolLock.unlock ();
 
-  if(!newConnection)
+  if (!newConnection)
     return NULL;
   else
     newConnection->init ();
 
-  newConnection->setPort(port);
-  newConnection->setTimeout( getTicks() );
-  newConnection->setLocalPort(localPort);
-  newConnection->setIpAddr(ipAddr);
-  newConnection->setLocalIpAddr(localIpAddr);
-  newConnection->host = vhostList->getVHost(0,
-                                            localIpAddr,
-                                            localPort);
+  newConnection->setPort (port);
+  newConnection->setTimeout ( getTicks () );
+  newConnection->setLocalPort (localPort);
+  newConnection->setIpAddr (ipAddr);
+  newConnection->setLocalIpAddr (localIpAddr);
+  newConnection->host = vhostList->getVHost (0,
+                                             localIpAddr,
+                                             localPort);
 
   /* No vhost for the connection so bail.  */
-  if(newConnection->host == 0)
-  {
-    connectionsPoolLock.lock ();
-    connectionsPool.put (newConnection);
-    connectionsPoolLock.unlock ();
-    return 0;
-  }
+  if (newConnection->host == 0)
+    {
+      connectionsPoolLock.lock ();
+      connectionsPool.put (newConnection);
+      connectionsPoolLock.unlock ();
+      return 0;
+    }
 
-  protocol = getProtocol(newConnection->host->getProtocolName());
+  protocol = getProtocol(newConnection->host->getProtocolName ());
 
-  if(protocol)
-    opts = protocol->getProtocolOptions();
+  if (protocol)
+    opts = protocol->getProtocolOptions ();
 
-  if(opts & PROTOCOL_USES_SSL)
+  if (opts & PROTOCOL_USES_SSL)
     doSSLhandshake = 1;
 
-  if(opts & PROTOCOL_FAST_CHECK)
+  if (opts & PROTOCOL_FAST_CHECK)
     doFastCheck = 1;
 
 
-  {
-    string msg("new-connection");
 
-    handlers = getHandlers(msg);
+  string msg ("new-connection");
+
+  handlers = getHandlers (msg);
+
+  if (handlers)
+    {
+      for (size_t i = 0; i < handlers->size (); i++)
+        if ((*handlers)[i]->updateMulticast (this, msg, newConnection) == 1)
+          {
+            connectionsPoolLock.lock ();
+            connectionsPool.put (newConnection);
+            connectionsPoolLock.unlock ();
+            return 0;
+          }
+    }
 
-    if(handlers)
+  /* Do the SSL handshake if required.  */
+  if (doSSLhandshake)
     {
-      for(size_t i = 0; i < handlers->size(); i++)
-        if((*handlers)[i]->updateMulticast(this, msg, newConnection) == 1)
+      int ret = 0;
+      SSL_CTX* ctx = newConnection->host->getSSLContext ();
+      SslSocket *sslSocket = new SslSocket (s);
+
+      sslSocket->setSSLContext (ctx);
+      ret = sslSocket->sslAccept ();
+
+      if (ret < 0)
         {
           connectionsPoolLock.lock ();
           connectionsPool.put (newConnection);
           connectionsPoolLock.unlock ();
+          delete sslSocket;
           return 0;
         }
+      newConnection->socket = sslSocket;
     }
-  }
-
-  /* Do the SSL handshake if required.  */
-  if(doSSLhandshake)
-  {
-    int ret = 0;
-    SSL_CTX* ctx = newConnection->host->getSSLContext();
-    SslSocket *sslSocket = new SslSocket(s);
-
-    sslSocket->setSSLContext(ctx);
-    ret = sslSocket->sslAccept();
+  else
+    newConnection->socket = new Socket (s);
 
-    if(ret < 0)
+  if (doFastCheck)
     {
-      connectionsPoolLock.lock ();
-      connectionsPool.put (newConnection);
-      connectionsPoolLock.unlock ();
-      delete sslSocket;
-      return 0;
+      newConnection->setScheduled (1);
+      newConnection->setForceControl (1);
+      newConnection->socket->setNonBlocking (1);
+      connectionsScheduler.addNewReadyConnection (newConnection);
     }
-    newConnection->socket = sslSocket;
-  }
-  else
-  {
-    newConnection->socket = new Socket(s);
-  }
-
-  if ( doFastCheck )
-  {
-    newConnection->setScheduled(1);
-    newConnection->setForceControl(1);
-    newConnection->socket->setNonBlocking (1);
-    connectionsScheduler.addNewReadyConnection(newConnection);
-  }
   else
-    connectionsScheduler.addNewWaitingConnection(newConnection);
+    connectionsScheduler.addNewWaitingConnection (newConnection);
 
   /*
-   *If defined maxConnections and the number of active connections
-   *is bigger than it say to the protocol that will parse the connection
-   *to remove it from the active connections list.
+   * If defined maxConnections and the number of active connections
+   * is bigger than it say to the protocol that will parse the connection
+   * to remove it from the active connections list.
    */
-  if(maxConnections && ((u_long)connectionsScheduler.getConnectionsNumber ()
-                        > maxConnections))
+  if (maxConnections && ((u_long)connectionsScheduler.getConnectionsNumber ()
+                         > maxConnections))
     newConnection->setToRemove (Connection::REMOVE_OVERLOAD);
 
   connectionsScheduler.registerConnectionID (newConnection);
@@ -1484,14 +1387,12 @@ ConnectionPtr Server::addConnectionToList(Socket* s,
   return newConnection;
 }
 
-
-
 /*!
- *Delete a connection.
+ * Delete a connection.
  */
-int Server::deleteConnection(ConnectionPtr s)
+int Server::deleteConnection (ConnectionPtr s)
 {
-  notifyDeleteConnection(s);
+  notifyDeleteConnection (s);
   connectionsScheduler.removeConnection (s);
 
   s->destroy ();
@@ -1504,232 +1405,219 @@ int Server::deleteConnection(ConnectionPtr s)
 }
 
 /*!
- *Get notified when a connection is closed.
+ * Get notified when a connection is closed.
  */
-int Server::notifyDeleteConnection(ConnectionPtr s)
+int Server::notifyDeleteConnection (ConnectionPtr s)
 {
-  string msg("remove-connection");
+  string msg ("remove-connection");
   vector<Multicast<string, void*, int>*>* handlers;
 
-  handlers = getHandlers(msg);
+  handlers = getHandlers (msg);
+
+  if (handlers)
+    for (size_t i = 0; i < handlers->size (); i++)
+      (*handlers)[i]->updateMulticast (this, msg, s);
 
-  if(handlers)
-  {
-    for(size_t i = 0; i < handlers->size(); i++)
-    {
-      (*handlers)[i]->updateMulticast(this, msg, s);
-    }
-  }
   return 0;
 }
 
 /*!
- *Get a connection to parse.
+ * Get a connection to parse.
  */
-ConnectionPtr Server::getConnection(int /*id*/)
+ConnectionPtr Server::getConnection (int /*id*/)
 {
-  return connectionsScheduler.getConnection();
+  return connectionsScheduler.getConnection ();
 }
 
 /*!
- *Delete all the active connections.
+ * Delete all the active connections.
  */
-void Server::clearAllConnections()
+void Server::clearAllConnections ()
 {
   list<ConnectionPtr> connections;
   list<ConnectionPtr>::iterator it;
 
-  connectionsScheduler.getConnections(connections);
+  connectionsScheduler.getConnections (connections);
 
   try
-  {
-    for(it = connections.begin(); it != connections.end(); it++)
     {
-      deleteConnection(*it);
+      for (it = connections.begin (); it != connections.end (); it++)
+        deleteConnection (*it);
     }
-  }
   catch(...)
-  {
-    throw;
-  };
+    {
+      throw;
+    };
 }
 
 
 /*!
- *Returns the full path of the binaries directory.
- *The directory where the file myserver(.exe) is.
+ * Returns the full path of the binaries directory.
+ * The directory where the file myserver (.exe) is.
  */
-const char *Server::getPath()
+const char *Server::getPath ()
 {
-  return path ? path->c_str() : "";
+  return path ? path->c_str () : "";
 }
 
 /*!
- *Add a free thread.
+ * Add a free thread.
  */
-void Server::increaseFreeThread()
+void Server::increaseFreeThread ()
 {
-  threadsMutex->lock();
+  threadsMutex->lock ();
   freeThreads++;
-  threadsMutex->unlock();
+  threadsMutex->unlock ();
 }
 
 /*!
- *Remove a free thread.
+ * Remove a free thread.
  */
-void Server::decreaseFreeThread()
+void Server::decreaseFreeThread ()
 {
-  threadsMutex->lock();
+  threadsMutex->lock ();
   freeThreads--;
-  threadsMutex->unlock();
+  threadsMutex->unlock ();
 }
 
 
 /*!
- *Returns the name of the server(the name of the current PC).
+ * Returns the name of the server (the name of the current PC).
  */
-const char *Server::getServerName()
+const char *Server::getServerName ()
 {
   return serverName;
 }
 
 /*!
- *Gets the number of threads.
+ * Gets the number of threads.
  */
-u_long Server::getNumThreads()
+u_long Server::getNumThreads ()
 {
   u_long ret;
-  threadsMutex->lock();
-  ret = threads.size();
-  threadsMutex->unlock();
+  threadsMutex->lock ();
+  ret = threads.size ();
+  threadsMutex->unlock ();
   return ret;
 }
 
 /*!
- *Returns a comma-separated local machine IPs list.
- *For example: 192.168.0.1, 61.62.63.64, 65.66.67.68.69
+ * Returns a comma-separated local machine IPs list.
+ * For example: 192.168.0.1, 61.62.63.64, 65.66.67.68.69
  */
-const char *Server::getAddresses()
+const char *Server::getAddresses ()
 {
-  return ipAddresses ? ipAddresses->c_str() : "";
+  return ipAddresses ? ipAddresses->c_str () : "";
 }
 
 /*!
- *Clear the data dictionary.
- *Returns zero on success.
+ * Clear the data dictionary.
+ * Returns zero on success.
  */
-int Server::freeHashedData()
+int Server::freeHashedData ()
 {
   try
-  {
-    list<NodeTree<string>*>::iterator it = hashedDataTrees.begin ();
-    while (it != hashedDataTrees.end ())
-      {
-        delete *it;
-        it++;
-      }
-
-    hashedDataTrees.clear ();
-    hashedData.clear();
-  }
+    {
+      list<NodeTree<string>*>::iterator it = hashedDataTrees.begin ();
+      while (it != hashedDataTrees.end ())
+        {
+          delete *it;
+          it++;
+        }
+
+      hashedDataTrees.clear ();
+      hashedData.clear ();
+    }
   catch(...)
-  {
-    return 1;
-  }
+    {
+      return 1;
+    }
   return 0;
 }
 
 /*!
- *Get the value for name in the hash dictionary.
+ * Get the value for name in the hash dictionary.
  */
-const char* Server::getHashedData(const char* name)
+const char* Server::getHashedData (const char* name)
 {
-  NodeTree<string> *s = hashedData.get(name);
+  NodeTree<string> *s = hashedData.get (name);
 
-  return s ? s->getValue ()->c_str() : 0;
+  return s ? s->getValue ()->c_str () : 0;
 }
 
 /*!
- *Get the specified protocol.
+ * Get the specified protocol.
  */
-Protocol* Server::getProtocol(const char *protocolName)
+Protocol* Server::getProtocol (const char *protocolName)
 {
-  string protocol(protocolName);
+  string protocol (protocolName);
 
-  return protocols.getProtocol(protocol);
+  return protocols.getProtocol (protocol);
 }
 
 /*!
- *Get where external protocols are.
+ * Get where external protocols are.
  */
-const char* Server::getExternalPath()
+const char* Server::getExternalPath ()
 {
-  return externalPath ? externalPath->c_str() : "";
+  return externalPath ? externalPath->c_str () : "";
 }
 
 
 /*!
- *If specified set the uid/gid for the process.
+ * If specified set the uid/gid for the process.
  */
-void Server::setProcessPermissions()
+void Server::setProcessPermissions ()
 {
-    /*
-     *If the configuration specify a group id, change the current group for
-     *the process.
-     */
-  if(gid.length ())
+  /*
+   * If the configuration specify a group id, change the current group for
+   * the process.
+   */
+  if (gid.length ())
     {
       ostringstream out;
 
       if (Process::setAdditionalGroups (0, 0))
-        {
-          out << languageParser.getValue("ERR_ERROR")
-              << ": setAdditionalGroups";
-          logWriteln(out.str().c_str(), MYSERVER_LOG_MSG_ERROR);
-        }
+        logWriteln (MYSERVER_LOG_MSG_ERROR, _("Error setting additional 
groups"));
 
       if (Process::setgid (gid.c_str ()))
-        {
-          out << languageParser.getValue("ERR_ERROR") << ": setgid " << gid;
-          logWriteln(out.str().c_str(), MYSERVER_LOG_MSG_ERROR);
-        }
+        logWriteln (MYSERVER_LOG_MSG_ERROR, _("Error setting gid"));
+
       autoRebootEnabled = false;
     }
 
-    /*
-     *If the configuration file provides a user identifier, change the
-     *current user for the process. Disable the reboot when this feature
-     *is used.
-     */
-  if(uid.length ())
+  /*
+   * If the configuration file provides a user identifier, change the
+   * current user for the process. Disable the reboot when this feature
+   * is used.
+   */
+  if (uid.length ())
     {
       ostringstream out;
       if (Process::setuid (uid.c_str ()))
-        {
-          out << languageParser.getValue("ERR_ERROR") << ": setuid " << uid;
-          logWriteln(out.str().c_str(), MYSERVER_LOG_MSG_ERROR);
-        }
+        logWriteln (MYSERVER_LOG_MSG_ERROR, _("Error setting uid"));
+
       autoRebootEnabled = false;
     }
 }
 
 /*!
- *Reboot the server.
- *Returns non zero on errors.
+ * Reboot the server.
+ * Returns non zero on errors.
  */
-int Server::reboot()
+int Server::reboot ()
 {
   int ret;
-  string msg("reboot-server");
+  string msg ("reboot-server");
   vector<Multicast<string, void*, int>*>* handlers;
 
-  handlers = getHandlers(msg);
+  handlers = getHandlers (msg);
 
-  if(handlers)
-  {
-    for(size_t i = 0; i < handlers->size(); i++)
-      (*handlers)[i]->updateMulticast(this, msg, 0);
-  }
+  if (handlers)
+    {
+      for (size_t i = 0; i < handlers->size (); i++)
+        (*handlers)[i]->updateMulticast (this, msg, 0);
+    }
 
   serverReady = false;
   /* Reset the toReboot flag.  */
@@ -1738,25 +1626,26 @@ int Server::reboot()
   rebooting = true;
 
   /* Do nothing if the reboot is disabled.  */
-  if(!autoRebootEnabled)
+  if (!autoRebootEnabled)
     return 0;
 
   /* Do a beep if outputting to console.  */
   if (logLocation.find ("console://") != string::npos)
-  {
-    char beep[] = { static_cast<char>(0x7), '\0' };
-    string beepStr (beep);
-    logManager->log (this, "MAINLOG", logLocation, beepStr);
-  }
+    {
+      char beep[] = { static_cast<char>(0x7), '\0' };
+      string beepStr (beep);
+      logManager->log (this, "MAINLOG", logLocation, beepStr);
+    }
 
-  logWriteln("Rebooting...");
-  if(mustEndServer)
+  logWriteln (MYSERVER_LOG_MSG_INFO, _("Rebooting"));
+
+  if (mustEndServer)
     return 0;
 
   mustEndServer = true;
 
-  ret = terminate();
-  if(ret)
+  ret = terminate ();
+  if (ret)
     return ret;
 
   mustEndServer = false;
@@ -1764,30 +1653,30 @@ int Server::reboot()
 
   rebooting = false;
 
-  ret = initialize() || postLoad();
+  ret = initialize () || postLoad ();
 
-  if(ret)
+  if (ret)
     return ret;
 
   serverReady = true;
 
-  logWriteln("Rebooted");
+  logWriteln (MYSERVER_LOG_MSG_INFO, _("Restarted"));
 
   return 0;
 }
 
 /*!
- *Returns if the server is ready.
+ * Returns if the server is ready.
  */
-bool Server::isServerReady()
+bool Server::isServerReady ()
 {
   return serverReady;
 }
 
 /*!
- *Reboot the server on the next loop.
+ * Reboot the server on the next loop.
  */
-void Server::rebootOnNextLoop()
+void Server::rebootOnNextLoop ()
 {
   serverReady = false;
   toReboot = true;
@@ -1795,161 +1684,157 @@ void Server::rebootOnNextLoop()
 
 
 /*!
- *Return the factory object to create cached files.
+ * Return the factory object to create cached files.
  */
-CachedFileFactory* Server::getCachedFiles()
+CachedFileFactory* Server::getCachedFiles ()
 {
   return &cachedFiles;
 }
 
 /*!
- *Return the path to the mail configuration file.
+ * Return the path to the mail configuration file.
  */
-const char *Server::getMainConfFile()
+const char *Server::getMainConfFile ()
 {
   return mainConfigurationFile
-    ? mainConfigurationFile->c_str() : 0;
+    ? mainConfigurationFile->c_str () : 0;
 }
 
 /*!
- *Return the path to the mail configuration file.
+ * Return the path to the mail configuration file.
  */
-const char *Server::getVhostConfFile()
+const char *Server::getVhostConfFile ()
 {
-  return vhostConfigurationFile ? vhostConfigurationFile->c_str() : 0;
+  return vhostConfigurationFile ? vhostConfigurationFile->c_str () : NULL;
 }
 
 /*!
- *Return the path to the mail configuration file.
+ * Return the path to the mail configuration file.
  */
-const char *Server::getMIMEConfFile()
+const char *Server::getMIMEConfFile ()
 {
-  return mimeConfigurationFile ? mimeConfigurationFile->c_str() : "";
+  return mimeConfigurationFile ? mimeConfigurationFile->c_str () : "";
 }
 
 /*!
- *Get a list with all the alive connections.
+ * Get a list with all the alive connections.
  */
-void Server::getConnections(list<ConnectionPtr>& out)
+void Server::getConnections (list<ConnectionPtr>& out)
 {
-  connectionsScheduler.getConnections(out);
+  connectionsScheduler.getConnections (out);
 }
 
 /*!
- *Disable the autoreboot.
+ * Disable the autoreboot.
  */
-void Server::disableAutoReboot()
+void Server::disableAutoReboot ()
 {
   autoRebootEnabled = false;
 }
 
 /*!
- *Enable the autoreboot
+ * Enable the autoreboot
  */
-void Server::enableAutoReboot()
+void Server::enableAutoReboot ()
 {
   autoRebootEnabled = true;
 }
 
-
 /*!
- *Return the ProtocolManager object.
+ * Return the ProtocolManager object.
  */
-ProtocolsManager *Server::getProtocolsManager()
+ProtocolsManager *Server::getProtocolsManager ()
 {
   return &protocols;
 }
 
 /*!
- *Get the path to the directory containing all the language files.
+ * Get the path to the directory containing all the language files.
  */
-const char *Server::getLanguagesPath()
+const char *Server::getLanguagesPath ()
 {
-  return languagesPath ? languagesPath->c_str() : "";
+  return languagesPath ? languagesPath->c_str () : "";
 }
 
 /*!
- *Get the current language file.
+ * Get the current language file.
  */
-const char *Server::getLanguageFile()
+const char *Server::getLanguageFile ()
 {
-  return languageFile ? languageFile->c_str() : "";
+  return languageFile ? languageFile->c_str () : "";
 }
 
 /*!
- *Return nonzero if the autoreboot is enabled.
+ * Return nonzero if the autoreboot is enabled.
  */
-bool Server::isAutorebootEnabled()
+bool Server::isAutorebootEnabled ()
 {
   return autoRebootEnabled;
 }
 
 /*!
- *Create a new thread.
+ * Create a new thread.
  */
-int Server::addThread(bool staticThread)
+int Server::addThread (bool staticThread)
 {
   int ret;
-  string msg("new-thread");
+  string msg ("new-thread");
   ClientsThread* newThread = 0;
   vector<Multicast<string, void*, int>*>* handlers;
 
   purgeThreadsThreshold = 1;
 
-  if(isRebooting())
+  if (isRebooting ())
     return -1;
 
-  if(!staticThread)
-  {
-    bool restored = false;
-
-    for(list<ClientsThread*>::iterator it = threads.begin(); it != 
threads.end(); it++)
+  if (!staticThread)
     {
-      ClientsThread* thread = *it;
+      bool restored = false;
+
+      for (list<ClientsThread*>::iterator it = threads.begin (); it
+             != threads.end (); it++)
+        {
+          ClientsThread* thread = *it;
 
-      if(thread->isToDestroy())
-      {
-        thread->setToDestroy(0);
-        restored = true;
-        break;
-      }
+          if (thread->isToDestroy ())
+            {
+              thread->setToDestroy (0);
+              restored = true;
+              break;
+            }
+        }
+      if (restored)
+        return 0;
     }
-    if(restored)
-      return 0;
-  }
 
-  newThread = new ClientsThread(this);
+  newThread = new ClientsThread (this);
 
-  if(newThread == 0)
+  if (newThread == 0)
     return -1;
 
-  handlers = getHandlers(msg);
+  handlers = getHandlers (msg);
 
-  if(handlers)
-  {
-    for(size_t i = 0; i < handlers->size(); i++)
+  if (handlers)
     {
-      (*handlers)[i]->updateMulticast(this, msg, newThread);
+      for (size_t i = 0; i < handlers->size (); i++)
+        {
+          (*handlers)[i]->updateMulticast (this, msg, newThread);
+        }
     }
-  }
 
-  newThread->setStatic(staticThread);
+  newThread->setStatic (staticThread);
 
   newThread->id = (u_long)(++currentThreadID);
 
-  ret = newThread->run();
+  ret = newThread->run ();
 
-  if(ret)
-  {
-    string str;
-    delete newThread;
-    str.assign(languageParser.getValue("ERR_ERROR"));
-    str.append(": Threads creation" );
-    logWriteln(str.c_str(), MYSERVER_LOG_MSG_ERROR);
-    return -1;
-  }
+  if (ret)
+    {
+      logWriteln (MYSERVER_LOG_MSG_ERROR, _("Error creating thread"));
+      return -1;
+    }
 
-  threads.push_back(newThread);
+  threads.push_back (newThread);
   return 0;
 }
 
@@ -1957,36 +1842,36 @@ int Server::addThread(bool staticThread)
  *Remove a thread.
  *Return zero if a thread was removed.
  */
-int Server::removeThread(u_long ID)
+int Server::removeThread (u_long ID)
 {
   int ret = 1;
-  string msg("remove-thread");
+  string msg ("remove-thread");
   vector<Multicast<string, void*, int>*>* handlers;
 
 
-  handlers = getHandlers(msg);
+  handlers = getHandlers (msg);
 
-  threadsMutex->lock();
+  threadsMutex->lock ();
 
-  if(handlers)
-  {
-    for(size_t i = 0; i < handlers->size(); i++)
+  if (handlers)
     {
-      (*handlers)[i]->updateMulticast(this, msg, &ID);
+      for (size_t i = 0; i < handlers->size (); i++)
+        {
+          (*handlers)[i]->updateMulticast (this, msg, &ID);
+        }
     }
-  }
 
-  for(list<ClientsThread*>::iterator it = threads.begin(); it != 
threads.end(); it++)
-  {
-    if((*it)->id == ID)
+  for (list<ClientsThread*>::iterator it = threads.begin (); it != threads.end 
(); it++)
     {
-      (*it)->stop();
-      ret = 0;
-      threads.erase(it);
-      break;
+      if ((*it)->id == ID)
+        {
+          (*it)->stop();
+          ret = 0;
+          threads.erase (it);
+          break;
+        }
     }
-  }
-  threadsMutex->unlock();
+  threadsMutex->unlock ();
   return ret;
 
 }
@@ -1996,16 +1881,16 @@ int Server::removeThread(u_long ID)
  *the Server class.  The instance is not created in
  *getInstance to have a faster inline function.
  */
-void Server::createInstance()
+void Server::createInstance ()
 {
-  if(instance == 0)
-    instance = new Server();
+  if (instance == 0)
+    instance = new Server ();
 }
 
 /*!
  *Get a pointer to a filters factory object.
  */
-FiltersFactory* Server::getFiltersFactory()
+FiltersFactory* Server::getFiltersFactory ()
 {
   return &filtersFactory;
 }
@@ -2013,49 +1898,52 @@ FiltersFactory* Server::getFiltersFactory()
 /*!
  *Check how many threads are not working.
  */
-int Server::countAvailableThreads()
+int Server::countAvailableThreads ()
 {
- int count = 0;
+  int count = 0;
 
-  threadsMutex->lock();
+  threadsMutex->lock ();
 
   count = freeThreads;
 
-  threadsMutex->unlock();
+  threadsMutex->unlock ();
 
   return count;
 }
 
 /*!
- *Write a string to the log file and terminate the line.
+ * Write a message on a single LogStream specifying a formatting string.
+ *
+ * \see LogManager#log (void*, string, string, LoggingLeve, bool, va_list)
+ * \return 0 on success, 1 on error.
  */
-int Server::logWriteln(char const* str, LoggingLevel level)
+int Server::logWriteln (LoggingLevel level, const char *fmt, ...)
 {
-  if(!str)
+  int failure = 0;
+
+  va_list argptr;
+
+  va_start (argptr, fmt);
+
+  if (!fmt)
     return 0;
 
-  /*
-   *If the log receiver is not the console output a timestamp.
-   */
-  if (logLocation.find ("console://") == string::npos)
-  {
-    char time[38];
-    int len;
-    time[0] = '[';
-    getRFC822GMTTime(&time[1], 32);
-    len = strlen(time);
-    time[len + 0] = ']';
-    time[len + 1] = ' ';
-    time[len + 2] = '-';
-    time[len + 3] = '-';
-    time[len + 4] = ' ';
-    time[len + 5] = '\0';
-    string timestr (time);
-    if (logManager->log (this, "MAINLOG", logLocation, timestr, false, level))
-      return 1;
-  }
-  string msg (str);
-  return logManager->log (this, "MAINLOG", logLocation, msg, true, level);
+  bool ts = (logLocation.find ("console://") == string::npos);
+
+  failure = logManager->log (this, "MAINLOG", logLocation, level, ts, true, 
fmt,
+                             argptr);
+
+  va_end (argptr);
+
+  return failure;
+}
+
+/*!
+ * Write a string to the log file and terminate the line.
+ */
+int Server::logWriteln (char const* str, LoggingLevel level)
+{
+  return logWriteln (level, "%s", str);
 }
 
 /*!
@@ -2077,7 +1965,7 @@ Server::setLogLocation (string location)
 /*!
  *Get the size for the first buffer.
  */
-u_long Server::getBuffersize()
+u_long Server::getBuffersize ()
 {
   return buffersize;
 }
@@ -2085,7 +1973,7 @@ u_long Server::getBuffersize()
 /*!
  *Get the size for the second buffer.
  */
-u_long Server::getBuffersize2()
+u_long Server::getBuffersize2 ()
 {
   return secondaryBufferSize;
 }
@@ -2093,17 +1981,17 @@ u_long Server::getBuffersize2()
 /*!
  *Set a global descriptor.
  */
-void Server::setGlobalData(const char* name, void* data)
+void Server::setGlobalData (const char* name, void* data)
 {
-  string str(name);
-  globalData.put(str, data);
+  string str (name);
+  globalData.put (str, data);
 }
 
 /*!
  *Get a global descriptor.
  */
-void* Server::getGlobalData(const char* name)
+void* Server::getGlobalData (const char* name)
 {
-  string str(name);
-  return globalData.get(str);
+  string str (name);
+  return globalData.get (str);
 }
diff --git a/myserver/stdafx.h b/myserver/stdafx.h
index 5344d6c..1c28adf 100644
--- a/myserver/stdafx.h
+++ b/myserver/stdafx.h
@@ -20,28 +20,29 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 
MA  02110-1301  USA
 #define STDAFX_H
 
 #ifndef WIN32
-#include "config.h"
+# include "config.h"
 #endif
 
 #ifdef HAVE_CONFIG_H
-#include <config.h>
+# include <config.h>
 #endif
 
 #ifdef HAVE_PTHREAD
-#include <pthread.h>
+# include <pthread.h>
 #endif
 
 #ifdef WIN32
 extern "C"
 {
-#include <winsock2.h>
-#include <tchar.h>
-#include <process.h>
+# include <winsock2.h>
+# include <tchar.h>
+# include <process.h>
 }
 #endif
 
 
-extern "C" {
+extern "C"
+{
 #include <stdlib.h>
 #include <stdio.h>
 #include <fcntl.h>
@@ -49,22 +50,22 @@ extern "C" {
 #include <time.h>
 
 #ifndef WIN32
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <limits.h>
+# include <sys/types.h>
+# include <sys/stat.h>
+# include <limits.h>
 #endif
 }
 
 #ifndef MAX_PATH
-#ifdef PATH_MAX
-#define MAX_PATH PATH_MAX
-#else
-#define MAX_PATH 255
-#endif
+# ifdef PATH_MAX
+#  define MAX_PATH PATH_MAX
+# else
+#  define MAX_PATH 255
+# endif
 #endif
 
 #ifndef HOST_NAME_MAX
-#define HOST_NAME_MAX 255
+# define HOST_NAME_MAX 255
 #endif
 
 #define USE_NEW
@@ -78,11 +79,14 @@ typedef unsigned char u_char;
 typedef void* HANDLE;
 
 #ifndef SOCKET_ERROR
-#define SOCKET_ERROR -1
+# define SOCKET_ERROR -1
 #endif
 
 #ifndef INVALID_SOCKET
-#define INVALID_SOCKET -1
+# define INVALID_SOCKET -1
 #endif
 
 #endif
+
+
+#define _(X) X



commit 90cb83ecf65cced0e6479b8c94d991bcd3a1c807
Author: Giuseppe Scrivano <address@hidden>
Date:   Wed Aug 12 21:30:28 2009 +0200

    Log can add a timestamp before the message body

diff --git a/myserver/include/log/log_manager.h 
b/myserver/include/log/log_manager.h
index 22327e0..f90f336 100644
--- a/myserver/include/log/log_manager.h
+++ b/myserver/include/log/log_manager.h
@@ -49,9 +49,10 @@ public:
            string & message, bool appendNL = false,
            LoggingLevel level = MYSERVER_LOG_MSG_INFO);
   int log (const void* owner, const string & type, const string & location,
-           LoggingLevel level, bool appendNL, const char *fmt, ...);
+           LoggingLevel level, bool ts, bool appendNL, const char *fmt, ...);
   int log (const void* owner, const string & type, const string & location,
-           LoggingLevel level, bool appendNL, const char *fmt, va_list args);
+           LoggingLevel level, bool ts, bool appendNL, const char *fmt,
+           va_list args);
 
   int close (const void *owner);
   int close (const void *owner, string type);
diff --git a/myserver/src/log/log_manager.cpp b/myserver/src/log/log_manager.cpp
index fc07471..c6ba1bf 100644
--- a/myserver/src/log/log_manager.cpp
+++ b/myserver/src/log/log_manager.cpp
@@ -18,6 +18,8 @@
 #include <include/log/log_manager.h>
 #include <include/server/server.h>
 
+#include <cstdarg>
+
 /*!
  * The constructor.
  *
@@ -556,12 +558,14 @@ LogManager::log (const void* owner, const string & type, 
const string & location
 /*!
  * Write a message on a single LogStream specifying a formatting string.
  *
- * \see LogManager#log (void*, string, string, LoggingLeve, bool, va_list)
+ * \see LogManager#log (void*, string, string, LoggingLevel, bool, bool,
+ * va_list)
  * \return 0 on success, 1 on error.
  */
 int
 LogManager::log (const void* owner, const string & type, const string & 
location,
-                 LoggingLevel level, bool appendNL, const char *fmt, ...)
+                 LoggingLevel level, bool ts, bool appendNL, const char *fmt,
+                 ...)
 {
   int failure = 0;
 
@@ -572,7 +576,7 @@ LogManager::log (const void* owner, const string & type, 
const string & location
 
   va_start (argptr, fmt);
 
-  failure = log (owner, type, location, level, appendNL, fmt, argptr);
+  failure = log (owner, type, location, level, ts, appendNL, fmt, argptr);
 
   va_end (argptr);
 
@@ -588,6 +592,7 @@ LogManager::log (const void* owner, const string & type, 
const string & location
  * \param message The message we want to write.
  * \param level The level of logging of this message. If it is less than
  * the LogManager's level of logging, the message will be discarded.
+ * \param ts Specify if a timestamp should be added before the message.
  * \param appendNL a flag that, if set, tells the LogManager to append
  * a new line sequence to the message, according to the host operating system
  * convention.
@@ -603,8 +608,8 @@ LogManager::log (const void* owner, const string & type, 
const string & location
  */
 int
 LogManager::log (const void* owner, const string & type, const string &
-                 location, LoggingLevel level, bool appendNL, const char *fmt,
-                 va_list args)
+                 location, LoggingLevel level, bool ts, bool appendNL,
+                 const char *fmt, va_list args)
 {
   int failure = 0;
 
@@ -617,6 +622,23 @@ LogManager::log (const void* owner, const string & type, 
const string &
 
   try
     {
+      if (ts)
+        {
+          char time[38];
+          int len;
+          time[0] = '[';
+          getRFC822GMTTime(&time[1], 32);
+          len = strlen(time);
+          time[len + 0] = ']';
+          time[len + 1] = ' ';
+          time[len + 2] = '-';
+          time[len + 3] = '-';
+          time[len + 4] = ' ';
+          time[len + 5] = '\0';
+          string timestr (time);
+          failure |= notify (owner, MYSERVER_LOG_EVT_LOG, &timestr);
+        }
+
       while (*fmt)
         {
           if (*fmt != '%')

-----------------------------------------------------------------------

Summary of changes:
 myserver/include/log/log_manager.h |    5 +-
 myserver/include/server/server.h   |    1 +
 myserver/src/conf/vhost/vhost.cpp  |  180 ++---
 myserver/src/log/log_manager.cpp   |   32 +-
 myserver/src/server/server.cpp     | 1558 +++++++++++++++++-------------------
 myserver/stdafx.h                  |   40 +-
 6 files changed, 842 insertions(+), 974 deletions(-)


hooks/post-receive
-- 
GNU MyServer




reply via email to

[Prev in Thread] Current Thread [Next in Thread]