From d50b767dadfdf3a9657c031fcda6b17cf393ca22 Mon Sep 17 00:00:00 2001 From: Carlos Daniel Ruvalcaba Valenzuela Date: Thu, 20 Sep 2007 23:53:41 -0700 Subject: [PATCH] Added new configuration variables for SMTP and Queue servers --- backends/protocol/smtp.cpp | 15 +++++++++++---- backends/queue/queueman.cpp | 10 +++++++--- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/backends/protocol/smtp.cpp b/backends/protocol/smtp.cpp index 5dac13c..277b25f 100644 --- a/backends/protocol/smtp.cpp +++ b/backends/protocol/smtp.cpp @@ -55,8 +55,12 @@ int knhash(char v){ class SMTPHandler : public ProtocolHandler{ SearchTree cmdtree; + std::string queue_ipc; public: - SMTPHandler(){ + SMTPHandler(std::string qipc){ + /* Queue IPC string */ + queue_ipc = qipc; + /* Insert the SMTP commands to search tree */ cmdtree.Insert("EHLO", 1); cmdtree.Insert("HELO", 2); @@ -85,7 +89,7 @@ public: s->Write( CRLF, 2); /* Connect to the Queue server */ - ipc = IPC::CreateIPC("socket://127.0.0.1:14003"); + ipc = IPC::CreateIPC((char*)queue_ipc.c_str()); ipc->RequestIPC(); while (onrun){ @@ -266,7 +270,7 @@ int main(){ SMTPHandler *handler; Socket *s, *cl; int ret, port, tcount; - std::string conf_handler; + std::string conf_handler, qipc; Configuration conf("smtp.conf"); /* Get basic configuration options */ @@ -285,8 +289,11 @@ int main(){ s->Listen(15); + /* Load queue connection string */ + qipc = conf.getString("queue", "socket://127.0.0.1:14003"); + /* Create a handler object */ - handler = new SMTPHandler(); + handler = new SMTPHandler(qipc); /* Create a LoadHandler Object based on configuration */ if (conf_handler == "thread"){ diff --git a/backends/queue/queueman.cpp b/backends/queue/queueman.cpp index 6b010b3..2411cda 100644 --- a/backends/queue/queueman.cpp +++ b/backends/queue/queueman.cpp @@ -52,7 +52,7 @@ class QueueHandler : public ProtocolHandler{ queue msg_queue; /* Message Queue */ char path[100]; public: - QueueHandler(char *qpath, char *name){ + QueueHandler(const char *qpath, const char *name){ /* Initialize Queue Path */ sprintf(path, "%s/%s/", qpath, name); @@ -164,7 +164,7 @@ int main(){ QueueHandler *handler; Socket *s, *cl; int ret, port, tcount; - std::string conf_handler; + std::string conf_handler, qname, qpath; Configuration conf("queue.conf"); /* Load configuration */ @@ -184,8 +184,12 @@ int main(){ s->Listen(15); + /* Read Queue configuration */ + qname = conf.getString("queue.name", "incoming"); + qpath = conf.getString("queue.path", "/tmp/fmail/queue"); + /* Create our Queue handler and Threaded LoadHandler */ - handler = new QueueHandler("/tmp/fmail/queue", "incoming"); + handler = new QueueHandler(qpath.c_str(), qname.c_str()); if (conf_handler == "thread"){ tcount = conf.getInt("thread.count", 10); -- 2.11.4.GIT