coreircuser.cpp
corenetwork.cpp
corenetworkconfig.cpp
+ oidentdconfiggenerator.cpp
coresession.cpp
coresessioneventprocessor.cpp
coresettings.cpp
coreircuser.h
corenetwork.h
corenetworkconfig.h
+ oidentdconfiggenerator.h
coresession.h
coresessioneventprocessor.h
coreuserinputhandler.h
}
void Core::init() {
+ _oidentdConfigGenerator = new OidentdConfigGenerator();
+
CoreSettings cs;
_configured = initStorage(cs.storageSettings().toMap());
return;
}
*/
+
QVariantList activeSessions = s.coreState().toMap()["ActiveSessions"].toList();
if(activeSessions.count() > 0) {
quInfo() << "Restoring previous core state...";
# include <QTcpSocket>
# include <QTcpServer>
#endif
+#include "oidentdconfiggenerator.h"
#include "storage.h"
#include "bufferinfo.h"
static inline QTimer &syncTimer() { return instance()->_storageSyncTimer; }
+ inline OidentdConfigGenerator *oidentdConfigGenerator() { return _oidentdConfigGenerator; }
+
static const int AddClientEventId;
public slots:
QTcpServer _server, _v6server;
#endif
+ OidentdConfigGenerator *_oidentdConfigGenerator;
+
QHash<QTcpSocket *, quint32> blocksizes;
QHash<QTcpSocket *, QVariantMap> clientInfo;
#include "core.h"
#include "logger.h"
+#include <QDebug>
CoreApplicationInternal::CoreApplicationInternal()
: _coreCreated(false)
connect(&_autoWhoCycleTimer, SIGNAL(timeout()), this, SLOT(startAutoWhoCycle()));
connect(&_tokenBucketTimer, SIGNAL(timeout()), this, SLOT(fillBucketAndProcessQueue()));
+ connect(&socket, SIGNAL(connected()), Core::instance()->oidentdConfigGenerator(), SLOT(update()));
connect(&socket, SIGNAL(connected()), this, SLOT(socketInitialized()));
connect(&socket, SIGNAL(disconnected()), this, SLOT(socketDisconnected()));
connect(&socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(socketError(QAbstractSocket::SocketError)));
#include "coreircuser.h"
#include <QTimer>
+#include <QDebug>
#ifdef HAVE_SSL
# include <QSslSocket>
#else
# include <QTcpSocket>
#endif
+#include <QAbstractSocket>
#ifdef HAVE_QCA2
# include "cipher.h"
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2012 by the Quassel Project *
+ * devel@quassel-irc.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) version 3. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#include "oidentdconfiggenerator.h"
+
+OidentdConfigGenerator::OidentdConfigGenerator(QObject *parent) :
+ QObject(parent),
+ _initialized(false)
+{
+ qDebug() << "OidentdConfigGenerator() checking for being initialized";
+ if (!_initialized)
+ init();
+}
+
+bool OidentdConfigGenerator::init() {
+ configDir = QDir::homePath();
+ configFileName = ".oidentd.conf";
+ configTag = " stanza created by Quassel";
+
+ _configFile = new QFile(configDir.absoluteFilePath(configFileName));
+ qDebug() << "1: _configFile" << _configFile->fileName();
+
+ quasselStanza = QRegExp(QString("^lport .* { .* } #%1$").arg(configTag));
+
+ if (update())
+ _initialized = true;
+
+ qDebug() << "konichi wa °-°";
+
+ return _initialized;
+}
+
+bool OidentdConfigGenerator::update() {
+ if (parseConfig())
+ qDebug() << "oidentd config parsed successfully";
+ else
+ qDebug() << QString("parsing oidentd config failed (%1 [%2])").arg(_configFile->errorString()).arg(_configFile->error());
+
+ return writeConfig();
+}
+
+bool OidentdConfigGenerator::parseConfig() {
+ qDebug() << "_configFile name" << _configFile->fileName();
+ qDebug() << "open?" << _configFile->isOpen();
+ if (!_configFile->isOpen() && !_configFile->open(QIODevice::ReadWrite))
+ return false;
+
+ QByteArray parsedConfig;
+ while (!_configFile->atEnd()) {
+ QByteArray line = _configFile->readLine();
+
+ if (checkLine(line))
+ parsedConfig.append(line);
+ }
+
+ _config = parsedConfig;
+
+ return true;
+}
+
+bool OidentdConfigGenerator::writeConfig() {
+ return true;
+}
+
+bool OidentdConfigGenerator::checkLine(const QByteArray &line) {
+ return !quasselStanza.exactMatch(line);
+}
--- /dev/null
+/***************************************************************************
+ * Copyright (C) 2012 by the Quassel Project *
+ * devel@quassel-irc.org *
+ * *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) version 3. *
+ * *
+ * This program is distributed in the hope that it will be useful, *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
+ * GNU General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU General Public License *
+ * along with this program; if not, write to the *
+ * Free Software Foundation, Inc., *
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
+ ***************************************************************************/
+
+#ifndef OIDENTDCONFIGGENERATOR_H
+#define OIDENTDCONFIGGENERATOR_H
+
+#include <QObject>
+#include <QDir>
+#include <QFile>
+#include <QDateTime>
+
+#include <QDebug>
+
+class OidentdConfigGenerator : public QObject
+{
+ Q_OBJECT
+public:
+ explicit OidentdConfigGenerator(QObject *parent = 0);
+
+ QDir configDir;
+ QString configFileName;
+
+signals:
+
+public slots:
+ bool update();
+
+private:
+ bool init();
+ bool writeConfig();
+ bool parseConfig();
+ bool checkLine(const QByteArray &line);
+
+ bool _initialized;
+ QDateTime _lastSync;
+ QFile *_configFile;
+ QByteArray _config;
+
+ QString configTag;
+
+ QRegExp quasselStanza;
+};
+
+#endif // OIDENTDCONFIGGENERATOR_H