From f9a73e3ad8142212028a39b26ced62456e575b7a Mon Sep 17 00:00:00 2001 From: Daniel Albers Date: Wed, 8 Feb 2012 00:07:59 +0100 Subject: [PATCH] add oidentd cli options to quasselcore --oidentd Enable oidentd integration --oidentd-conffile=[OIDENTD-CONFFILE] change path to oidentd configuration file --- src/common/main.cpp | 2 ++ src/core/core.cpp | 3 ++- src/core/corenetwork.cpp | 4 +++- src/core/oidentdconfiggenerator.cpp | 8 +++++++- src/core/oidentdconfiggenerator.h | 8 ++++---- 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/src/common/main.cpp b/src/common/main.cpp index 34fb70eb..d0dde88a 100644 --- a/src/common/main.cpp +++ b/src/common/main.cpp @@ -112,6 +112,8 @@ int main(int argc, char **argv) { cliParser->addOption("select-backend ", 0, "Switch storage backend (migrating data if possible)"); cliParser->addSwitch("add-user", 0, "Starts an interactive session to add a new core user"); cliParser->addOption("change-userpass ", 0, "Starts an interactive session to change the password of the user identified by username"); + cliParser->addSwitch("oidentd", 0, "Enable oidentd integration"); + cliParser->addOption("oidentd-conffile ", 0, "change path to oidentd configuration file"); #endif #ifdef HAVE_KDE diff --git a/src/core/core.cpp b/src/core/core.cpp index 3b1a9e53..2b4b6a3e 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -202,7 +202,8 @@ void Core::init() { connect(&_v6server, SIGNAL(newConnection()), this, SLOT(incomingConnection())); if(!startListening()) exit(1); // TODO make this less brutal - _oidentdConfigGenerator = new OidentdConfigGenerator(this); + if(Quassel::isOptionSet("oidentd")) + _oidentdConfigGenerator = new OidentdConfigGenerator(this); } Core::~Core() { diff --git a/src/core/corenetwork.cpp b/src/core/corenetwork.cpp index 9846a268..b43bbc29 100644 --- a/src/core/corenetwork.cpp +++ b/src/core/corenetwork.cpp @@ -78,7 +78,9 @@ CoreNetwork::CoreNetwork(const NetworkId &networkid, CoreSession *session) connect(&socket, SIGNAL(sslErrors(const QList &)), this, SLOT(sslErrors(const QList &))); #endif connect(this, SIGNAL(newEvent(Event *)), coreSession()->eventManager(), SLOT(postEvent(Event *))); - connect(this, SIGNAL(newSocket(const CoreIdentity*,QHostAddress,quint16,QHostAddress,quint16)), Core::instance()->oidentdConfigGenerator(), SLOT(addSocket(const CoreIdentity*,QHostAddress,quint16,QHostAddress,quint16))); + + if(Quassel::isOptionSet("oidentd")) + connect(this, SIGNAL(newSocket(const CoreIdentity*,QHostAddress,quint16,QHostAddress,quint16)), Core::instance()->oidentdConfigGenerator(), SLOT(addSocket(const CoreIdentity*,QHostAddress,quint16,QHostAddress,quint16))); } CoreNetwork::~CoreNetwork() { diff --git a/src/core/oidentdconfiggenerator.cpp b/src/core/oidentdconfiggenerator.cpp index 2e6e0ca2..62d31c25 100644 --- a/src/core/oidentdconfiggenerator.cpp +++ b/src/core/oidentdconfiggenerator.cpp @@ -32,9 +32,15 @@ OidentdConfigGenerator::OidentdConfigGenerator(QObject *parent) : bool OidentdConfigGenerator::init() { configDir = QDir::homePath(); configFileName = ".oidentd.conf"; + + if(Quassel::isOptionSet("oidentd-conffile")) + configPath = Quassel::optionValue("oidentd-conffile"); + else + configPath = configDir.absoluteFilePath(configFileName); + configTag = " stanza created by Quassel"; - _configFile = new QFile(configDir.absoluteFilePath(configFileName)); + _configFile = new QFile(configPath); qDebug() << "1: _configFile" << _configFile->fileName(); quasselStanza = QRegExp(QString("^lport .* { .* } #%1$").arg(configTag)); diff --git a/src/core/oidentdconfiggenerator.h b/src/core/oidentdconfiggenerator.h index f4e819f9..dbc58d1a 100644 --- a/src/core/oidentdconfiggenerator.h +++ b/src/core/oidentdconfiggenerator.h @@ -27,6 +27,7 @@ #include #include +#include "quassel.h" #include "coreidentity.h" #include @@ -36,9 +37,6 @@ class OidentdConfigGenerator : public QObject public: explicit OidentdConfigGenerator(QObject *parent = 0); - QDir configDir; - QString configFileName; - signals: public slots: @@ -55,8 +53,10 @@ private: QFile *_configFile; QByteArray _config; + QDir configDir; + QString configFileName; + QString configPath; QString configTag; - QRegExp quasselStanza; }; -- 2.20.1