add oidentd cli options to quasselcore
authorDaniel Albers <daniel@lbe.rs>
Tue, 7 Feb 2012 23:07:59 +0000 (00:07 +0100)
committerManuel Nickschas <sputnick@quassel-irc.org>
Mon, 13 Feb 2012 19:35:38 +0000 (20:35 +0100)
     --oidentd                              Enable oidentd integration
     --oidentd-conffile=[OIDENTD-CONFFILE]  change path to oidentd configuration file

src/common/main.cpp
src/core/core.cpp
src/core/corenetwork.cpp
src/core/oidentdconfiggenerator.cpp
src/core/oidentdconfiggenerator.h

index 34fb70e..d0dde88 100644 (file)
@@ -112,6 +112,8 @@ int main(int argc, char **argv) {
   cliParser->addOption("select-backend <backendidentifier>", 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 <username>", 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 <file>", 0, "change path to oidentd configuration file");
 #endif
 
 #ifdef HAVE_KDE
index 3b1a9e5..2b4b6a3 100644 (file)
@@ -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() {
index 9846a26..b43bbc2 100644 (file)
@@ -78,7 +78,9 @@ CoreNetwork::CoreNetwork(const NetworkId &networkid, CoreSession *session)
   connect(&socket, SIGNAL(sslErrors(const QList<QSslError> &)), this, SLOT(sslErrors(const QList<QSslError> &)));
 #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() {
index 2e6e0ca..62d31c2 100644 (file)
@@ -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));
index f4e819f..dbc58d1 100644 (file)
@@ -27,6 +27,7 @@
 #include <QDateTime>
 #include <QHostAddress>
 
+#include "quassel.h"
 #include "coreidentity.h"
 #include <QDebug>
 
@@ -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;
 };