diff options
Diffstat (limited to 'src/session-initialize-bincimapd.cc')
-rw-r--r-- | src/session-initialize-bincimapd.cc | 61 |
1 files changed, 31 insertions, 30 deletions
diff --git a/src/session-initialize-bincimapd.cc b/src/session-initialize-bincimapd.cc index 60543b5..27ad2d5 100644 --- a/src/session-initialize-bincimapd.cc +++ b/src/session-initialize-bincimapd.cc @@ -22,6 +22,7 @@ #include <charconv> #include <map> +#include <memory> #include <string> using namespace Binc; @@ -32,11 +33,11 @@ bool Session::initialize(int argc, char *argv[]) { IOFactory &ioFactory = IOFactory::getInstance(); - IODevice *stdioDevice = new StdIODevice(IODevice::IsEnabled | IODevice::HasInputLimit - | IODevice::HasTimeout); + auto stdioDevice = new StdIODevice(IODevice::IsEnabled | IODevice::HasInputLimit + | IODevice::HasTimeout); stdioDevice->setFlags(IODevice::HasOutputLimit); stdioDevice->setMaxOutputBufferSize(TRANSFER_BUFFER_SIZE); - ioFactory.addDevice(stdioDevice); + ioFactory.addDevice(std::unique_ptr<IODevice>(stdioDevice)); Session &session = Session::getInstance(); @@ -67,7 +68,7 @@ bool Session::initialize(int argc, char *argv[]) lowercase(logtype); trim(logtype); if (logtype == "" || logtype == "multilog") { - ioFactory.addDevice(new MultilogDevice(IODevice::IsEnabled)); + ioFactory.addDevice(std::unique_ptr<IODevice>(new MultilogDevice(IODevice::IsEnabled))); } else if (logtype == "syslog") { const string f = session.getEnv("SYSLOG_FACILITY"); @@ -99,8 +100,8 @@ bool Session::initialize(int argc, char *argv[]) session.setEnv("SYSLOG_FACILITY", std::to_string(facility)); - ioFactory.addDevice( - new SyslogDevice(IODevice::IsEnabled, "bincimapd", LOG_NDELAY | LOG_PID, facility)); + ioFactory.addDevice(std::unique_ptr<IODevice>( + new SyslogDevice(IODevice::IsEnabled, "bincimapd", LOG_NDELAY | LOG_PID, facility))); } // Now that we know the log type, we can flush. @@ -141,30 +142,30 @@ bool Session::initialize(int argc, char *argv[]) BrokerFactory &brokerfactory = BrokerFactory::getInstance(); - brokerfactory.assign("APPEND", new AppendOperator()); - brokerfactory.assign("CAPABILITY", new CapabilityOperator()); - brokerfactory.assign("CHECK", new CheckOperator()); - brokerfactory.assign("CLOSE", new CloseOperator()); - brokerfactory.assign("COPY", new CopyOperator()); - brokerfactory.assign("CREATE", new CreateOperator()); - brokerfactory.assign("DELETE", new DeleteOperator()); - brokerfactory.assign("EXAMINE", new ExamineOperator()); - brokerfactory.assign("EXPUNGE", new ExpungeOperator()); - brokerfactory.assign("FETCH", new FetchOperator()); - brokerfactory.assign("IDLE", new IdleOperator()); - brokerfactory.assign("ID", new IdOperator()); - brokerfactory.assign("LIST", new ListOperator()); - brokerfactory.assign("LOGOUT", new LogoutOperator()); - brokerfactory.assign("LSUB", new LsubOperator()); - brokerfactory.assign("NAMESPACE", new NamespaceOperator()); - brokerfactory.assign("NOOP", new NoopPendingOperator()); - brokerfactory.assign("RENAME", new RenameOperator()); - brokerfactory.assign("SEARCH", new SearchOperator()); - brokerfactory.assign("SELECT", new SelectOperator()); - brokerfactory.assign("STATUS", new StatusOperator()); - brokerfactory.assign("STORE", new StoreOperator()); - brokerfactory.assign("SUBSCRIBE", new SubscribeOperator()); - brokerfactory.assign("UNSUBSCRIBE", new UnsubscribeOperator()); + brokerfactory.assign("APPEND", std::shared_ptr<Operator>(new AppendOperator())); + brokerfactory.assign("CAPABILITY", std::shared_ptr<Operator>(new CapabilityOperator())); + brokerfactory.assign("CHECK", std::shared_ptr<Operator>(new CheckOperator())); + brokerfactory.assign("CLOSE", std::shared_ptr<Operator>(new CloseOperator())); + brokerfactory.assign("COPY", std::shared_ptr<Operator>(new CopyOperator())); + brokerfactory.assign("CREATE", std::shared_ptr<Operator>(new CreateOperator())); + brokerfactory.assign("DELETE", std::shared_ptr<Operator>(new DeleteOperator())); + brokerfactory.assign("EXAMINE", std::shared_ptr<Operator>(new ExamineOperator())); + brokerfactory.assign("EXPUNGE", std::shared_ptr<Operator>(new ExpungeOperator())); + brokerfactory.assign("FETCH", std::shared_ptr<Operator>(new FetchOperator())); + brokerfactory.assign("IDLE", std::shared_ptr<Operator>(new IdleOperator())); + brokerfactory.assign("ID", std::shared_ptr<Operator>(new IdOperator())); + brokerfactory.assign("LIST", std::shared_ptr<Operator>(new ListOperator())); + brokerfactory.assign("LOGOUT", std::shared_ptr<Operator>(new LogoutOperator())); + brokerfactory.assign("LSUB", std::shared_ptr<Operator>(new LsubOperator())); + brokerfactory.assign("NAMESPACE", std::shared_ptr<Operator>(new NamespaceOperator())); + brokerfactory.assign("NOOP", std::shared_ptr<Operator>(new NoopPendingOperator())); + brokerfactory.assign("RENAME", std::shared_ptr<Operator>(new RenameOperator())); + brokerfactory.assign("SEARCH", std::shared_ptr<Operator>(new SearchOperator())); + brokerfactory.assign("SELECT", std::shared_ptr<Operator>(new SelectOperator())); + brokerfactory.assign("STATUS", std::shared_ptr<Operator>(new StatusOperator())); + brokerfactory.assign("STORE", std::shared_ptr<Operator>(new StoreOperator())); + brokerfactory.assign("SUBSCRIBE", std::shared_ptr<Operator>(new SubscribeOperator())); + brokerfactory.assign("UNSUBSCRIBE", std::shared_ptr<Operator>(new UnsubscribeOperator())); // automatically create depot directory if it's not there already string path; |