diff options
Diffstat (limited to 'src/session-initialize-bincimap-up.cc')
-rw-r--r-- | src/session-initialize-bincimap-up.cc | 73 |
1 files changed, 41 insertions, 32 deletions
diff --git a/src/session-initialize-bincimap-up.cc b/src/session-initialize-bincimap-up.cc index e6a817f..12c099c 100644 --- a/src/session-initialize-bincimap-up.cc +++ b/src/session-initialize-bincimap-up.cc @@ -1,26 +1,27 @@ /** -------------------------------------------------------------------- * @file session-initialize-bincimap-up.cc - * @brief bincimap-up requires sslserver + * @brief bincimap-up requires sslserver * @author Andreas Aardal Hanssen, Erwin Hoffmann - * @date 2002-2005, 2023 + * @date 2002-2005, 2023 * ----------------------------------------------------------------- **/ -#include <syslog.h> -#include <ctype.h> - #include "broker.h" #include "convert.h" #include "globals.h" #include "iodevice.h" #include "iofactory.h" #include "multilogdevice.h" -#include "syslogdevice.h" -#include "stdiodevice.h" #include "session.h" +#include "stdiodevice.h" +#include "syslogdevice.h" #include "tools.h" -#include <fcntl.h> -#include <string> #include <map> +#include <string> + +#include <ctype.h> + +#include <fcntl.h> +#include <syslog.h> using namespace ::std; using namespace Binc; @@ -42,8 +43,7 @@ bool Session::initialize(int argc, char *argv[]) IOFactory::getLogger().clearFlags(IODevice::FlushesOnEndl); // Read command line arguments - if (!session.parseCommandLine(argc, argv)) - return false; + if (!session.parseCommandLine(argc, argv)) return false; // Show help if asked for it if (session.command.help) { @@ -53,7 +53,7 @@ bool Session::initialize(int argc, char *argv[]) // Show version if asked for it if (session.command.version) { - printf("Binc IMAP v" BINC_VERSION"\n"); + printf("Binc IMAP v" BINC_VERSION "\n"); return false; } @@ -61,16 +61,16 @@ bool Session::initialize(int argc, char *argv[]) session.assignCommandLineArgs(); // for log input - string ip = getenv("TCP6REMOTEIP") ? getenv("TCP6REMOTEIP") : - getenv("TCPREMOTEIP") ? getenv("TCPREMOTEIP") : "?"; + string ip = getenv("TCP6REMOTEIP") ? getenv("TCP6REMOTEIP") + : getenv("TCPREMOTEIP") ? getenv("TCPREMOTEIP") + : "?"; session.setIP(ip); string logtype = session.getEnv("LOG_TYPE"); lowercase(logtype); trim(logtype); if (logtype == "" || logtype == "multilog") { - MultilogDevice *device = new MultilogDevice(IODevice::IsEnabled - | IODevice::FlushesOnEndl); + MultilogDevice *device = new MultilogDevice(IODevice::IsEnabled | IODevice::FlushesOnEndl); ioFactory.addDevice(device); } else if (logtype == "syslog") { const string f = session.getEnv("SYSLOG_FACILITY"); @@ -79,20 +79,29 @@ 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; + 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; } - SyslogDevice *device = new SyslogDevice(IODevice::IsEnabled - | IODevice::FlushesOnEndl, + SyslogDevice *device = new SyslogDevice(IODevice::IsEnabled | IODevice::FlushesOnEndl, "bincimap-up", LOG_NDELAY | LOG_PID, facility); @@ -112,10 +121,10 @@ bool Session::initialize(int argc, char *argv[]) stls = -1; // else we will do starttls - requires new FDs } else if (getenv("UCSPITLS")) { - string ucspitls = session.getEnv("UCSPITLS"); - if (ucspitls == "+") stls = 1; - if (ucspitls == "-") stls = 0; - if (ucspitls == "!") stls = 2; + string ucspitls = session.getEnv("UCSPITLS"); + if (ucspitls == "+") stls = 1; + if (ucspitls == "-") stls = 0; + if (ucspitls == "!") stls = 2; } BrokerFactory &brokerfactory = BrokerFactory::getInstance(); |