diff options
Diffstat (limited to 'src/session-initialize-bincimap-up.cc')
-rw-r--r-- | src/session-initialize-bincimap-up.cc | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/session-initialize-bincimap-up.cc b/src/session-initialize-bincimap-up.cc index ee9f8db..88dc788 100644 --- a/src/session-initialize-bincimap-up.cc +++ b/src/session-initialize-bincimap-up.cc @@ -17,7 +17,6 @@ #include "syslogdevice.h" #include "tools.h" -#include <cctype> #include <charconv> #include <map> #include <string> @@ -32,10 +31,10 @@ bool Session::initialize(int argc, char *argv[]) { IOFactory &ioFactory = IOFactory::getInstance(); - IODevice *stdioDevice = new StdIODevice(IODevice::IsEnabled); + auto stdioDevice = new StdIODevice(IODevice::IsEnabled); stdioDevice->setFlags(IODevice::HasOutputLimit); stdioDevice->setMaxOutputBufferSize(TRANSFER_BUFFER_SIZE); - ioFactory.addDevice(stdioDevice); + ioFactory.addDevice(std::unique_ptr<IODevice>(stdioDevice)); Session &session = Session::getInstance(); @@ -68,8 +67,8 @@ bool Session::initialize(int argc, char *argv[]) lowercase(logtype); trim(logtype); if (logtype == "" || logtype == "multilog") { - MultilogDevice *device = new MultilogDevice(IODevice::IsEnabled | IODevice::FlushesOnEndl); - ioFactory.addDevice(device); + auto device = new MultilogDevice(IODevice::IsEnabled | IODevice::FlushesOnEndl); + ioFactory.addDevice(std::unique_ptr<IODevice>(device)); } else if (logtype == "syslog") { const string f = session.getEnv("SYSLOG_FACILITY"); int facility = 0; @@ -98,11 +97,11 @@ bool Session::initialize(int argc, char *argv[]) facility = LOG_DAEMON; } - SyslogDevice *device = new SyslogDevice(IODevice::IsEnabled | IODevice::FlushesOnEndl, - "bincimap-up", - LOG_NDELAY | LOG_PID, - facility); - ioFactory.addDevice(device); + auto device = new SyslogDevice(IODevice::IsEnabled | IODevice::FlushesOnEndl, + "bincimap-up", + LOG_NDELAY | LOG_PID, + facility); + ioFactory.addDevice(std::unique_ptr<IODevice>(device)); } // Now that we know the log type, we can flush. @@ -125,13 +124,14 @@ bool Session::initialize(int argc, char *argv[]) BrokerFactory &brokerfactory = BrokerFactory::getInstance(); - brokerfactory.assign("AUTHENTICATE", new AuthenticateOperator()); - brokerfactory.assign("CAPABILITY", new CapabilityOperator()); - brokerfactory.assign("LOGIN", new LoginOperator()); - brokerfactory.assign("LOGOUT", new LogoutOperator()); - brokerfactory.assign("NOOP", new NoopOperator()); - brokerfactory.assign("ID", new IdOperator()); - if (stls > 0) brokerfactory.assign("STARTTLS", new StarttlsOperator()); + brokerfactory.assign("AUTHENTICATE", std::shared_ptr<Operator>(new AuthenticateOperator())); + brokerfactory.assign("CAPABILITY", std::shared_ptr<Operator>(new CapabilityOperator())); + brokerfactory.assign("LOGIN", std::shared_ptr<Operator>(new LoginOperator())); + brokerfactory.assign("LOGOUT", std::shared_ptr<Operator>(new LogoutOperator())); + brokerfactory.assign("NOOP", std::shared_ptr<Operator>(new NoopOperator())); + brokerfactory.assign("ID", std::shared_ptr<Operator>(new IdOperator())); + if (stls > 0) + brokerfactory.assign("STARTTLS", std::shared_ptr<Operator>(new StarttlsOperator())); bincClient.setTimeout(AUTH_TIMEOUT); |