summaryrefslogtreecommitdiffstats
path: root/krfb/kinetd/kinetd.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'krfb/kinetd/kinetd.cpp')
-rw-r--r--krfb/kinetd/kinetd.cpp130
1 files changed, 65 insertions, 65 deletions
diff --git a/krfb/kinetd/kinetd.cpp b/krfb/kinetd/kinetd.cpp
index 5094712e..2f4acadd 100644
--- a/krfb/kinetd/kinetd.cpp
+++ b/krfb/kinetd/kinetd.cpp
@@ -21,7 +21,7 @@
#include "kinetinterface.h"
#include "kuser.h"
#include "uuid.h"
-#include <qregexp.h>
+#include <tqregexp.h>
#include <kservicetype.h>
#include <kdebug.h>
#include <kstandarddirs.h>
@@ -77,8 +77,8 @@ bool PortListener::acquirePort() {
delete m_socket;
m_socket = new KServerSocket(m_port, false);
}
- connect(m_socket, SIGNAL(accepted(KSocket*)),
- SLOT(accepted(KSocket*)));
+ connect(m_socket, TQT_SIGNAL(accepted(KSocket*)),
+ TQT_SLOT(accepted(KSocket*)));
bool s = m_registerService;
bool sd =m_dnssdRegister;
@@ -102,10 +102,10 @@ void PortListener::loadConfig(KService::Ptr s) {
m_valid = true;
m_autoPortRange = 0;
m_enabled = true;
- m_argument = QString::null;
+ m_argument = TQString::null;
m_multiInstance = false;
- QVariant vid, vport, vautoport, venabled, vargument, vmultiInstance, vurl,
+ TQVariant vid, vport, vautoport, venabled, vargument, vmultiInstance, vurl,
vsattributes, vslifetime, vdname, vdtype, vddata;
m_execPath = s->exec().utf8();
@@ -154,7 +154,7 @@ void PortListener::loadConfig(KService::Ptr s) {
m_registerService = true;
}
else {
- m_serviceURL = QString::null;
+ m_serviceURL = TQString::null;
m_registerService = false;
}
if (vsattributes.isValid()) {
@@ -163,11 +163,11 @@ void PortListener::loadConfig(KService::Ptr s) {
else
m_serviceAttributes = "";
if (vddata.isValid()) {
- QStringList attrs = vddata.toStringList();
- for (QStringList::iterator it=attrs.begin();
+ TQStringList attrs = vddata.toStringList();
+ for (TQStringList::iterator it=attrs.begin();
it!=attrs.end();it++) {
- QString key = (*it).section('=',0,0);
- QString value = processServiceTemplate((*it).section('=',1))[0];
+ TQString key = (*it).section('=',0,0);
+ TQString value = processServiceTemplate((*it).section('=',1))[0];
if (!key.isEmpty()) m_dnssdData[key]=value;
}
}
@@ -181,7 +181,7 @@ void PortListener::loadConfig(KService::Ptr s) {
m_dnssdRegister = false;
- m_slpLifetimeEnd = QDateTime::currentDateTime().addSecs(m_serviceLifetime);
+ m_slpLifetimeEnd = TQDateTime::currentDateTime().addSecs(m_serviceLifetime);
m_defaultPortBase = m_portBase;
m_defaultAutoPortRange = m_autoPortRange;
@@ -192,17 +192,17 @@ void PortListener::loadConfig(KService::Ptr s) {
m_portBase);
m_autoPortRange = m_config->readNumEntry("auto_port_range_" + m_serviceName,
m_autoPortRange);
- QDateTime nullTime;
+ TQDateTime nullTime;
m_expirationTime = m_config->readDateTimeEntry("enabled_expiration_"+m_serviceName,
&nullTime);
- if ((!m_expirationTime.isNull()) && (m_expirationTime < QDateTime::currentDateTime()))
+ if ((!m_expirationTime.isNull()) && (m_expirationTime < TQDateTime::currentDateTime()))
m_enabled = false;
m_registerService = m_config->readBoolEntry("enabled_srvreg_"+m_serviceName,
m_registerService);
}
void PortListener::accepted(KSocket *sock) {
- QString host, port;
+ TQString host, port;
KSocketAddress *ksa = KExtendedSocket::peerAddress(sock->socket());
if ((!ksa) || !ksa->address()) {
delete sock;
@@ -223,7 +223,7 @@ void PortListener::accepted(KSocket *sock) {
fcntl(sock->socket(), F_SETFD, fcntl(sock->socket(), F_GETFD) & ~FD_CLOEXEC);
m_process.clearArguments();
- m_process << m_execPath << m_argument << QString::number(sock->socket());
+ m_process << m_execPath << m_argument << TQString::number(sock->socket());
if (!m_process.start(KProcess::DontCare)) {
KNotifyClient::event("ProcessFailed",
i18n("Call \"%1 %2 %3\" failed").arg(m_execPath)
@@ -246,22 +246,22 @@ int PortListener::port() {
return m_port;
}
-QStringList PortListener::processServiceTemplate(const QString &a) {
- QStringList l;
- QValueVector<KInetInterface> v = KInetInterface::getAllInterfaces(false);
- QValueVector<KInetInterface>::Iterator it = v.begin();
+TQStringList PortListener::processServiceTemplate(const TQString &a) {
+ TQStringList l;
+ TQValueVector<KInetInterface> v = KInetInterface::getAllInterfaces(false);
+ TQValueVector<KInetInterface>::Iterator it = v.begin();
while (it != v.end()) {
KInetSocketAddress *address = (*(it++)).address();
if (!address)
continue;
- QString hostName = address->nodeName();
+ TQString hostName = address->nodeName();
KUser u;
- QString x = a; // replace does not work in const QString. Why??
- l.append(x.replace(QRegExp("%h"), KServiceRegistry::encodeAttributeValue(hostName))
- .replace(QRegExp("%p"), QString::number(m_port))
- .replace(QRegExp("%u"), KServiceRegistry::encodeAttributeValue(u.loginName()))
- .replace(QRegExp("%i"), KServiceRegistry::encodeAttributeValue(m_uuid))
- .replace(QRegExp("%f"), KServiceRegistry::encodeAttributeValue(u.fullName())));
+ TQString x = a; // replace does not work in const TQString. Why??
+ l.append(x.replace(TQRegExp("%h"), KServiceRegistry::encodeAttributeValue(hostName))
+ .replace(TQRegExp("%p"), TQString::number(m_port))
+ .replace(TQRegExp("%u"), KServiceRegistry::encodeAttributeValue(u.loginName()))
+ .replace(TQRegExp("%i"), KServiceRegistry::encodeAttributeValue(m_uuid))
+ .replace(TQRegExp("%f"), KServiceRegistry::encodeAttributeValue(u.fullName())));
}
return l;
}
@@ -294,10 +294,10 @@ bool PortListener::setPort(int port, int autoPortRange) {
}
void PortListener::setEnabled(bool e) {
- setEnabledInternal(e, QDateTime());
+ setEnabledInternal(e, TQDateTime());
}
-void PortListener::setEnabledInternal(bool e, const QDateTime &ex) {
+void PortListener::setEnabledInternal(bool e, const TQDateTime &ex) {
m_config->setGroup("ListenerConfig");
m_config->writeEntry("enabled_" + m_serviceName, e);
m_config->writeEntry("enabled_expiration_"+m_serviceName, ex);
@@ -317,7 +317,7 @@ void PortListener::setEnabledInternal(bool e, const QDateTime &ex) {
}
}
-void PortListener::setEnabled(const QDateTime &ex) {
+void PortListener::setEnabled(const TQDateTime &ex) {
setEnabledInternal(true, ex);
}
@@ -343,9 +343,9 @@ void PortListener::setServiceRegistrationEnabledInternal(bool e) {
if (m_enabled && e) {
m_registeredServiceURLs = processServiceTemplate(m_serviceURL);
- QStringList attributes = processServiceTemplate(m_serviceAttributes);
- QStringList::Iterator it = m_registeredServiceURLs.begin();
- QStringList::Iterator it2 = attributes.begin();
+ TQStringList attributes = processServiceTemplate(m_serviceAttributes);
+ TQStringList::Iterator it = m_registeredServiceURLs.begin();
+ TQStringList::Iterator it2 = attributes.begin();
while ((it != m_registeredServiceURLs.end()) &&
(it2 != attributes.end())) {
if (!m_srvreg->registerService(
@@ -356,9 +356,9 @@ void PortListener::setServiceRegistrationEnabledInternal(bool e) {
}
m_serviceRegistered = true;
// make lifetime 30s shorter, because the timeout is not precise
- m_slpLifetimeEnd = QDateTime::currentDateTime().addSecs(m_serviceLifetime-30);
+ m_slpLifetimeEnd = TQDateTime::currentDateTime().addSecs(m_serviceLifetime-30);
} else {
- QStringList::Iterator it = m_registeredServiceURLs.begin();
+ TQStringList::Iterator it = m_registeredServiceURLs.begin();
while (it != m_registeredServiceURLs.end())
m_srvreg->unregisterService(*(it++));
m_serviceRegistered = false;
@@ -383,24 +383,24 @@ void PortListener::dnssdRegister(bool e) {
}
void PortListener::refreshRegistration() {
- if (m_serviceRegistered && (m_slpLifetimeEnd.addSecs(-90) < QDateTime::currentDateTime())) {
+ if (m_serviceRegistered && (m_slpLifetimeEnd.addSecs(-90) < TQDateTime::currentDateTime())) {
setServiceRegistrationEnabledInternal(false);
setServiceRegistrationEnabledInternal(true);
}
}
-QDateTime PortListener::expiration() {
+TQDateTime PortListener::expiration() {
return m_expirationTime;
}
-QDateTime PortListener::serviceLifetimeEnd() {
+TQDateTime PortListener::serviceLifetimeEnd() {
if (m_serviceRegistered)
return m_slpLifetimeEnd;
else
- return QDateTime();
+ return TQDateTime();
}
-QString PortListener::name() {
+TQString PortListener::name() {
return m_serviceName;
}
@@ -410,7 +410,7 @@ PortListener::~PortListener() {
}
-KInetD::KInetD(QCString &n) :
+KInetD::KInetD(TQCString &n) :
KDEDModule(n)
{
m_config = new KConfig("kinetdrc");
@@ -421,9 +421,9 @@ KInetD::KInetD(QCString &n) :
m_srvreg = 0;
}
m_portListeners.setAutoDelete(true);
- connect(&m_expirationTimer, SIGNAL(timeout()), SLOT(setExpirationTimer()));
- connect(&m_portRetryTimer, SIGNAL(timeout()), SLOT(portRetryTimer()));
- connect(&m_reregistrationTimer, SIGNAL(timeout()), SLOT(reregistrationTimer()));
+ connect(&m_expirationTimer, TQT_SIGNAL(timeout()), TQT_SLOT(setExpirationTimer()));
+ connect(&m_portRetryTimer, TQT_SIGNAL(timeout()), TQT_SLOT(portRetryTimer()));
+ connect(&m_reregistrationTimer, TQT_SIGNAL(timeout()), TQT_SLOT(reregistrationTimer()));
loadServiceList();
}
@@ -456,9 +456,9 @@ void KInetD::expirationTimer() {
}
void KInetD::setExpirationTimer() {
- QDateTime nextEx = getNextExpirationTime(); // disables expired portlistener!
+ TQDateTime nextEx = getNextExpirationTime(); // disables expired portlistener!
if (!nextEx.isNull())
- m_expirationTimer.start(QDateTime::currentDateTime().secsTo(nextEx)*1000 + 30000,
+ m_expirationTimer.start(TQDateTime::currentDateTime().secsTo(nextEx)*1000 + 30000,
false);
else
m_expirationTimer.stop();
@@ -470,12 +470,12 @@ void KInetD::portRetryTimer() {
}
void KInetD::setReregistrationTimer() {
- QDateTime d;
+ TQDateTime d;
PortListener *pl = m_portListeners.first();
while (pl) {
- QDateTime d2 = pl->serviceLifetimeEnd();
+ TQDateTime d2 = pl->serviceLifetimeEnd();
if (!d2.isNull()) {
- if (d2 < QDateTime::currentDateTime()) {
+ if (d2 < TQDateTime::currentDateTime()) {
m_reregistrationTimer.start(0, true);
return;
}
@@ -486,7 +486,7 @@ void KInetD::setReregistrationTimer() {
}
if (!d.isNull()) {
- int s = QDateTime::currentDateTime().secsTo(d);
+ int s = TQDateTime::currentDateTime().secsTo(d);
if (s < 30)
s = 30; // max frequency 30s
m_reregistrationTimer.start(s*1000, true);
@@ -525,7 +525,7 @@ void KInetD::setPortRetryTimer(bool retry) {
m_portRetryTimer.stop();
}
-PortListener *KInetD::getListenerByName(QString name)
+PortListener *KInetD::getListenerByName(TQString name)
{
PortListener *pl = m_portListeners.first();
while (pl) {
@@ -537,14 +537,14 @@ PortListener *KInetD::getListenerByName(QString name)
}
// gets next expiration timer, SIDEEFFECT: disables expired portlisteners while doing this
-QDateTime KInetD::getNextExpirationTime()
+TQDateTime KInetD::getNextExpirationTime()
{
PortListener *pl = m_portListeners.first();
- QDateTime d;
+ TQDateTime d;
while (pl) {
- QDateTime d2 = pl->expiration();
+ TQDateTime d2 = pl->expiration();
if (!d2.isNull()) {
- if (d2 < QDateTime::currentDateTime())
+ if (d2 < TQDateTime::currentDateTime())
pl->setEnabled(false);
else if (d.isNull() || (d2 < d))
d = d2;
@@ -554,9 +554,9 @@ QDateTime KInetD::getNextExpirationTime()
return d;
}
-QStringList KInetD::services()
+TQStringList KInetD::services()
{
- QStringList list;
+ TQStringList list;
PortListener *pl = m_portListeners.first();
while (pl) {
list.append(pl->name());
@@ -565,7 +565,7 @@ QStringList KInetD::services()
return list;
}
-bool KInetD::isEnabled(QString service)
+bool KInetD::isEnabled(TQString service)
{
PortListener *pl = getListenerByName(service);
if (!pl)
@@ -574,7 +574,7 @@ bool KInetD::isEnabled(QString service)
return pl->isEnabled();
}
-int KInetD::port(QString service)
+int KInetD::port(TQString service)
{
PortListener *pl = getListenerByName(service);
if (!pl)
@@ -583,7 +583,7 @@ int KInetD::port(QString service)
return pl->port();
}
-bool KInetD::setPort(QString service, int port, int autoPortRange)
+bool KInetD::setPort(TQString service, int port, int autoPortRange)
{
PortListener *pl = getListenerByName(service);
if (!pl)
@@ -595,13 +595,13 @@ bool KInetD::setPort(QString service, int port, int autoPortRange)
return s;
}
-bool KInetD::isInstalled(QString service)
+bool KInetD::isInstalled(TQString service)
{
PortListener *pl = getListenerByName(service);
return (pl != 0);
}
-void KInetD::setEnabled(QString service, bool enable)
+void KInetD::setEnabled(TQString service, bool enable)
{
PortListener *pl = getListenerByName(service);
if (!pl)
@@ -612,7 +612,7 @@ void KInetD::setEnabled(QString service, bool enable)
setReregistrationTimer();
}
-void KInetD::setEnabled(QString service, QDateTime expiration)
+void KInetD::setEnabled(TQString service, TQDateTime expiration)
{
PortListener *pl = getListenerByName(service);
if (!pl)
@@ -623,7 +623,7 @@ void KInetD::setEnabled(QString service, QDateTime expiration)
setReregistrationTimer();
}
-void KInetD::setServiceRegistrationEnabled(QString service, bool enable)
+void KInetD::setServiceRegistrationEnabled(TQString service, bool enable)
{
PortListener *pl = getListenerByName(service);
if (!pl)
@@ -633,7 +633,7 @@ void KInetD::setServiceRegistrationEnabled(QString service, bool enable)
setReregistrationTimer();
}
-bool KInetD::isServiceRegistrationEnabled(QString service)
+bool KInetD::isServiceRegistrationEnabled(TQString service)
{
PortListener *pl = getListenerByName(service);
if (!pl)
@@ -650,7 +650,7 @@ KInetD::~KInetD() {
}
extern "C" {
- KDE_EXPORT KDEDModule *create_kinetd(QCString &name)
+ KDE_EXPORT KDEDModule *create_kinetd(TQCString &name)
{
KGlobal::locale()->insertCatalogue("kinetd");
return new KInetD(name);