return ret;
}
-// not yet implemented
+//! not yet implemented
bool OidentdConfigGenerator::removeSocket(const CoreIdentity *identity, const QHostAddress &localAddress, quint16 localPort, const QHostAddress &peerAddress, quint16 peerPort) {
Q_UNUSED(identity) Q_UNUSED(localAddress) Q_UNUSED(localPort) Q_UNUSED(peerAddress) Q_UNUSED(peerPort)
return true;
}
bool OidentdConfigGenerator::parseConfig(bool readQuasselStanzas) {
- if (!_configFile->isOpen() && !_configFile->open(QIODevice::ReadWrite))
+ if (!_configFile->exists())
+ return true;
+
+ if (!_configFile->isOpen() && !_configFile->open(QIODevice::ReadOnly))
return false;
_mutex.lock();
}
bool OidentdConfigGenerator::writeConfig() {
- if (!_configFile->isOpen() && !_configFile->open(QIODevice::ReadWrite | QIODevice::Text))
+ mode_t prev_umask = umask(S_IXUSR | S_IWGRP | S_IXGRP | S_IWOTH | S_IXOTH); // == 0133, rw-r--r--
+ bool not_open = (!_configFile->isOpen() && !_configFile->open(QIODevice::ReadWrite | QIODevice::Text));
+ umask(prev_umask);
+
+ if (not_open)
return false;
+
_mutex.lock();
_configFile->seek(0);
#include <QHostAddress>
#include <QMutex>
+#ifndef Q_OS_WIN32
+# include <sys/types.h>
+# include <sys/stat.h>
+#endif /* Q_OS_WIN32 */
+
#include "quassel.h"
#include "coreidentity.h"
+//! Produces oidentd configuration files
+/*!
+ Upon IRC connect this class puts the clients' ident data into an oidentd configuration file.
+
+ The default path is <~/.oidentd.conf>.
+
+ For oidentd to incorporate this file, the global oidentd.conf has to state something like this:
+
+ user "quassel" {
+ default {
+ allow spoof
+ allow spoof_all
+ }
+ }
+
+*/
+
class OidentdConfigGenerator : public QObject
{
Q_OBJECT
explicit OidentdConfigGenerator(QObject *parent = 0);
~OidentdConfigGenerator();
-signals:
-
public slots:
bool addSocket(const CoreIdentity *identity, const QHostAddress &localAddress, quint16 localPort, const QHostAddress &peerAddress, quint16 peerPort);
bool removeSocket(const CoreIdentity *identity, const QHostAddress &localAddress, quint16 localPort, const QHostAddress &peerAddress, quint16 peerPort);