summaryrefslogtreecommitdiff
path: root/src/session-initialize-bincimapd.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/session-initialize-bincimapd.cc')
-rw-r--r--src/session-initialize-bincimapd.cc60
1 files changed, 29 insertions, 31 deletions
diff --git a/src/session-initialize-bincimapd.cc b/src/session-initialize-bincimapd.cc
index 057accd..a574363 100644
--- a/src/session-initialize-bincimapd.cc
+++ b/src/session-initialize-bincimapd.cc
@@ -1,10 +1,10 @@
-/** --------------------------------------------------------------------
+/**
* @file session-initialize-bincimapd.cc
* @brief <--->
* @author Andreas Aardal Hanssen, Erwin Hoffmann
* @date 2002-2005, 2023
- * --------------------------------------------------------------------
*/
+
#include "broker.h"
#include "convert.h"
#include "depot.h"
@@ -28,12 +28,12 @@
#include <syslog.h>
#include <unistd.h>
-using namespace ::std;
using namespace Binc;
+using std::endl;
+using std::string;
extern char **environ;
-//----------------------------------------------------------------------
bool Session::initialize(int argc, char *argv[])
{
IOFactory &ioFactory = IOFactory::getInstance();
@@ -82,28 +82,26 @@ bool Session::initialize(int argc, char *argv[])
if (isdigit(f[0]))
facility = atoi(f);
- else {
- if (f == "LOG_USER")
- facility = LOG_USER;
- else if (f == "LOG_LOCAL0")
- facility = LOG_LOCAL0;
- else if (f == "LOG_LOCAL1")
- facility = LOG_LOCAL1;
- else if (f == "LOG_LOCAL2")
- facility = LOG_LOCAL2;
- else if (f == "LOG_LOCAL3")
- facility = LOG_LOCAL3;
- else if (f == "LOG_LOCAL4")
- facility = LOG_LOCAL4;
- else if (f == "LOG_LOCAL5")
- facility = LOG_LOCAL5;
- else if (f == "LOG_LOCAL6")
- facility = LOG_LOCAL6;
- else if (f == "LOG_LOCAL7")
- facility = LOG_LOCAL7;
- else
- facility = LOG_DAEMON;
- }
+ else if (f == "LOG_USER")
+ facility = LOG_USER;
+ else if (f == "LOG_LOCAL0")
+ facility = LOG_LOCAL0;
+ else if (f == "LOG_LOCAL1")
+ facility = LOG_LOCAL1;
+ else if (f == "LOG_LOCAL2")
+ facility = LOG_LOCAL2;
+ else if (f == "LOG_LOCAL3")
+ facility = LOG_LOCAL3;
+ else if (f == "LOG_LOCAL4")
+ facility = LOG_LOCAL4;
+ else if (f == "LOG_LOCAL5")
+ facility = LOG_LOCAL5;
+ else if (f == "LOG_LOCAL6")
+ facility = LOG_LOCAL6;
+ else if (f == "LOG_LOCAL7")
+ facility = LOG_LOCAL7;
+ else
+ facility = LOG_DAEMON;
session.setEnv("SYSLOG_FACILITY", toString(facility));
@@ -116,10 +114,10 @@ bool Session::initialize(int argc, char *argv[])
IOFactory::getLogger().setFlags(IODevice::FlushesOnEndl);
IOFactory::getLogger().setOutputLevelLimit(IODevice::InfoLevel);
- string pid = to_string(session.getPid());
+ string pid = std::to_string(session.getPid());
char *logindetails = getenv("BINCIMAP_LOGIN");
- if (logindetails == 0) {
+ if (logindetails == nullptr) {
bincLog << "bincimapd: pid " << pid
<< " BINCIMAP_LOGIN missing from environment (are you sure you invoked " << argv[0]
<< " properly?)\n";
@@ -133,7 +131,7 @@ bool Session::initialize(int argc, char *argv[])
string depottype = session.getEnv("DEPOT");
if (depottype == "") depottype = "Maildir++";
- if ((depot = depotfactory.get(depottype)) == 0) {
+ if ((depot = depotfactory.get(depottype)) == nullptr) {
bincLog << "bincimapd: pid " << pid << " Found no Depot for: " << depottype
<< ". Please check your configurations file under the Mailbox section\n";
bincLog.flush();
@@ -177,9 +175,9 @@ bool Session::initialize(int argc, char *argv[])
// automatically create depot directory if it's not there already
string path;
if (session.args.getUnqualifiedArgs().size() > 0) path = session.args.getUnqualifiedArgs()[0];
- if (path == "")
+ if (path == "") {
path = ".";
- else if (chdir(path.c_str()) != 0) {
+ } else if (chdir(path.c_str()) != 0) {
mkdir(path.c_str(), 0777);
if (chdir(path.c_str()) != 0) {
bincLog << "bincimapd: pid" << pid << " Error entering depot " + toImapString(path) + ": "