#include "coreircuser.h"
#include <QTimer>
-#include <QDebug>
#ifdef HAVE_SSL
# include <QSslSocket>
inline UserId userId() const { return _coreSession->user(); }
- inline QAbstractSocket::SocketState socketState() { return socket.state(); }
- inline bool socketConnected() { return socket.state() == QAbstractSocket::ConnectedState; }
- inline QHostAddress localAddress() { return socket.localAddress(); }
- inline QHostAddress peerAddress() { return socket.peerAddress(); }
- inline quint16 localPort() { return socket.localPort(); }
- inline quint16 peerPort() { return socket.peerPort(); }
+ inline QAbstractSocket::SocketState socketState() const { return socket.state(); }
+ inline bool socketConnected() const { return socket.state() == QAbstractSocket::ConnectedState; }
+ inline QHostAddress localAddress() const { return socket.localAddress(); }
+ inline QHostAddress peerAddress() const { return socket.peerAddress(); }
+ inline quint16 localPort() const { return socket.localPort(); }
+ inline quint16 peerPort() const { return socket.peerPort(); }
public slots:
virtual void setMyNick(const QString &mynick);
OidentdConfigGenerator::~OidentdConfigGenerator() {
_quasselConfig.clear();
writeConfig();
+ _configFile->deleteLater();
}
bool OidentdConfigGenerator::init() {
- configDir = QDir::homePath();
- configFileName = ".oidentd.conf";
+ _configDir = QDir::homePath();
+ _configFileName = ".oidentd.conf";
if(Quassel::isOptionSet("oidentd-conffile"))
- configPath = Quassel::optionValue("oidentd-conffile");
+ _configPath = Quassel::optionValue("oidentd-conffile");
else
- configPath = configDir.absoluteFilePath(configFileName);
+ _configPath = _configDir.absoluteFilePath(_configFileName);
- configTag = " stanza created by Quassel";
+ _configTag = " stanza created by Quassel";
- _configFile = new QFile(configPath);
+ _configFile = new QFile(_configPath);
// Rx has to match Template in order for cleanup to work.
// Template should be enhanced with the "from" parameter as soon as Quassel gains
// the ability to bind to an IP on client sockets.
- quasselStanzaTemplate = QString("lport %1 { reply \"%2\" } #%3\n");
- quasselStanzaRx = QRegExp(QString("^lport .* \\{ .* \\} #%1\\r?\\n").arg(configTag));
+ _quasselStanzaTemplate = QString("lport %1 { reply \"%2\" } #%3\n");
+ _quasselStanzaRx = QRegExp(QString("^lport .* \\{ .* \\} #%1\\r?\\n").arg(_configTag));
// initially remove all Quassel stanzas that might be present
if (parseConfig(false) && writeConfig())
Q_UNUSED(localAddress) Q_UNUSED(peerAddress) Q_UNUSED(peerPort)
QString ident = identity->ident();
- _quasselConfig.append(quasselStanzaTemplate.arg(localPort).arg(ident).arg(configTag));
+ _quasselConfig.append(_quasselStanzaTemplate.arg(localPort).arg(ident).arg(_configTag).toAscii());
bool ret = writeConfig();
}
bool OidentdConfigGenerator::lineByUs(const QByteArray &line) {
- return quasselStanzaRx.exactMatch(line);
+ return _quasselStanzaRx.exactMatch(line);
}
class OidentdConfigGenerator : public QObject
{
- Q_OBJECT
+ Q_OBJECT
public:
explicit OidentdConfigGenerator(QObject *parent = 0);
~OidentdConfigGenerator();
// Mutex isn't strictly necessary at the moment, since with the current invocation in Core only one instance at a time exists
QMutex _mutex;
- QDir configDir;
- QString configFileName;
- QString configPath;
- QString configTag;
- QRegExp quasselStanzaRx;
- QString quasselStanzaTemplate;
+ QDir _configDir;
+ QString _configFileName;
+ QString _configPath;
+ QString _configTag;
+ QRegExp _quasselStanzaRx;
+ QString _quasselStanzaTemplate;
};
#endif // OIDENTDCONFIGGENERATOR_H