diff options
Diffstat (limited to 'kopete/protocols/jabber/libiris/cutestuff/network')
14 files changed, 413 insertions, 413 deletions
diff --git a/kopete/protocols/jabber/libiris/cutestuff/network/bsocket.cpp b/kopete/protocols/jabber/libiris/cutestuff/network/bsocket.cpp index 75b1fe2a..33c5ec8a 100644 --- a/kopete/protocols/jabber/libiris/cutestuff/network/bsocket.cpp +++ b/kopete/protocols/jabber/libiris/cutestuff/network/bsocket.cpp @@ -1,5 +1,5 @@ /* - * bsocket.cpp - QSocket wrapper based on Bytestream with SRV DNS support + * bsocket.cpp - TQSocket wrapper based on Bytestream with SRV DNS support * Copyright (C) 2003 Justin Karneges * * This library is free software; you can redistribute it and/or @@ -20,10 +20,10 @@ #include"bsocket.h" -#include<qcstring.h> -#include<qsocket.h> -#include<qdns.h> -#include<qguardedptr.h> +#include<tqcstring.h> +#include<tqsocket.h> +#include<tqdns.h> +#include<tqguardedptr.h> #include"safedelete.h" #ifndef NO_NDNS #include"ndns.h" @@ -46,26 +46,26 @@ public: qsock = 0; } - QSocket *qsock; + TQSocket *qsock; int state; #ifndef NO_NDNS NDns ndns; #endif SrvResolver srv; - QString host; + TQString host; int port; SafeDelete sd; }; -BSocket::BSocket(QObject *parent) +BSocket::BSocket(TQObject *parent) :ByteStream(parent) { d = new Private; #ifndef NO_NDNS - connect(&d->ndns, SIGNAL(resultsReady()), SLOT(ndns_done())); + connect(&d->ndns, TQT_SIGNAL(resultsReady()), TQT_SLOT(ndns_done())); #endif - connect(&d->srv, SIGNAL(resultsReady()), SLOT(srv_done())); + connect(&d->srv, TQT_SIGNAL(resultsReady()), TQT_SLOT(srv_done())); reset(); } @@ -83,7 +83,7 @@ void BSocket::reset(bool clear) if(!clear && d->qsock->isOpen()) { // move remaining into the local queue - QByteArray block(d->qsock->bytesAvailable()); + TQByteArray block(d->qsock->bytesAvailable()); d->qsock->readBlock(block.data(), block.size()); appendRead(block); } @@ -112,17 +112,17 @@ void BSocket::ensureSocket() #if QT_VERSION >= 0x030200 d->qsock->setReadBufferSize(READBUFSIZE); #endif - connect(d->qsock, SIGNAL(hostFound()), SLOT(qs_hostFound())); - connect(d->qsock, SIGNAL(connected()), SLOT(qs_connected())); - connect(d->qsock, SIGNAL(connectionClosed()), SLOT(qs_connectionClosed())); - connect(d->qsock, SIGNAL(delayedCloseFinished()), SLOT(qs_delayedCloseFinished())); - connect(d->qsock, SIGNAL(readyRead()), SLOT(qs_readyRead())); - connect(d->qsock, SIGNAL(bytesWritten(int)), SLOT(qs_bytesWritten(int))); - connect(d->qsock, SIGNAL(error(int)), SLOT(qs_error(int))); + connect(d->qsock, TQT_SIGNAL(hostFound()), TQT_SLOT(qs_hostFound())); + connect(d->qsock, TQT_SIGNAL(connected()), TQT_SLOT(qs_connected())); + connect(d->qsock, TQT_SIGNAL(connectionClosed()), TQT_SLOT(qs_connectionClosed())); + connect(d->qsock, TQT_SIGNAL(delayedCloseFinished()), TQT_SLOT(qs_delayedCloseFinished())); + connect(d->qsock, TQT_SIGNAL(readyRead()), TQT_SLOT(qs_readyRead())); + connect(d->qsock, TQT_SIGNAL(bytesWritten(int)), TQT_SLOT(qs_bytesWritten(int))); + connect(d->qsock, TQT_SIGNAL(error(int)), TQT_SLOT(qs_error(int))); } } -void BSocket::connectToHost(const QString &host, Q_UINT16 port) +void BSocket::connectToHost(const TQString &host, Q_UINT16 port) { reset(true); d->host = host; @@ -136,7 +136,7 @@ void BSocket::connectToHost(const QString &host, Q_UINT16 port) #endif } -void BSocket::connectToServer(const QString &srv, const QString &type) +void BSocket::connectToServer(const TQString &srv, const TQString &type) { reset(true); d->state = HostLookup; @@ -188,23 +188,23 @@ void BSocket::close() } } -void BSocket::write(const QByteArray &a) +void BSocket::write(const TQByteArray &a) { if(d->state != Connected) return; #ifdef BS_DEBUG - QCString cs; + TQCString cs; cs.resize(a.size()+1); memcpy(cs.data(), a.data(), a.size()); - QString s = QString::fromUtf8(cs); + TQString s = TQString::fromUtf8(cs); fprintf(stderr, "BSocket: writing [%d]: {%s}\n", a.size(), cs.data()); #endif d->qsock->writeBlock(a.data(), a.size()); } -QByteArray BSocket::read(int bytes) +TQByteArray BSocket::read(int bytes) { - QByteArray block; + TQByteArray block; if(d->qsock) { int max = bytesAvailable(); if(bytes <= 0 || bytes > max) @@ -216,10 +216,10 @@ QByteArray BSocket::read(int bytes) block = ByteStream::read(bytes); #ifdef BS_DEBUG - QCString cs; + TQCString cs; cs.resize(block.size()+1); memcpy(cs.data(), block.data(), block.size()); - QString s = QString::fromUtf8(cs); + TQString s = TQString::fromUtf8(cs); fprintf(stderr, "BSocket: read [%d]: {%s}\n", block.size(), s.latin1()); #endif return block; @@ -240,12 +240,12 @@ int BSocket::bytesToWrite() const return d->qsock->bytesToWrite(); } -QHostAddress BSocket::address() const +TQHostAddress BSocket::address() const { if(d->qsock) return d->qsock->address(); else - return QHostAddress(); + return TQHostAddress(); } Q_UINT16 BSocket::port() const @@ -256,12 +256,12 @@ Q_UINT16 BSocket::port() const return 0; } -QHostAddress BSocket::peerAddress() const +TQHostAddress BSocket::peerAddress() const { if(d->qsock) return d->qsock->peerAddress(); else - return QHostAddress(); + return TQHostAddress(); } Q_UINT16 BSocket::peerPort() const @@ -285,7 +285,7 @@ void BSocket::srv_done() d->host = d->srv.resultAddress().toString(); d->port = d->srv.resultPort(); do_connect(); - //QTimer::singleShot(0, this, SLOT(do_connect())); + //TQTimer::singleShot(0, this, TQT_SLOT(do_connect())); //hostFound(); } @@ -296,7 +296,7 @@ void BSocket::ndns_done() d->host = d->ndns.resultString(); d->state = Connecting; do_connect(); - //QTimer::singleShot(0, this, SLOT(do_connect())); + //TQTimer::singleShot(0, this, TQT_SLOT(do_connect())); //hostFound(); } else { @@ -375,17 +375,17 @@ void BSocket::qs_error(int x) SafeDeleteLock s(&d->sd); // connection error during SRV host connect? try next - if(d->state == HostLookup && (x == QSocket::ErrConnectionRefused || x == QSocket::ErrHostNotFound)) { + if(d->state == HostLookup && (x == TQSocket::ErrConnectionRefused || x == TQSocket::ErrHostNotFound)) { d->srv.next(); return; } reset(); - if(x == QSocket::ErrConnectionRefused) + if(x == TQSocket::ErrConnectionRefused) error(ErrConnectionRefused); - else if(x == QSocket::ErrHostNotFound) + else if(x == TQSocket::ErrHostNotFound) error(ErrHostNotFound); - else if(x == QSocket::ErrSocketRead) + else if(x == TQSocket::ErrSocketRead) error(ErrRead); } diff --git a/kopete/protocols/jabber/libiris/cutestuff/network/bsocket.h b/kopete/protocols/jabber/libiris/cutestuff/network/bsocket.h index f51b3470..7887b9c0 100644 --- a/kopete/protocols/jabber/libiris/cutestuff/network/bsocket.h +++ b/kopete/protocols/jabber/libiris/cutestuff/network/bsocket.h @@ -1,5 +1,5 @@ /* - * bsocket.h - QSocket wrapper based on Bytestream with SRV DNS support + * bsocket.h - TQSocket wrapper based on Bytestream with SRV DNS support * Copyright (C) 2003 Justin Karneges * * This library is free software; you can redistribute it and/or @@ -21,8 +21,8 @@ #ifndef CS_BSOCKET_H #define CS_BSOCKET_H -#include<qobject.h> -#include<qhostaddress.h> +#include<tqobject.h> +#include<tqhostaddress.h> #include"bytestream.h" // CS_NAMESPACE_BEGIN @@ -33,11 +33,11 @@ class BSocket : public ByteStream public: enum Error { ErrConnectionRefused = ErrCustom, ErrHostNotFound }; enum State { Idle, HostLookup, Connecting, Connected, Closing }; - BSocket(QObject *parent=0); + BSocket(TQObject *parent=0); ~BSocket(); - void connectToHost(const QString &host, Q_UINT16 port); - void connectToServer(const QString &srv, const QString &type); + void connectToHost(const TQString &host, Q_UINT16 port); + void connectToServer(const TQString &srv, const TQString &type); int socket() const; void setSocket(int); int state() const; @@ -45,17 +45,17 @@ public: // from ByteStream bool isOpen() const; void close(); - void write(const QByteArray &); - QByteArray read(int bytes=0); + void write(const TQByteArray &); + TQByteArray read(int bytes=0); int bytesAvailable() const; int bytesToWrite() const; // local - QHostAddress address() const; + TQHostAddress address() const; Q_UINT16 port() const; // remote - QHostAddress peerAddress() const; + TQHostAddress peerAddress() const; Q_UINT16 peerPort() const; signals: diff --git a/kopete/protocols/jabber/libiris/cutestuff/network/httpconnect.cpp b/kopete/protocols/jabber/libiris/cutestuff/network/httpconnect.cpp index 76550db0..6abeb556 100644 --- a/kopete/protocols/jabber/libiris/cutestuff/network/httpconnect.cpp +++ b/kopete/protocols/jabber/libiris/cutestuff/network/httpconnect.cpp @@ -20,7 +20,7 @@ #include"httpconnect.h" -#include<qstringlist.h> +#include<tqstringlist.h> #include"bsocket.h" #include"base64.h" @@ -30,20 +30,20 @@ // CS_NAMESPACE_BEGIN -static QString extractLine(QByteArray *buf, bool *found) +static TQString extractLine(TQByteArray *buf, bool *found) { // scan for newline int n; for(n = 0; n < (int)buf->size()-1; ++n) { if(buf->at(n) == '\r' && buf->at(n+1) == '\n') { - QCString cstr; + TQCString cstr; cstr.resize(n+1); memcpy(cstr.data(), buf->data(), n); n += 2; // hack off CR/LF memmove(buf->data(), buf->data() + n, buf->size() - n); buf->resize(buf->size() - n); - QString s = QString::fromUtf8(cstr); + TQString s = TQString::fromUtf8(cstr); if(found) *found = true; @@ -56,7 +56,7 @@ static QString extractLine(QByteArray *buf, bool *found) return ""; } -static bool extractMainHeader(const QString &line, QString *proto, int *code, QString *msg) +static bool extractMainHeader(const TQString &line, TQString *proto, int *code, TQString *msg) { int n = line.find(' '); if(n == -1) @@ -81,31 +81,31 @@ public: Private() {} BSocket sock; - QString host; + TQString host; int port; - QString user, pass; - QString real_host; + TQString user, pass; + TQString real_host; int real_port; - QByteArray recvBuf; + TQByteArray recvBuf; bool inHeader; - QStringList headerLines; + TQStringList headerLines; int toWrite; bool active; }; -HttpConnect::HttpConnect(QObject *parent) +HttpConnect::HttpConnect(TQObject *parent) :ByteStream(parent) { d = new Private; - connect(&d->sock, SIGNAL(connected()), SLOT(sock_connected())); - connect(&d->sock, SIGNAL(connectionClosed()), SLOT(sock_connectionClosed())); - connect(&d->sock, SIGNAL(delayedCloseFinished()), SLOT(sock_delayedCloseFinished())); - connect(&d->sock, SIGNAL(readyRead()), SLOT(sock_readyRead())); - connect(&d->sock, SIGNAL(bytesWritten(int)), SLOT(sock_bytesWritten(int))); - connect(&d->sock, SIGNAL(error(int)), SLOT(sock_error(int))); + connect(&d->sock, TQT_SIGNAL(connected()), TQT_SLOT(sock_connected())); + connect(&d->sock, TQT_SIGNAL(connectionClosed()), TQT_SLOT(sock_connectionClosed())); + connect(&d->sock, TQT_SIGNAL(delayedCloseFinished()), TQT_SLOT(sock_delayedCloseFinished())); + connect(&d->sock, TQT_SIGNAL(readyRead()), TQT_SLOT(sock_readyRead())); + connect(&d->sock, TQT_SIGNAL(bytesWritten(int)), TQT_SLOT(sock_bytesWritten(int))); + connect(&d->sock, TQT_SIGNAL(error(int)), TQT_SLOT(sock_error(int))); reset(true); } @@ -127,13 +127,13 @@ void HttpConnect::reset(bool clear) d->active = false; } -void HttpConnect::setAuth(const QString &user, const QString &pass) +void HttpConnect::setAuth(const TQString &user, const TQString &pass) { d->user = user; d->pass = pass; } -void HttpConnect::connectToHost(const QString &proxyHost, int proxyPort, const QString &host, int port) +void HttpConnect::connectToHost(const TQString &proxyHost, int proxyPort, const TQString &host, int port) { reset(true); @@ -164,13 +164,13 @@ void HttpConnect::close() reset(); } -void HttpConnect::write(const QByteArray &buf) +void HttpConnect::write(const TQByteArray &buf) { if(d->active) d->sock.write(buf); } -QByteArray HttpConnect::read(int bytes) +TQByteArray HttpConnect::read(int bytes) { return ByteStream::read(bytes); } @@ -197,18 +197,18 @@ void HttpConnect::sock_connected() d->headerLines.clear(); // connected, now send the request - QString s; - s += QString("CONNECT ") + d->real_host + ':' + QString::number(d->real_port) + " HTTP/1.0\r\n"; + TQString s; + s += TQString("CONNECT ") + d->real_host + ':' + TQString::number(d->real_port) + " HTTP/1.0\r\n"; if(!d->user.isEmpty()) { - QString str = d->user + ':' + d->pass; - s += QString("Proxy-Authorization: Basic ") + Base64::encodeString(str) + "\r\n"; + TQString str = d->user + ':' + d->pass; + s += TQString("Proxy-Authorization: Basic ") + Base64::encodeString(str) + "\r\n"; } s += "Proxy-Connection: Keep-Alive\r\n"; s += "Pragma: no-cache\r\n"; s += "\r\n"; - QCString cs = s.utf8(); - QByteArray block(cs.length()); + TQCString cs = s.utf8(); + TQByteArray block(cs.length()); memcpy(block.data(), cs.data(), block.size()); d->toWrite = block.size(); d->sock.write(block); @@ -235,7 +235,7 @@ void HttpConnect::sock_delayedCloseFinished() void HttpConnect::sock_readyRead() { - QByteArray block = d->sock.read(); + TQByteArray block = d->sock.read(); if(!d->active) { ByteStream::appendArray(&d->recvBuf, block); @@ -244,7 +244,7 @@ void HttpConnect::sock_readyRead() // grab available lines while(1) { bool found; - QString line = extractLine(&d->recvBuf, &found); + TQString line = extractLine(&d->recvBuf, &found); if(!found) break; if(line.isEmpty()) { @@ -256,12 +256,12 @@ void HttpConnect::sock_readyRead() // done with grabbing the header? if(!d->inHeader) { - QString str = d->headerLines.first(); + TQString str = d->headerLines.first(); d->headerLines.remove(d->headerLines.begin()); - QString proto; + TQString proto; int code; - QString msg; + TQString msg; if(!extractMainHeader(str, &proto, &code, &msg)) { #ifdef PROX_DEBUG fprintf(stderr, "HttpConnect: invalid header!\n"); @@ -273,7 +273,7 @@ void HttpConnect::sock_readyRead() else { #ifdef PROX_DEBUG fprintf(stderr, "HttpConnect: header proto=[%s] code=[%d] msg=[%s]\n", proto.latin1(), code, msg.latin1()); - for(QStringList::ConstIterator it = d->headerLines.begin(); it != d->headerLines.end(); ++it) + for(TQStringList::ConstIterator it = d->headerLines.begin(); it != d->headerLines.end(); ++it) fprintf(stderr, "HttpConnect: * [%s]\n", (*it).latin1()); #endif } @@ -294,7 +294,7 @@ void HttpConnect::sock_readyRead() } else { int err; - QString errStr; + TQString errStr; if(code == 407) { // Authentication failed err = ErrProxyAuth; errStr = tr("Authentication failed"); diff --git a/kopete/protocols/jabber/libiris/cutestuff/network/httpconnect.h b/kopete/protocols/jabber/libiris/cutestuff/network/httpconnect.h index e383969b..2acef809 100644 --- a/kopete/protocols/jabber/libiris/cutestuff/network/httpconnect.h +++ b/kopete/protocols/jabber/libiris/cutestuff/network/httpconnect.h @@ -30,17 +30,17 @@ class HttpConnect : public ByteStream Q_OBJECT public: enum Error { ErrConnectionRefused = ErrCustom, ErrHostNotFound, ErrProxyConnect, ErrProxyNeg, ErrProxyAuth }; - HttpConnect(QObject *parent=0); + HttpConnect(TQObject *parent=0); ~HttpConnect(); - void setAuth(const QString &user, const QString &pass=""); - void connectToHost(const QString &proxyHost, int proxyPort, const QString &host, int port); + void setAuth(const TQString &user, const TQString &pass=""); + void connectToHost(const TQString &proxyHost, int proxyPort, const TQString &host, int port); // from ByteStream bool isOpen() const; void close(); - void write(const QByteArray &); - QByteArray read(int bytes=0); + void write(const TQByteArray &); + TQByteArray read(int bytes=0); int bytesAvailable() const; int bytesToWrite() const; diff --git a/kopete/protocols/jabber/libiris/cutestuff/network/httppoll.cpp b/kopete/protocols/jabber/libiris/cutestuff/network/httppoll.cpp index 605d44e9..3a182457 100644 --- a/kopete/protocols/jabber/libiris/cutestuff/network/httppoll.cpp +++ b/kopete/protocols/jabber/libiris/cutestuff/network/httppoll.cpp @@ -20,10 +20,10 @@ #include"httppoll.h" -#include<qstringlist.h> -#include<qurl.h> -#include<qtimer.h> -#include<qguardedptr.h> +#include<tqstringlist.h> +#include<tqurl.h> +#include<tqtimer.h> +#include<tqguardedptr.h> #include<qca.h> #include<stdlib.h> #include"bsocket.h" @@ -37,9 +37,9 @@ // CS_NAMESPACE_BEGIN -static QByteArray randomArray(int size) +static TQByteArray randomArray(int size) { - QByteArray a(size); + TQByteArray a(size); for(int n = 0; n < size; ++n) a[n] = (char)(256.0*rand()/(RAND_MAX+1.0)); return a; @@ -48,12 +48,12 @@ static QByteArray randomArray(int size) //---------------------------------------------------------------------------- // HttpPoll //---------------------------------------------------------------------------- -static QString hpk(int n, const QString &s) +static TQString hpk(int n, const TQString &s) { if(n == 0) return s; else - return Base64::arrayToString( QCA::SHA1::hash( QCString(hpk(n - 1, s).latin1()) ) ); + return Base64::arrayToString( QCA::SHA1::hash( TQCString(hpk(n - 1, s).latin1()) ) ); } class HttpPoll::Private @@ -62,37 +62,37 @@ public: Private() {} HttpProxyPost http; - QString host; + TQString host; int port; - QString user, pass; - QString url; + TQString user, pass; + TQString url; bool use_proxy; - QByteArray out; + TQByteArray out; int state; bool closing; - QString ident; + TQString ident; - QTimer *t; + TQTimer *t; - QString key[POLL_KEYS]; + TQString key[POLL_KEYS]; int key_n; int polltime; }; -HttpPoll::HttpPoll(QObject *parent) +HttpPoll::HttpPoll(TQObject *parent) :ByteStream(parent) { d = new Private; d->polltime = 30; d->t = new QTimer; - connect(d->t, SIGNAL(timeout()), SLOT(do_sync())); + connect(d->t, TQT_SIGNAL(timeout()), TQT_SLOT(do_sync())); - connect(&d->http, SIGNAL(result()), SLOT(http_result())); - connect(&d->http, SIGNAL(error(int)), SLOT(http_error(int))); + connect(&d->http, TQT_SIGNAL(result()), TQT_SLOT(http_result())); + connect(&d->http, TQT_SIGNAL(error(int)), TQT_SLOT(http_error(int))); reset(true); } @@ -117,18 +117,18 @@ void HttpPoll::reset(bool clear) d->t->stop(); } -void HttpPoll::setAuth(const QString &user, const QString &pass) +void HttpPoll::setAuth(const TQString &user, const TQString &pass) { d->user = user; d->pass = pass; } -void HttpPoll::connectToUrl(const QString &url) +void HttpPoll::connectToUrl(const TQString &url) { connectToHost("", 0, url); } -void HttpPoll::connectToHost(const QString &proxyHost, int proxyPort, const QString &url) +void HttpPoll::connectToHost(const TQString &proxyHost, int proxyPort, const TQString &url) { reset(true); @@ -140,7 +140,7 @@ void HttpPoll::connectToHost(const QString &proxyHost, int proxyPort, const QStr d->use_proxy = true; } else { - QUrl u = url; + TQUrl u = url; d->host = u.host(); if(u.hasPort()) d->port = u.port(); @@ -152,7 +152,7 @@ void HttpPoll::connectToHost(const QString &proxyHost, int proxyPort, const QStr resetKey(); bool last; - QString key = getKey(&last); + TQString key = getKey(&last); #ifdef PROX_DEBUG fprintf(stderr, "HttpPoll: Connecting to %s:%d [%s]", d->host.latin1(), d->port, d->url.latin1()); @@ -161,19 +161,19 @@ void HttpPoll::connectToHost(const QString &proxyHost, int proxyPort, const QStr else fprintf(stderr, ", auth {%s,%s}\n", d->user.latin1(), d->pass.latin1()); #endif - QGuardedPtr<QObject> self = this; + TQGuardedPtr<TQObject> self = this; syncStarted(); if(!self) return; d->state = 1; d->http.setAuth(d->user, d->pass); - d->http.post(d->host, d->port, d->url, makePacket("0", key, "", QByteArray()), d->use_proxy); + d->http.post(d->host, d->port, d->url, makePacket("0", key, "", TQByteArray()), d->use_proxy); } -QByteArray HttpPoll::makePacket(const QString &ident, const QString &key, const QString &newkey, const QByteArray &block) +TQByteArray HttpPoll::makePacket(const TQString &ident, const TQString &key, const TQString &newkey, const TQByteArray &block) { - QString str = ident; + TQString str = ident; if(!key.isEmpty()) { str += ';'; str += key; @@ -183,10 +183,10 @@ QByteArray HttpPoll::makePacket(const QString &ident, const QString &key, const str += newkey; } str += ','; - QCString cs = str.latin1(); + TQCString cs = str.latin1(); int len = cs.length(); - QByteArray a(len + block.size()); + TQByteArray a(len + block.size()); memcpy(a.data(), cs.data(), len); memcpy(a.data() + len, block.data(), block.size()); return a; @@ -221,14 +221,14 @@ void HttpPoll::close() void HttpPoll::http_result() { // check for death :) - QGuardedPtr<QObject> self = this; + TQGuardedPtr<TQObject> self = this; syncFinished(); if(!self) return; // get id and packet - QString id; - QString cookie = d->http.getHeader("Set-Cookie"); + TQString id; + TQString cookie = d->http.getHeader("Set-Cookie"); int n = cookie.find("ID="); if(n == -1) { reset(); @@ -241,7 +241,7 @@ void HttpPoll::http_result() id = cookie.mid(n, n2-n); else id = cookie.mid(n); - QByteArray block = d->http.body(); + TQByteArray block = d->http.body(); // session error? if(id.right(2) == ":0") { @@ -337,14 +337,14 @@ void HttpPoll::do_sync() d->out = takeWrite(0, false); bool last; - QString key = getKey(&last); - QString newkey; + TQString key = getKey(&last); + TQString newkey; if(last) { resetKey(); newkey = getKey(&last); } - QGuardedPtr<QObject> self = this; + TQGuardedPtr<TQObject> self = this; syncStarted(); if(!self) return; @@ -357,15 +357,15 @@ void HttpPoll::resetKey() #ifdef PROX_DEBUG fprintf(stderr, "HttpPoll: reset key!\n"); #endif - QByteArray a = randomArray(64); - QString str = QString::fromLatin1(a.data(), a.size()); + TQByteArray a = randomArray(64); + TQString str = TQString::fromLatin1(a.data(), a.size()); d->key_n = POLL_KEYS; for(int n = 0; n < POLL_KEYS; ++n) d->key[n] = hpk(n+1, str); } -const QString & HttpPoll::getKey(bool *last) +const TQString & HttpPoll::getKey(bool *last) { *last = false; --(d->key_n); @@ -378,20 +378,20 @@ const QString & HttpPoll::getKey(bool *last) //---------------------------------------------------------------------------- // HttpProxyPost //---------------------------------------------------------------------------- -static QString extractLine(QByteArray *buf, bool *found) +static TQString extractLine(TQByteArray *buf, bool *found) { // scan for newline int n; for(n = 0; n < (int)buf->size()-1; ++n) { if(buf->at(n) == '\r' && buf->at(n+1) == '\n') { - QCString cstr; + TQCString cstr; cstr.resize(n+1); memcpy(cstr.data(), buf->data(), n); n += 2; // hack off CR/LF memmove(buf->data(), buf->data() + n, buf->size() - n); buf->resize(buf->size() - n); - QString s = QString::fromUtf8(cstr); + TQString s = TQString::fromUtf8(cstr); if(found) *found = true; @@ -404,7 +404,7 @@ static QString extractLine(QByteArray *buf, bool *found) return ""; } -static bool extractMainHeader(const QString &line, QString *proto, int *code, QString *msg) +static bool extractMainHeader(const TQString &line, TQString *proto, int *code, TQString *msg) { int n = line.find(' '); if(n == -1) @@ -429,23 +429,23 @@ public: Private() {} BSocket sock; - QByteArray postdata, recvBuf, body; - QString url; - QString user, pass; + TQByteArray postdata, recvBuf, body; + TQString url; + TQString user, pass; bool inHeader; - QStringList headerLines; + TQStringList headerLines; bool asProxy; - QString host; + TQString host; }; -HttpProxyPost::HttpProxyPost(QObject *parent) -:QObject(parent) +HttpProxyPost::HttpProxyPost(TQObject *parent) +:TQObject(parent) { d = new Private; - connect(&d->sock, SIGNAL(connected()), SLOT(sock_connected())); - connect(&d->sock, SIGNAL(connectionClosed()), SLOT(sock_connectionClosed())); - connect(&d->sock, SIGNAL(readyRead()), SLOT(sock_readyRead())); - connect(&d->sock, SIGNAL(error(int)), SLOT(sock_error(int))); + connect(&d->sock, TQT_SIGNAL(connected()), TQT_SLOT(sock_connected())); + connect(&d->sock, TQT_SIGNAL(connectionClosed()), TQT_SLOT(sock_connectionClosed())); + connect(&d->sock, TQT_SIGNAL(readyRead()), TQT_SLOT(sock_readyRead())); + connect(&d->sock, TQT_SIGNAL(error(int)), TQT_SLOT(sock_error(int))); reset(true); } @@ -464,7 +464,7 @@ void HttpProxyPost::reset(bool clear) d->body.resize(0); } -void HttpProxyPost::setAuth(const QString &user, const QString &pass) +void HttpProxyPost::setAuth(const TQString &user, const TQString &pass) { d->user = user; d->pass = pass; @@ -475,7 +475,7 @@ bool HttpProxyPost::isActive() const return (d->sock.state() == BSocket::Idle ? false: true); } -void HttpProxyPost::post(const QString &proxyHost, int proxyPort, const QString &url, const QByteArray &data, bool asProxy) +void HttpProxyPost::post(const TQString &proxyHost, int proxyPort, const TQString &url, const TQByteArray &data, bool asProxy) { reset(true); @@ -499,19 +499,19 @@ void HttpProxyPost::stop() reset(); } -QByteArray HttpProxyPost::body() const +TQByteArray HttpProxyPost::body() const { return d->body; } -QString HttpProxyPost::getHeader(const QString &var) const +TQString HttpProxyPost::getHeader(const TQString &var) const { - for(QStringList::ConstIterator it = d->headerLines.begin(); it != d->headerLines.end(); ++it) { - const QString &s = *it; + for(TQStringList::ConstIterator it = d->headerLines.begin(); it != d->headerLines.end(); ++it) { + const TQString &s = *it; int n = s.find(": "); if(n == -1) continue; - QString v = s.mid(0, n); + TQString v = s.mid(0, n); if(v == var) return s.mid(n+2); } @@ -526,30 +526,30 @@ void HttpProxyPost::sock_connected() d->inHeader = true; d->headerLines.clear(); - QUrl u = d->url; + TQUrl u = d->url; // connected, now send the request - QString s; - s += QString("POST ") + d->url + " HTTP/1.0\r\n"; + TQString s; + s += TQString("POST ") + d->url + " HTTP/1.0\r\n"; if(d->asProxy) { if(!d->user.isEmpty()) { - QString str = d->user + ':' + d->pass; - s += QString("Proxy-Authorization: Basic ") + Base64::encodeString(str) + "\r\n"; + TQString str = d->user + ':' + d->pass; + s += TQString("Proxy-Authorization: Basic ") + Base64::encodeString(str) + "\r\n"; } s += "Proxy-Connection: Keep-Alive\r\n"; s += "Pragma: no-cache\r\n"; - s += QString("Host: ") + u.host() + "\r\n"; + s += TQString("Host: ") + u.host() + "\r\n"; } else { - s += QString("Host: ") + d->host + "\r\n"; + s += TQString("Host: ") + d->host + "\r\n"; } s += "Content-Type: application/x-www-form-urlencoded\r\n"; - s += QString("Content-Length: ") + QString::number(d->postdata.size()) + "\r\n"; + s += TQString("Content-Length: ") + TQString::number(d->postdata.size()) + "\r\n"; s += "\r\n"; // write request - QCString cs = s.utf8(); - QByteArray block(cs.length()); + TQCString cs = s.utf8(); + TQByteArray block(cs.length()); memcpy(block.data(), cs.data(), block.size()); d->sock.write(block); @@ -566,14 +566,14 @@ void HttpProxyPost::sock_connectionClosed() void HttpProxyPost::sock_readyRead() { - QByteArray block = d->sock.read(); + TQByteArray block = d->sock.read(); ByteStream::appendArray(&d->recvBuf, block); if(d->inHeader) { // grab available lines while(1) { bool found; - QString line = extractLine(&d->recvBuf, &found); + TQString line = extractLine(&d->recvBuf, &found); if(!found) break; if(line.isEmpty()) { @@ -585,12 +585,12 @@ void HttpProxyPost::sock_readyRead() // done with grabbing the header? if(!d->inHeader) { - QString str = d->headerLines.first(); + TQString str = d->headerLines.first(); d->headerLines.remove(d->headerLines.begin()); - QString proto; + TQString proto; int code; - QString msg; + TQString msg; if(!extractMainHeader(str, &proto, &code, &msg)) { #ifdef PROX_DEBUG fprintf(stderr, "HttpProxyPost: invalid header!\n"); @@ -602,7 +602,7 @@ void HttpProxyPost::sock_readyRead() else { #ifdef PROX_DEBUG fprintf(stderr, "HttpProxyPost: header proto=[%s] code=[%d] msg=[%s]\n", proto.latin1(), code, msg.latin1()); - for(QStringList::ConstIterator it = d->headerLines.begin(); it != d->headerLines.end(); ++it) + for(TQStringList::ConstIterator it = d->headerLines.begin(); it != d->headerLines.end(); ++it) fprintf(stderr, "HttpProxyPost: * [%s]\n", (*it).latin1()); #endif } @@ -614,7 +614,7 @@ void HttpProxyPost::sock_readyRead() } else { int err; - QString errStr; + TQString errStr; if(code == 407) { // Authentication failed err = ErrProxyAuth; errStr = tr("Authentication failed"); diff --git a/kopete/protocols/jabber/libiris/cutestuff/network/httppoll.h b/kopete/protocols/jabber/libiris/cutestuff/network/httppoll.h index 4c02ead2..c38b7a8a 100644 --- a/kopete/protocols/jabber/libiris/cutestuff/network/httppoll.h +++ b/kopete/protocols/jabber/libiris/cutestuff/network/httppoll.h @@ -30,12 +30,12 @@ class HttpPoll : public ByteStream Q_OBJECT public: enum Error { ErrConnectionRefused = ErrCustom, ErrHostNotFound, ErrProxyConnect, ErrProxyNeg, ErrProxyAuth }; - HttpPoll(QObject *parent=0); + HttpPoll(TQObject *parent=0); ~HttpPoll(); - void setAuth(const QString &user, const QString &pass=""); - void connectToUrl(const QString &url); - void connectToHost(const QString &proxyHost, int proxyPort, const QString &url); + void setAuth(const TQString &user, const TQString &pass=""); + void connectToUrl(const TQString &url); + void connectToHost(const TQString &proxyHost, int proxyPort, const TQString &url); int pollInterval() const; void setPollInterval(int seconds); @@ -62,9 +62,9 @@ private: Private *d; void reset(bool clear=false); - QByteArray makePacket(const QString &ident, const QString &key, const QString &newkey, const QByteArray &block); + TQByteArray makePacket(const TQString &ident, const TQString &key, const TQString &newkey, const TQByteArray &block); void resetKey(); - const QString & getKey(bool *); + const TQString & getKey(bool *); }; class HttpProxyPost : public QObject @@ -72,15 +72,15 @@ class HttpProxyPost : public QObject Q_OBJECT public: enum Error { ErrConnectionRefused, ErrHostNotFound, ErrSocket, ErrProxyConnect, ErrProxyNeg, ErrProxyAuth }; - HttpProxyPost(QObject *parent=0); + HttpProxyPost(TQObject *parent=0); ~HttpProxyPost(); - void setAuth(const QString &user, const QString &pass=""); + void setAuth(const TQString &user, const TQString &pass=""); bool isActive() const; - void post(const QString &proxyHost, int proxyPort, const QString &url, const QByteArray &data, bool asProxy=true); + void post(const TQString &proxyHost, int proxyPort, const TQString &url, const TQByteArray &data, bool asProxy=true); void stop(); - QByteArray body() const; - QString getHeader(const QString &) const; + TQByteArray body() const; + TQString getHeader(const TQString &) const; signals: void result(); diff --git a/kopete/protocols/jabber/libiris/cutestuff/network/ndns.cpp b/kopete/protocols/jabber/libiris/cutestuff/network/ndns.cpp index 1203315a..748db248 100644 --- a/kopete/protocols/jabber/libiris/cutestuff/network/ndns.cpp +++ b/kopete/protocols/jabber/libiris/cutestuff/network/ndns.cpp @@ -21,9 +21,9 @@ //! \class NDns ndns.h //! \brief Simple DNS resolution using native system calls //! -//! This class is to be used when Qt's QDns is not good enough. Because QDns +//! This class is to be used when Qt's TQDns is not good enough. Because QDns //! does not use threads, it cannot make a system call asyncronously. Thus, -//! QDns tries to imitate the behavior of each platform's native behavior, and +//! TQDns tries to imitate the behavior of each platform's native behavior, and //! generally falls short. //! //! NDns uses a thread to make the system call happen in the background. This @@ -45,15 +45,15 @@ //! //! // or if you want to get the IP address as a string: //! -//! QString ip_address = dns.resultString(); +//! TQString ip_address = dns.resultString(); //! \endcode #include"ndns.h" -#include<qapplication.h> -#include<qsocketdevice.h> -#include<qptrlist.h> -#include<qeventloop.h> +#include<tqapplication.h> +#include<tqsocketdevice.h> +#include<tqptrlist.h> +#include<tqeventloop.h> #ifdef Q_OS_UNIX #include<netdb.h> @@ -72,7 +72,7 @@ class NDnsWorkerEvent : public QCustomEvent { public: - enum Type { WorkerEvent = QEvent::User + 100 }; + enum Type { WorkerEvent = TQEvent::User + 100 }; NDnsWorkerEvent(NDnsWorker *); NDnsWorker *worker; @@ -81,18 +81,18 @@ public: class NDnsWorker : public QThread { public: - NDnsWorker(QObject *, const QCString &); + NDnsWorker(TQObject *, const TQCString &); bool success; bool cancelled; - QHostAddress addr; + TQHostAddress addr; protected: void run(); private: - QCString host; - QObject *par; + TQCString host; + TQObject *par; }; //! \endif @@ -100,8 +100,8 @@ private: // NDnsManager //---------------------------------------------------------------------------- #ifndef HAVE_GETHOSTBYNAME_R -static QMutex *workerMutex = 0; -static QMutex *workerCancelled = 0; +static TQMutex *workerMutex = 0; +static TQMutex *workerCancelled = 0; #endif static NDnsManager *man = 0; bool winsock_init = false; @@ -118,7 +118,7 @@ class NDnsManager::Private public: Item *find(const NDns *n) { - QPtrListIterator<Item> it(list); + TQPtrListIterator<Item> it(list); for(Item *i; (i = it.current()); ++it) { if(i->ndns == n) return i; @@ -128,7 +128,7 @@ public: Item *find(const NDnsWorker *w) { - QPtrListIterator<Item> it(list); + TQPtrListIterator<Item> it(list); for(Item *i; (i = it.current()); ++it) { if(i->worker == w) return i; @@ -136,7 +136,7 @@ public: return 0; } - QPtrList<Item> list; + TQPtrList<Item> list; }; NDnsManager::NDnsManager() @@ -149,7 +149,7 @@ NDnsManager::NDnsManager() #ifdef Q_OS_WIN32 if(!winsock_init) { winsock_init = true; - QSocketDevice *sd = new QSocketDevice; + TQSocketDevice *sd = new QSocketDevice; delete sd; } #endif @@ -157,7 +157,7 @@ NDnsManager::NDnsManager() d = new Private; d->list.setAutoDelete(true); - connect(qApp, SIGNAL(aboutToQuit()), SLOT(app_aboutToQuit())); + connect(qApp, TQT_SIGNAL(aboutToQuit()), TQT_SLOT(app_aboutToQuit())); } NDnsManager::~NDnsManager() @@ -172,7 +172,7 @@ NDnsManager::~NDnsManager() #endif } -void NDnsManager::resolve(NDns *self, const QString &name) +void NDnsManager::resolve(NDns *self, const TQString &name) { Item *i = new Item; i->ndns = self; @@ -204,7 +204,7 @@ bool NDnsManager::isBusy(const NDns *self) const return (i ? true: false); } -bool NDnsManager::event(QEvent *e) +bool NDnsManager::event(TQEvent *e) { if((int)e->type() == (int)NDnsWorkerEvent::WorkerEvent) { NDnsWorkerEvent *we = static_cast<NDnsWorkerEvent*>(e); @@ -215,7 +215,7 @@ bool NDnsManager::event(QEvent *e) // should NOT happen return true; } - QHostAddress addr = i->worker->addr; + TQHostAddress addr = i->worker->addr; NDns *ndns = i->ndns; delete i->worker; d->list.removeRef(i); @@ -242,8 +242,8 @@ void NDnsManager::tryDestroy() void NDnsManager::app_aboutToQuit() { while(man) { - QEventLoop *e = qApp->eventLoop(); - e->processEvents(QEventLoop::WaitForMore); + TQEventLoop *e = qApp->eventLoop(); + e->processEvents(TQEventLoop::WaitForMore); } } @@ -257,8 +257,8 @@ void NDnsManager::app_aboutToQuit() //! //! Constructs an NDns object with parent \a parent. -NDns::NDns(QObject *parent) -:QObject(parent) +NDns::NDns(TQObject *parent) +:TQObject(parent) { } @@ -271,7 +271,7 @@ NDns::~NDns() //! //! Resolves hostname \a host (eg. psi.affinix.com) -void NDns::resolve(const QString &host) +void NDns::resolve(const TQString &host) { stop(); if(!man) @@ -299,7 +299,7 @@ uint NDns::result() const //! //! Returns the IP address as a string. This will be an empty string if the lookup failed. //! \sa resultsReady() -QString NDns::resultString() const +TQString NDns::resultString() const { return addr.toString(); } @@ -313,7 +313,7 @@ bool NDns::isBusy() const return man->isBusy(this); } -void NDns::finished(const QHostAddress &a) +void NDns::finished(const TQHostAddress &a) { addr = a; resultsReady(); @@ -323,7 +323,7 @@ void NDns::finished(const QHostAddress &a) // NDnsWorkerEvent //---------------------------------------------------------------------------- NDnsWorkerEvent::NDnsWorkerEvent(NDnsWorker *p) -:QCustomEvent(WorkerEvent) +:TQCustomEvent(WorkerEvent) { worker = p; } @@ -331,7 +331,7 @@ NDnsWorkerEvent::NDnsWorkerEvent(NDnsWorker *p) //---------------------------------------------------------------------------- // NDnsWorker //---------------------------------------------------------------------------- -NDnsWorker::NDnsWorker(QObject *_par, const QCString &_host) +NDnsWorker::NDnsWorker(TQObject *_par, const TQCString &_host) { success = cancelled = false; par = _par; @@ -349,7 +349,7 @@ void NDnsWorker::run() gethostbyname_r(host.data(), &buf, char_buf, sizeof(char_buf), &h, &err); #else // lock for gethostbyname - QMutexLocker locker(workerMutex); + TQMutexLocker locker(workerMutex); // check for cancel workerCancelled->lock(); @@ -362,7 +362,7 @@ void NDnsWorker::run() if(!h) { success = false; - QApplication::postEvent(par, new NDnsWorkerEvent(this)); + TQApplication::postEvent(par, new NDnsWorkerEvent(this)); return; } @@ -370,7 +370,7 @@ void NDnsWorker::run() addr.setAddress(ntohl(a.s_addr)); success = true; - QApplication::postEvent(par, new NDnsWorkerEvent(this)); + TQApplication::postEvent(par, new NDnsWorkerEvent(this)); } // CS_NAMESPACE_END diff --git a/kopete/protocols/jabber/libiris/cutestuff/network/ndns.h b/kopete/protocols/jabber/libiris/cutestuff/network/ndns.h index ccbc6b57..48243e30 100644 --- a/kopete/protocols/jabber/libiris/cutestuff/network/ndns.h +++ b/kopete/protocols/jabber/libiris/cutestuff/network/ndns.h @@ -21,11 +21,11 @@ #ifndef CS_NDNS_H #define CS_NDNS_H -#include<qobject.h> -#include<qcstring.h> -#include<qthread.h> -#include<qmutex.h> -#include<qhostaddress.h> +#include<tqobject.h> +#include<tqcstring.h> +#include<tqthread.h> +#include<tqmutex.h> +#include<tqhostaddress.h> // CS_NAMESPACE_BEGIN @@ -36,24 +36,24 @@ class NDns : public QObject { Q_OBJECT public: - NDns(QObject *parent=0); + NDns(TQObject *parent=0); ~NDns(); - void resolve(const QString &); + void resolve(const TQString &); void stop(); bool isBusy() const; uint result() const; - QString resultString() const; + TQString resultString() const; signals: void resultsReady(); private: - QHostAddress addr; + TQHostAddress addr; friend class NDnsManager; - void finished(const QHostAddress &); + void finished(const TQHostAddress &); }; class NDnsManager : public QObject @@ -65,7 +65,7 @@ public: //! \if _hide_doc_ protected: - bool event(QEvent *); + bool event(TQEvent *); //! \endif private slots: @@ -77,7 +77,7 @@ private: friend class NDns; NDnsManager(); - void resolve(NDns *self, const QString &name); + void resolve(NDns *self, const TQString &name); void stop(NDns *self); bool isBusy(const NDns *self) const; void tryDestroy(); diff --git a/kopete/protocols/jabber/libiris/cutestuff/network/servsock.cpp b/kopete/protocols/jabber/libiris/cutestuff/network/servsock.cpp index e503d57a..5b88b4e5 100644 --- a/kopete/protocols/jabber/libiris/cutestuff/network/servsock.cpp +++ b/kopete/protocols/jabber/libiris/cutestuff/network/servsock.cpp @@ -33,8 +33,8 @@ public: ServSockSignal *serv; }; -ServSock::ServSock(QObject *parent) -:QObject(parent) +ServSock::ServSock(TQObject *parent) +:TQObject(parent) { d = new Private; d->serv = 0; @@ -61,7 +61,7 @@ bool ServSock::listen(Q_UINT16 port) d->serv = 0; return false; } - connect(d->serv, SIGNAL(connectionReady(int)), SLOT(sss_connectionReady(int))); + connect(d->serv, TQT_SIGNAL(connectionReady(int)), TQT_SLOT(sss_connectionReady(int))); return true; } @@ -80,12 +80,12 @@ int ServSock::port() const return -1; } -QHostAddress ServSock::address() const +TQHostAddress ServSock::address() const { if(d->serv) return d->serv->address(); else - return QHostAddress(); + return TQHostAddress(); } void ServSock::sss_connectionReady(int s) @@ -98,7 +98,7 @@ void ServSock::sss_connectionReady(int s) // ServSockSignal //---------------------------------------------------------------------------- ServSockSignal::ServSockSignal(int port) -:QServerSocket(port, 16) +:TQServerSocket(port, 16) { } diff --git a/kopete/protocols/jabber/libiris/cutestuff/network/servsock.h b/kopete/protocols/jabber/libiris/cutestuff/network/servsock.h index a19cd38e..4628d8ea 100644 --- a/kopete/protocols/jabber/libiris/cutestuff/network/servsock.h +++ b/kopete/protocols/jabber/libiris/cutestuff/network/servsock.h @@ -21,7 +21,7 @@ #ifndef CS_SERVSOCK_H #define CS_SERVSOCK_H -#include<qserversocket.h> +#include<tqserversocket.h> // CS_NAMESPACE_BEGIN @@ -29,14 +29,14 @@ class ServSock : public QObject { Q_OBJECT public: - ServSock(QObject *parent=0); + ServSock(TQObject *parent=0); ~ServSock(); bool isActive() const; bool listen(Q_UINT16 port); void stop(); int port() const; - QHostAddress address() const; + TQHostAddress address() const; signals: void connectionReady(int); diff --git a/kopete/protocols/jabber/libiris/cutestuff/network/socks.cpp b/kopete/protocols/jabber/libiris/cutestuff/network/socks.cpp index 2f3ca5a8..59504170 100644 --- a/kopete/protocols/jabber/libiris/cutestuff/network/socks.cpp +++ b/kopete/protocols/jabber/libiris/cutestuff/network/socks.cpp @@ -20,13 +20,13 @@ #include"socks.h" -#include<qhostaddress.h> -#include<qstringlist.h> -#include<qptrlist.h> -#include<qtimer.h> -#include<qguardedptr.h> -#include<qsocketdevice.h> -#include<qsocketnotifier.h> +#include<tqhostaddress.h> +#include<tqstringlist.h> +#include<tqptrlist.h> +#include<tqtimer.h> +#include<tqguardedptr.h> +#include<tqsocketdevice.h> +#include<tqsocketnotifier.h> #ifdef Q_OS_UNIX #include<sys/types.h> @@ -49,20 +49,20 @@ //---------------------------------------------------------------------------- // SocksUDP //---------------------------------------------------------------------------- -static QByteArray sp_create_udp(const QString &host, Q_UINT16 port, const QByteArray &buf) +static TQByteArray sp_create_udp(const TQString &host, Q_UINT16 port, const TQByteArray &buf) { // detect for IP addresses - //QHostAddress addr; + //TQHostAddress addr; //if(addr.setAddress(host)) // return sp_set_request(addr, port, cmd1); - QCString h = host.utf8(); + TQCString h = host.utf8(); h.truncate(255); - h = QString::fromUtf8(h).utf8(); // delete any partial characters? + h = TQString::fromUtf8(h).utf8(); // delete any partial characters? int hlen = h.length(); int at = 0; - QByteArray a(4); + TQByteArray a(4); a[at++] = 0x00; // reserved a[at++] = 0x00; // reserved a[at++] = 0x00; // frag @@ -88,19 +88,19 @@ static QByteArray sp_create_udp(const QString &host, Q_UINT16 port, const QByteA struct SPS_UDP { - QString host; + TQString host; Q_UINT16 port; - QByteArray data; + TQByteArray data; }; -static int sp_read_udp(QByteArray *from, SPS_UDP *s) +static int sp_read_udp(TQByteArray *from, SPS_UDP *s) { int full_len = 4; if((int)from->size() < full_len) return 0; - QString host; - QHostAddress addr; + TQString host; + TQHostAddress addr; unsigned char atype = from->at(3); if(atype == 0x01) { @@ -120,9 +120,9 @@ static int sp_read_udp(QByteArray *from, SPS_UDP *s) full_len += host_len; if((int)from->size() < full_len) return 0; - QCString cs(host_len+1); + TQCString cs(host_len+1); memcpy(cs.data(), from->data() + 5, host_len); - host = QString::fromLatin1(cs); + host = TQString::fromLatin1(cs); } else if(atype == 0x04) { full_len += 16; @@ -152,24 +152,24 @@ static int sp_read_udp(QByteArray *from, SPS_UDP *s) class SocksUDP::Private { public: - QSocketDevice *sd; - QSocketNotifier *sn; + TQSocketDevice *sd; + TQSocketNotifier *sn; SocksClient *sc; - QHostAddress routeAddr; + TQHostAddress routeAddr; int routePort; - QString host; + TQString host; int port; }; -SocksUDP::SocksUDP(SocksClient *sc, const QString &host, int port, const QHostAddress &routeAddr, int routePort) -:QObject(sc) +SocksUDP::SocksUDP(SocksClient *sc, const TQString &host, int port, const TQHostAddress &routeAddr, int routePort) +:TQObject(sc) { d = new Private; d->sc = sc; - d->sd = new QSocketDevice(QSocketDevice::Datagram); + d->sd = new TQSocketDevice(TQSocketDevice::Datagram); d->sd->setBlocking(false); - d->sn = new QSocketNotifier(d->sd->socket(), QSocketNotifier::Read); - connect(d->sn, SIGNAL(activated(int)), SLOT(sn_activated(int))); + d->sn = new TQSocketNotifier(d->sd->socket(), TQSocketNotifier::Read); + connect(d->sn, TQT_SIGNAL(activated(int)), TQT_SLOT(sn_activated(int))); d->host = host; d->port = port; d->routeAddr = routeAddr; @@ -183,15 +183,15 @@ SocksUDP::~SocksUDP() delete d; } -void SocksUDP::change(const QString &host, int port) +void SocksUDP::change(const TQString &host, int port) { d->host = host; d->port = port; } -void SocksUDP::write(const QByteArray &data) +void SocksUDP::write(const TQByteArray &data) { - QByteArray buf = sp_create_udp(d->host, d->port, data); + TQByteArray buf = sp_create_udp(d->host, d->port, data); d->sd->setBlocking(true); d->sd->writeBlock(buf.data(), buf.size(), d->routeAddr, d->routePort); d->sd->setBlocking(false); @@ -199,7 +199,7 @@ void SocksUDP::write(const QByteArray &data) void SocksUDP::sn_activated(int) { - QByteArray buf(8192); + TQByteArray buf(8192); int actual = d->sd->readBlock(buf.data(), buf.size()); buf.resize(actual); packetReady(buf); @@ -222,9 +222,9 @@ void SocksUDP::sn_activated(int) // SPSS = socks packet server struct // Version -static QByteArray spc_set_version() +static TQByteArray spc_set_version() { - QByteArray ver(4); + TQByteArray ver(4); ver[0] = 0x05; // socks version 5 ver[1] = 0x02; // number of methods ver[2] = 0x00; // no-auth @@ -232,9 +232,9 @@ static QByteArray spc_set_version() return ver; } -static QByteArray sps_set_version(int method) +static TQByteArray sps_set_version(int method) { - QByteArray ver(2); + TQByteArray ver(2); ver[0] = 0x05; ver[1] = method; return ver; @@ -243,10 +243,10 @@ static QByteArray sps_set_version(int method) struct SPCS_VERSION { unsigned char version; - QByteArray methodList; + TQByteArray methodList; }; -static int spc_get_version(QByteArray *from, SPCS_VERSION *s) +static int spc_get_version(TQByteArray *from, SPCS_VERSION *s) { if(from->size() < 1) return 0; @@ -259,7 +259,7 @@ static int spc_get_version(QByteArray *from, SPCS_VERSION *s) return -1; if(from->size() < 2 + num) return 0; - QByteArray a = ByteStream::takeArray(from, 2+num); + TQByteArray a = ByteStream::takeArray(from, 2+num); s->version = a[0]; s->methodList.resize(num); memcpy(s->methodList.data(), a.data() + 2, num); @@ -272,18 +272,18 @@ struct SPSS_VERSION unsigned char method; }; -static int sps_get_version(QByteArray *from, SPSS_VERSION *s) +static int sps_get_version(TQByteArray *from, SPSS_VERSION *s) { if(from->size() < 2) return 0; - QByteArray a = ByteStream::takeArray(from, 2); + TQByteArray a = ByteStream::takeArray(from, 2); s->version = a[0]; s->method = a[1]; return 1; } // authUsername -static QByteArray spc_set_authUsername(const QCString &user, const QCString &pass) +static TQByteArray spc_set_authUsername(const TQCString &user, const TQCString &pass) { int len1 = user.length(); int len2 = pass.length(); @@ -291,7 +291,7 @@ static QByteArray spc_set_authUsername(const QCString &user, const QCString &pas len1 = 255; if(len2 > 255) len2 = 255; - QByteArray a(1+1+len1+1+len2); + TQByteArray a(1+1+len1+1+len2); a[0] = 0x01; // username auth version 1 a[1] = len1; memcpy(a.data() + 2, user.data(), len1); @@ -300,9 +300,9 @@ static QByteArray spc_set_authUsername(const QCString &user, const QCString &pas return a; } -static QByteArray sps_set_authUsername(bool success) +static TQByteArray sps_set_authUsername(bool success) { - QByteArray a(2); + TQByteArray a(2); a[0] = 0x01; a[1] = success ? 0x00 : 0xff; return a; @@ -310,10 +310,10 @@ static QByteArray sps_set_authUsername(bool success) struct SPCS_AUTHUSERNAME { - QString user, pass; + TQString user, pass; }; -static int spc_get_authUsername(QByteArray *from, SPCS_AUTHUSERNAME *s) +static int spc_get_authUsername(TQByteArray *from, SPCS_AUTHUSERNAME *s) { if(from->size() < 1) return 0; @@ -328,15 +328,15 @@ static int spc_get_authUsername(QByteArray *from, SPCS_AUTHUSERNAME *s) unsigned char plen = from->at(ulen+2); if((int)from->size() < ulen + plen + 3) return 0; - QByteArray a = ByteStream::takeArray(from, ulen + plen + 3); + TQByteArray a = ByteStream::takeArray(from, ulen + plen + 3); - QCString user, pass; + TQCString user, pass; user.resize(ulen+1); pass.resize(plen+1); memcpy(user.data(), a.data()+2, ulen); memcpy(pass.data(), a.data()+ulen+3, plen); - s->user = QString::fromUtf8(user); - s->pass = QString::fromUtf8(pass); + s->user = TQString::fromUtf8(user); + s->pass = TQString::fromUtf8(pass); return 1; } @@ -346,21 +346,21 @@ struct SPSS_AUTHUSERNAME bool success; }; -static int sps_get_authUsername(QByteArray *from, SPSS_AUTHUSERNAME *s) +static int sps_get_authUsername(TQByteArray *from, SPSS_AUTHUSERNAME *s) { if(from->size() < 2) return 0; - QByteArray a = ByteStream::takeArray(from, 2); + TQByteArray a = ByteStream::takeArray(from, 2); s->version = a[0]; s->success = a[1] == 0 ? true: false; return 1; } // connectRequest -static QByteArray sp_set_request(const QHostAddress &addr, unsigned short port, unsigned char cmd1) +static TQByteArray sp_set_request(const TQHostAddress &addr, unsigned short port, unsigned char cmd1) { int at = 0; - QByteArray a(4); + TQByteArray a(4); a[at++] = 0x05; // socks version 5 a[at++] = cmd1; a[at++] = 0x00; // reserved @@ -374,11 +374,11 @@ static QByteArray sp_set_request(const QHostAddress &addr, unsigned short port, else { a[at++] = 0x04; Q_UINT8 a6[16]; - QStringList s6 = QStringList::split(':', addr.toString(), true); + TQStringList s6 = TQStringList::split(':', addr.toString(), true); int at = 0; Q_UINT16 c; bool ok; - for(QStringList::ConstIterator it = s6.begin(); it != s6.end(); ++it) { + for(TQStringList::ConstIterator it = s6.begin(); it != s6.end(); ++it) { c = (*it).toInt(&ok, 16); a6[at++] = (c >> 8); a6[at++] = c & 0xff; @@ -396,20 +396,20 @@ static QByteArray sp_set_request(const QHostAddress &addr, unsigned short port, return a; } -static QByteArray sp_set_request(const QString &host, Q_UINT16 port, unsigned char cmd1) +static TQByteArray sp_set_request(const TQString &host, Q_UINT16 port, unsigned char cmd1) { // detect for IP addresses - QHostAddress addr; + TQHostAddress addr; if(addr.setAddress(host)) return sp_set_request(addr, port, cmd1); - QCString h = host.utf8(); + TQCString h = host.utf8(); h.truncate(255); - h = QString::fromUtf8(h).utf8(); // delete any partial characters? + h = TQString::fromUtf8(h).utf8(); // delete any partial characters? int hlen = h.length(); int at = 0; - QByteArray a(4); + TQByteArray a(4); a[at++] = 0x05; // socks version 5 a[at++] = cmd1; a[at++] = 0x00; // reserved @@ -434,19 +434,19 @@ struct SPS_CONNREQ unsigned char version; unsigned char cmd; int address_type; - QString host; - QHostAddress addr; + TQString host; + TQHostAddress addr; Q_UINT16 port; }; -static int sp_get_request(QByteArray *from, SPS_CONNREQ *s) +static int sp_get_request(TQByteArray *from, SPS_CONNREQ *s) { int full_len = 4; if((int)from->size() < full_len) return 0; - QString host; - QHostAddress addr; + TQString host; + TQHostAddress addr; unsigned char atype = from->at(3); if(atype == 0x01) { @@ -465,9 +465,9 @@ static int sp_get_request(QByteArray *from, SPS_CONNREQ *s) full_len += host_len; if((int)from->size() < full_len) return 0; - QCString cs(host_len+1); + TQCString cs(host_len+1); memcpy(cs.data(), from->data() + 5, host_len); - host = QString::fromLatin1(cs); + host = TQString::fromLatin1(cs); } else if(atype == 0x04) { full_len += 16; @@ -482,7 +482,7 @@ static int sp_get_request(QByteArray *from, SPS_CONNREQ *s) if((int)from->size() < full_len) return 0; - QByteArray a = ByteStream::takeArray(from, full_len); + TQByteArray a = ByteStream::takeArray(from, full_len); Q_UINT16 p; memcpy(&p, a.data() + full_len - 2, 2); @@ -505,29 +505,29 @@ public: Private() {} BSocket sock; - QString host; + TQString host; int port; - QString user, pass; - QString real_host; + TQString user, pass; + TQString real_host; int real_port; - QByteArray recvBuf; + TQByteArray recvBuf; bool active; int step; int authMethod; bool incoming, waiting; - QString rhost; + TQString rhost; int rport; int pending; bool udp; - QString udpAddr; + TQString udpAddr; int udpPort; }; -SocksClient::SocksClient(QObject *parent) +SocksClient::SocksClient(TQObject *parent) :ByteStream(parent) { init(); @@ -535,7 +535,7 @@ SocksClient::SocksClient(QObject *parent) d->incoming = false; } -SocksClient::SocksClient(int s, QObject *parent) +SocksClient::SocksClient(int s, TQObject *parent) :ByteStream(parent) { init(); @@ -548,12 +548,12 @@ SocksClient::SocksClient(int s, QObject *parent) void SocksClient::init() { d = new Private; - connect(&d->sock, SIGNAL(connected()), SLOT(sock_connected())); - connect(&d->sock, SIGNAL(connectionClosed()), SLOT(sock_connectionClosed())); - connect(&d->sock, SIGNAL(delayedCloseFinished()), SLOT(sock_delayedCloseFinished())); - connect(&d->sock, SIGNAL(readyRead()), SLOT(sock_readyRead())); - connect(&d->sock, SIGNAL(bytesWritten(int)), SLOT(sock_bytesWritten(int))); - connect(&d->sock, SIGNAL(error(int)), SLOT(sock_error(int))); + connect(&d->sock, TQT_SIGNAL(connected()), TQT_SLOT(sock_connected())); + connect(&d->sock, TQT_SIGNAL(connectionClosed()), TQT_SLOT(sock_connectionClosed())); + connect(&d->sock, TQT_SIGNAL(delayedCloseFinished()), TQT_SLOT(sock_delayedCloseFinished())); + connect(&d->sock, TQT_SIGNAL(readyRead()), TQT_SLOT(sock_readyRead())); + connect(&d->sock, TQT_SIGNAL(bytesWritten(int)), TQT_SLOT(sock_bytesWritten(int))); + connect(&d->sock, TQT_SIGNAL(error(int)), TQT_SLOT(sock_error(int))); reset(true); } @@ -582,13 +582,13 @@ bool SocksClient::isIncoming() const return d->incoming; } -void SocksClient::setAuth(const QString &user, const QString &pass) +void SocksClient::setAuth(const TQString &user, const TQString &pass) { d->user = user; d->pass = pass; } -void SocksClient::connectToHost(const QString &proxyHost, int proxyPort, const QString &host, int port, bool udpMode) +void SocksClient::connectToHost(const TQString &proxyHost, int proxyPort, const TQString &host, int port, bool udpMode) { reset(true); @@ -620,19 +620,19 @@ void SocksClient::close() reset(); } -void SocksClient::writeData(const QByteArray &buf) +void SocksClient::writeData(const TQByteArray &buf) { d->pending += buf.size(); d->sock.write(buf); } -void SocksClient::write(const QByteArray &buf) +void SocksClient::write(const TQByteArray &buf) { if(d->active && !d->udp) d->sock.write(buf); } -QByteArray SocksClient::read(int bytes) +TQByteArray SocksClient::read(int bytes) { return ByteStream::read(bytes); } @@ -681,7 +681,7 @@ void SocksClient::sock_delayedCloseFinished() void SocksClient::sock_readyRead() { - QByteArray block = d->sock.read(); + TQByteArray block = d->sock.read(); if(!d->active) { if(d->incoming) @@ -697,7 +697,7 @@ void SocksClient::sock_readyRead() } } -void SocksClient::processOutgoing(const QByteArray &block) +void SocksClient::processOutgoing(const TQByteArray &block) { #ifdef PROX_DEBUG // show hex @@ -726,7 +726,7 @@ void SocksClient::processOutgoing(const QByteArray &block) return; } - QString str; + TQString str; if(s.method == 0x00) { str = "None"; d->authMethod = AuthNone; @@ -818,7 +818,7 @@ void SocksClient::processOutgoing(const QByteArray &block) d->active = true; - QGuardedPtr<QObject> self = this; + TQGuardedPtr<TQObject> self = this; connected(); if(!self) return; @@ -839,11 +839,11 @@ void SocksClient::do_request() #endif d->step = StepRequest; int cmd = d->udp ? REQ_UDPASSOCIATE : REQ_CONNECT; - QByteArray buf; + TQByteArray buf; if(!d->real_host.isEmpty()) buf = sp_set_request(d->real_host, d->real_port, cmd); else - buf = sp_set_request(QHostAddress(), 0, cmd); + buf = sp_set_request(TQHostAddress(), 0, cmd); writeData(buf); } @@ -886,7 +886,7 @@ void SocksClient::serve() continueIncoming(); } -void SocksClient::processIncoming(const QByteArray &block) +void SocksClient::processIncoming(const TQByteArray &block) { #ifdef PROX_DEBUG // show hex @@ -1045,7 +1045,7 @@ void SocksClient::grantConnect() } } -void SocksClient::grantUDPAssociate(const QString &relayHost, int relayPort) +void SocksClient::grantUDPAssociate(const TQString &relayHost, int relayPort) { if(d->step != StepRequest || !d->waiting) return; @@ -1063,7 +1063,7 @@ void SocksClient::grantUDPAssociate(const QString &relayHost, int relayPort) d->recvBuf.resize(0); } -QHostAddress SocksClient::peerAddress() const +TQHostAddress SocksClient::peerAddress() const { return d->sock.peerAddress(); } @@ -1073,7 +1073,7 @@ Q_UINT16 SocksClient::peerPort() const return d->sock.peerPort(); } -QString SocksClient::udpAddress() const +TQString SocksClient::udpAddress() const { return d->udpAddr; } @@ -1083,7 +1083,7 @@ Q_UINT16 SocksClient::udpPort() const return d->udpPort; } -SocksUDP *SocksClient::createUDP(const QString &host, int port, const QHostAddress &routeAddr, int routePort) +SocksUDP *SocksClient::createUDP(const TQString &host, int port, const TQHostAddress &routeAddr, int routePort) { return new SocksUDP(this, host, port, routeAddr, routePort); } @@ -1097,18 +1097,18 @@ public: Private() {} ServSock serv; - QPtrList<SocksClient> incomingConns; - QSocketDevice *sd; - QSocketNotifier *sn; + TQPtrList<SocksClient> incomingConns; + TQSocketDevice *sd; + TQSocketNotifier *sn; }; -SocksServer::SocksServer(QObject *parent) -:QObject(parent) +SocksServer::SocksServer(TQObject *parent) +:TQObject(parent) { d = new Private; d->sd = 0; d->sn = 0; - connect(&d->serv, SIGNAL(connectionReady(int)), SLOT(connectionReady(int))); + connect(&d->serv, TQT_SIGNAL(connectionReady(int)), TQT_SLOT(connectionReady(int))); } SocksServer::~SocksServer() @@ -1130,16 +1130,16 @@ bool SocksServer::listen(Q_UINT16 port, bool udp) if(!d->serv.listen(port)) return false; if(udp) { - d->sd = new QSocketDevice(QSocketDevice::Datagram); + d->sd = new TQSocketDevice(TQSocketDevice::Datagram); d->sd->setBlocking(false); - if(!d->sd->bind(QHostAddress(), port)) { + if(!d->sd->bind(TQHostAddress(), port)) { delete d->sd; d->sd = 0; d->serv.stop(); return false; } - d->sn = new QSocketNotifier(d->sd->socket(), QSocketNotifier::Read); - connect(d->sn, SIGNAL(activated(int)), SLOT(sn_activated(int))); + d->sn = new TQSocketNotifier(d->sd->socket(), TQSocketNotifier::Read); + connect(d->sn, TQT_SIGNAL(activated(int)), TQT_SLOT(sn_activated(int))); } return true; } @@ -1158,7 +1158,7 @@ int SocksServer::port() const return d->serv.port(); } -QHostAddress SocksServer::address() const +TQHostAddress SocksServer::address() const { return d->serv.address(); } @@ -1172,15 +1172,15 @@ SocksClient *SocksServer::takeIncoming() d->incomingConns.removeRef(c); // we don't care about errors anymore - disconnect(c, SIGNAL(error(int)), this, SLOT(connectionError())); + disconnect(c, TQT_SIGNAL(error(int)), this, TQT_SLOT(connectionError())); // don't serve the connection until the event loop, to give the caller a chance to map signals - QTimer::singleShot(0, c, SLOT(serve())); + TQTimer::singleShot(0, c, TQT_SLOT(serve())); return c; } -void SocksServer::writeUDP(const QHostAddress &addr, int port, const QByteArray &data) +void SocksServer::writeUDP(const TQHostAddress &addr, int port, const TQByteArray &data) { if(d->sd) { d->sd->setBlocking(true); @@ -1192,7 +1192,7 @@ void SocksServer::writeUDP(const QHostAddress &addr, int port, const QByteArray void SocksServer::connectionReady(int s) { SocksClient *c = new SocksClient(s, this); - connect(c, SIGNAL(error(int)), this, SLOT(connectionError())); + connect(c, TQT_SIGNAL(error(int)), this, TQT_SLOT(connectionError())); d->incomingConns.append(c); incomingReady(); } @@ -1206,10 +1206,10 @@ void SocksServer::connectionError() void SocksServer::sn_activated(int) { - QByteArray buf(8192); + TQByteArray buf(8192); int actual = d->sd->readBlock(buf.data(), buf.size()); buf.resize(actual); - QHostAddress pa = d->sd->peerAddress(); + TQHostAddress pa = d->sd->peerAddress(); int pp = d->sd->peerPort(); SPS_UDP s; int r = sp_read_udp(&buf, &s); diff --git a/kopete/protocols/jabber/libiris/cutestuff/network/socks.h b/kopete/protocols/jabber/libiris/cutestuff/network/socks.h index b10361dd..507caf5f 100644 --- a/kopete/protocols/jabber/libiris/cutestuff/network/socks.h +++ b/kopete/protocols/jabber/libiris/cutestuff/network/socks.h @@ -35,11 +35,11 @@ class SocksUDP : public QObject public: ~SocksUDP(); - void change(const QString &host, int port); - void write(const QByteArray &data); + void change(const TQString &host, int port); + void write(const TQByteArray &data); signals: - void packetReady(const QByteArray &data); + void packetReady(const TQByteArray &data); private slots: void sn_activated(int); @@ -49,7 +49,7 @@ private: Private *d; friend class SocksClient; - SocksUDP(SocksClient *sc, const QString &host, int port, const QHostAddress &routeAddr, int routePort); + SocksUDP(SocksClient *sc, const TQString &host, int port, const TQHostAddress &routeAddr, int routePort); }; class SocksClient : public ByteStream @@ -59,39 +59,39 @@ public: enum Error { ErrConnectionRefused = ErrCustom, ErrHostNotFound, ErrProxyConnect, ErrProxyNeg, ErrProxyAuth }; enum Method { AuthNone=0x0001, AuthUsername=0x0002 }; enum Request { ReqConnect, ReqUDPAssociate }; - SocksClient(QObject *parent=0); - SocksClient(int, QObject *parent=0); + SocksClient(TQObject *parent=0); + SocksClient(int, TQObject *parent=0); ~SocksClient(); bool isIncoming() const; // outgoing - void setAuth(const QString &user, const QString &pass=""); - void connectToHost(const QString &proxyHost, int proxyPort, const QString &host, int port, bool udpMode=false); + void setAuth(const TQString &user, const TQString &pass=""); + void connectToHost(const TQString &proxyHost, int proxyPort, const TQString &host, int port, bool udpMode=false); // incoming void chooseMethod(int); void authGrant(bool); void requestDeny(); void grantConnect(); - void grantUDPAssociate(const QString &relayHost, int relayPort); + void grantUDPAssociate(const TQString &relayHost, int relayPort); // from ByteStream bool isOpen() const; void close(); - void write(const QByteArray &); - QByteArray read(int bytes=0); + void write(const TQByteArray &); + TQByteArray read(int bytes=0); int bytesAvailable() const; int bytesToWrite() const; // remote address - QHostAddress peerAddress() const; + TQHostAddress peerAddress() const; Q_UINT16 peerPort() const; // udp - QString udpAddress() const; + TQString udpAddress() const; Q_UINT16 udpPort() const; - SocksUDP *createUDP(const QString &host, int port, const QHostAddress &routeAddr, int routePort); + SocksUDP *createUDP(const TQString &host, int port, const TQHostAddress &routeAddr, int routePort); signals: // outgoing @@ -99,8 +99,8 @@ signals: // incoming void incomingMethods(int); - void incomingAuth(const QString &user, const QString &pass); - void incomingConnectRequest(const QString &host, int port); + void incomingAuth(const TQString &user, const TQString &pass); + void incomingConnectRequest(const TQString &host, int port); void incomingUDPAssociateRequest(); private slots: @@ -119,31 +119,31 @@ private: void init(); void reset(bool clear=false); void do_request(); - void processOutgoing(const QByteArray &); - void processIncoming(const QByteArray &); + void processOutgoing(const TQByteArray &); + void processIncoming(const TQByteArray &); void continueIncoming(); - void writeData(const QByteArray &a); + void writeData(const TQByteArray &a); }; class SocksServer : public QObject { Q_OBJECT public: - SocksServer(QObject *parent=0); + SocksServer(TQObject *parent=0); ~SocksServer(); bool isActive() const; bool listen(Q_UINT16 port, bool udp=false); void stop(); int port() const; - QHostAddress address() const; + TQHostAddress address() const; SocksClient *takeIncoming(); - void writeUDP(const QHostAddress &addr, int port, const QByteArray &data); + void writeUDP(const TQHostAddress &addr, int port, const TQByteArray &data); signals: void incomingReady(); - void incomingUDP(const QString &host, int port, const QHostAddress &addr, int sourcePort, const QByteArray &data); + void incomingUDP(const TQString &host, int port, const TQHostAddress &addr, int sourcePort, const TQByteArray &data); private slots: void connectionReady(int); diff --git a/kopete/protocols/jabber/libiris/cutestuff/network/srvresolver.cpp b/kopete/protocols/jabber/libiris/cutestuff/network/srvresolver.cpp index 851873f2..d462a17e 100644 --- a/kopete/protocols/jabber/libiris/cutestuff/network/srvresolver.cpp +++ b/kopete/protocols/jabber/libiris/cutestuff/network/srvresolver.cpp @@ -20,9 +20,9 @@ #include"srvresolver.h" -#include<qcstring.h> -#include<qtimer.h> -#include<qdns.h> +#include<tqcstring.h> +#include<tqtimer.h> +#include<tqdns.h> #include"safedelete.h" #ifndef NO_NDNS @@ -31,14 +31,14 @@ // CS_NAMESPACE_BEGIN -static void sortSRVList(QValueList<QDns::Server> &list) +static void sortSRVList(TQValueList<TQDns::Server> &list) { - QValueList<QDns::Server> tmp = list; + TQValueList<TQDns::Server> tmp = list; list.clear(); while(!tmp.isEmpty()) { - QValueList<QDns::Server>::Iterator p = tmp.end(); - for(QValueList<QDns::Server>::Iterator it = tmp.begin(); it != tmp.end(); ++it) { + TQValueList<TQDns::Server>::Iterator p = tmp.end(); + for(TQValueList<TQDns::Server>::Iterator it = tmp.begin(); it != tmp.end(); ++it) { if(p == tmp.end()) p = it; else { @@ -60,34 +60,34 @@ class SrvResolver::Private public: Private() {} - QDns *qdns; + TQDns *qdns; #ifndef NO_NDNS NDns ndns; #endif bool failed; - QHostAddress resultAddress; + TQHostAddress resultAddress; Q_UINT16 resultPort; bool srvonly; - QString srv; - QValueList<QDns::Server> servers; + TQString srv; + TQValueList<TQDns::Server> servers; bool aaaa; - QTimer t; + TQTimer t; SafeDelete sd; }; -SrvResolver::SrvResolver(QObject *parent) -:QObject(parent) +SrvResolver::SrvResolver(TQObject *parent) +:TQObject(parent) { d = new Private; d->qdns = 0; #ifndef NO_NDNS - connect(&d->ndns, SIGNAL(resultsReady()), SLOT(ndns_done())); + connect(&d->ndns, TQT_SIGNAL(resultsReady()), TQT_SLOT(ndns_done())); #endif - connect(&d->t, SIGNAL(timeout()), SLOT(t_timeout())); + connect(&d->t, TQT_SIGNAL(timeout()), TQT_SLOT(t_timeout())); stop(); } @@ -97,31 +97,31 @@ SrvResolver::~SrvResolver() delete d; } -void SrvResolver::resolve(const QString &server, const QString &type, const QString &proto) +void SrvResolver::resolve(const TQString &server, const TQString &type, const TQString &proto) { stop(); d->failed = false; d->srvonly = false; - d->srv = QString("_") + type + "._" + proto + '.' + server; + d->srv = TQString("_") + type + "._" + proto + '.' + server; d->t.start(15000, true); d->qdns = new QDns; - connect(d->qdns, SIGNAL(resultsReady()), SLOT(qdns_done())); - d->qdns->setRecordType(QDns::Srv); + connect(d->qdns, TQT_SIGNAL(resultsReady()), TQT_SLOT(qdns_done())); + d->qdns->setRecordType(TQDns::Srv); d->qdns->setLabel(d->srv); } -void SrvResolver::resolveSrvOnly(const QString &server, const QString &type, const QString &proto) +void SrvResolver::resolveSrvOnly(const TQString &server, const TQString &type, const TQString &proto) { stop(); d->failed = false; d->srvonly = true; - d->srv = QString("_") + type + "._" + proto + '.' + server; + d->srv = TQString("_") + type + "._" + proto + '.' + server; d->t.start(15000, true); d->qdns = new QDns; - connect(d->qdns, SIGNAL(resultsReady()), SLOT(qdns_done())); - d->qdns->setRecordType(QDns::Srv); + connect(d->qdns, TQT_SIGNAL(resultsReady()), TQT_SLOT(qdns_done())); + d->qdns->setRecordType(TQDns::Srv); d->qdns->setLabel(d->srv); } @@ -146,7 +146,7 @@ void SrvResolver::stop() if(d->ndns.isBusy()) d->ndns.stop(); #endif - d->resultAddress = QHostAddress(); + d->resultAddress = TQHostAddress(); d->resultPort = 0; d->servers.clear(); d->srv = ""; @@ -165,7 +165,7 @@ bool SrvResolver::isBusy() const return false; } -QValueList<QDns::Server> SrvResolver::servers() const +TQValueList<TQDns::Server> SrvResolver::servers() const { return d->servers; } @@ -175,7 +175,7 @@ bool SrvResolver::failed() const return d->failed; } -QHostAddress SrvResolver::resultAddress() const +TQHostAddress SrvResolver::resultAddress() const { return d->resultAddress; } @@ -191,11 +191,11 @@ void SrvResolver::tryNext() d->ndns.resolve(d->servers.first().name); #else d->qdns = new QDns; - connect(d->qdns, SIGNAL(resultsReady()), SLOT(ndns_done())); + connect(d->qdns, TQT_SIGNAL(resultsReady()), TQT_SLOT(ndns_done())); if(d->aaaa) - d->qdns->setRecordType(QDns::Aaaa); // IPv6 + d->qdns->setRecordType(TQDns::Aaaa); // IPv6 else - d->qdns->setRecordType(QDns::A); // IPv4 + d->qdns->setRecordType(TQDns::A); // IPv4 d->qdns->setLabel(d->servers.first().name); #endif } @@ -213,8 +213,8 @@ void SrvResolver::qdns_done() SafeDeleteLock s(&d->sd); // grab the server list and destroy the qdns object - QValueList<QDns::Server> list; - if(d->qdns->recordType() == QDns::Srv) + TQValueList<TQDns::Server> list; + if(d->qdns->recordType() == TQDns::Srv) list = d->qdns->servers(); d->qdns->disconnect(this); d->sd.deleteLater(d->qdns); @@ -247,7 +247,7 @@ void SrvResolver::ndns_done() d->servers.remove(d->servers.begin()); if(r) { - d->resultAddress = QHostAddress(d->ndns.result()); + d->resultAddress = TQHostAddress(d->ndns.result()); d->resultPort = port; resultsReady(); } @@ -273,8 +273,8 @@ void SrvResolver::ndns_done() SafeDeleteLock s(&d->sd); // grab the address list and destroy the qdns object - QValueList<QHostAddress> list; - if(d->qdns->recordType() == QDns::A || d->qdns->recordType() == QDns::Aaaa) + TQValueList<TQHostAddress> list; + if(d->qdns->recordType() == TQDns::A || d->qdns->recordType() == TQDns::Aaaa) list = d->qdns->addresses(); d->qdns->disconnect(this); d->sd.deleteLater(d->qdns); diff --git a/kopete/protocols/jabber/libiris/cutestuff/network/srvresolver.h b/kopete/protocols/jabber/libiris/cutestuff/network/srvresolver.h index fb5aa2b1..400639c1 100644 --- a/kopete/protocols/jabber/libiris/cutestuff/network/srvresolver.h +++ b/kopete/protocols/jabber/libiris/cutestuff/network/srvresolver.h @@ -21,8 +21,8 @@ #ifndef CS_SRVRESOLVER_H #define CS_SRVRESOLVER_H -#include<qvaluelist.h> -#include<qdns.h> +#include<tqvaluelist.h> +#include<tqdns.h> // CS_NAMESPACE_BEGIN @@ -30,19 +30,19 @@ class SrvResolver : public QObject { Q_OBJECT public: - SrvResolver(QObject *parent=0); + SrvResolver(TQObject *parent=0); ~SrvResolver(); - void resolve(const QString &server, const QString &type, const QString &proto); - void resolveSrvOnly(const QString &server, const QString &type, const QString &proto); + void resolve(const TQString &server, const TQString &type, const TQString &proto); + void resolveSrvOnly(const TQString &server, const TQString &type, const TQString &proto); void next(); void stop(); bool isBusy() const; - QValueList<QDns::Server> servers() const; + TQValueList<TQDns::Server> servers() const; bool failed() const; - QHostAddress resultAddress() const; + TQHostAddress resultAddress() const; Q_UINT16 resultPort() const; signals: |