From 69cac65817d949cda2672ec4f0aa73d5e66a0ba1 Mon Sep 17 00:00:00 2001 From: tpearson Date: Wed, 22 Jun 2011 00:30:31 +0000 Subject: TQt4 port kdenetwork This enables compilation under both Qt3 and Qt4 git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1237912 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- .../jabber/libiris/cutestuff/network/socks.cpp | 60 +++++++++++----------- 1 file changed, 30 insertions(+), 30 deletions(-) (limited to 'kopete/protocols/jabber/libiris/cutestuff/network/socks.cpp') diff --git a/kopete/protocols/jabber/libiris/cutestuff/network/socks.cpp b/kopete/protocols/jabber/libiris/cutestuff/network/socks.cpp index 59504170..7948dcd7 100644 --- a/kopete/protocols/jabber/libiris/cutestuff/network/socks.cpp +++ b/kopete/protocols/jabber/libiris/cutestuff/network/socks.cpp @@ -49,7 +49,7 @@ //---------------------------------------------------------------------------- // SocksUDP //---------------------------------------------------------------------------- -static TQByteArray sp_create_udp(const TQString &host, Q_UINT16 port, const TQByteArray &buf) +static TQByteArray sp_create_udp(const TQString &host, TQ_UINT16 port, const TQByteArray &buf) { // detect for IP addresses //TQHostAddress addr; @@ -89,7 +89,7 @@ static TQByteArray sp_create_udp(const TQString &host, Q_UINT16 port, const TQBy struct SPS_UDP { TQString host; - Q_UINT16 port; + TQ_UINT16 port; TQByteArray data; }; @@ -107,7 +107,7 @@ static int sp_read_udp(TQByteArray *from, SPS_UDP *s) full_len += 4; if((int)from->size() < full_len) return 0; - Q_UINT32 ip4; + TQ_UINT32 ip4; memcpy(&ip4, from->data() + 4, 4); addr.setAddress(ntohl(ip4)); host = addr.toString(); @@ -122,13 +122,13 @@ static int sp_read_udp(TQByteArray *from, SPS_UDP *s) return 0; TQCString cs(host_len+1); memcpy(cs.data(), from->data() + 5, host_len); - host = TQString::fromLatin1(cs); + host = TQString::tqfromLatin1(cs); } else if(atype == 0x04) { full_len += 16; if((int)from->size() < full_len) return 0; - Q_UINT8 a6[16]; + TQ_UINT8 a6[16]; memcpy(a6, from->data() + 4, 16); addr.setAddress(a6); host = addr.toString(); @@ -138,7 +138,7 @@ static int sp_read_udp(TQByteArray *from, SPS_UDP *s) if((int)from->size() < full_len) return 0; - Q_UINT16 p; + TQ_UINT16 p; memcpy(&p, from->data() + full_len - 2, 2); s->host = host; @@ -208,9 +208,9 @@ void SocksUDP::sn_activated(int) //---------------------------------------------------------------------------- // SocksClient //---------------------------------------------------------------------------- -#define REQ_CONNECT 0x01 -#define REQ_BIND 0x02 -#define REQ_UDPASSOCIATE 0x03 +#define RETQ_CONNECT 0x01 +#define RETQ_BIND 0x02 +#define RETQ_UDPASSOCIATE 0x03 #define RET_SUCCESS 0x00 #define RET_UNREACHABLE 0x04 @@ -366,17 +366,17 @@ static TQByteArray sp_set_request(const TQHostAddress &addr, unsigned short port a[at++] = 0x00; // reserved if(addr.isIp4Addr()) { a[at++] = 0x01; // address type = ipv4 - Q_UINT32 ip4 = htonl(addr.ip4Addr()); + TQ_UINT32 ip4 = htonl(addr.ip4Addr()); a.resize(at+4); memcpy(a.data() + at, &ip4, 4); at += 4; } else { a[at++] = 0x04; - Q_UINT8 a6[16]; + TQ_UINT8 a6[16]; TQStringList s6 = TQStringList::split(':', addr.toString(), true); int at = 0; - Q_UINT16 c; + TQ_UINT16 c; bool ok; for(TQStringList::ConstIterator it = s6.begin(); it != s6.end(); ++it) { c = (*it).toInt(&ok, 16); @@ -396,7 +396,7 @@ static TQByteArray sp_set_request(const TQHostAddress &addr, unsigned short port return a; } -static TQByteArray sp_set_request(const TQString &host, Q_UINT16 port, unsigned char cmd1) +static TQByteArray sp_set_request(const TQString &host, TQ_UINT16 port, unsigned char cmd1) { // detect for IP addresses TQHostAddress addr; @@ -436,7 +436,7 @@ struct SPS_CONNREQ int address_type; TQString host; TQHostAddress addr; - Q_UINT16 port; + TQ_UINT16 port; }; static int sp_get_request(TQByteArray *from, SPS_CONNREQ *s) @@ -453,7 +453,7 @@ static int sp_get_request(TQByteArray *from, SPS_CONNREQ *s) full_len += 4; if((int)from->size() < full_len) return 0; - Q_UINT32 ip4; + TQ_UINT32 ip4; memcpy(&ip4, from->data() + 4, 4); addr.setAddress(ntohl(ip4)); } @@ -467,13 +467,13 @@ static int sp_get_request(TQByteArray *from, SPS_CONNREQ *s) return 0; TQCString cs(host_len+1); memcpy(cs.data(), from->data() + 5, host_len); - host = TQString::fromLatin1(cs); + host = TQString::tqfromLatin1(cs); } else if(atype == 0x04) { full_len += 16; if((int)from->size() < full_len) return 0; - Q_UINT8 a6[16]; + TQ_UINT8 a6[16]; memcpy(a6, from->data() + 4, 16); addr.setAddress(a6); } @@ -484,7 +484,7 @@ static int sp_get_request(TQByteArray *from, SPS_CONNREQ *s) TQByteArray a = ByteStream::takeArray(from, full_len); - Q_UINT16 p; + TQ_UINT16 p; memcpy(&p, a.data() + full_len - 2, 2); s->version = a[0]; @@ -527,16 +527,16 @@ public: int udpPort; }; -SocksClient::SocksClient(TQObject *parent) -:ByteStream(parent) +SocksClient::SocksClient(TQObject *tqparent) +:ByteStream(tqparent) { init(); d->incoming = false; } -SocksClient::SocksClient(int s, TQObject *parent) -:ByteStream(parent) +SocksClient::SocksClient(int s, TQObject *tqparent) +:ByteStream(tqparent) { init(); @@ -838,7 +838,7 @@ void SocksClient::do_request() fprintf(stderr, "SocksClient: Requesting ...\n"); #endif d->step = StepRequest; - int cmd = d->udp ? REQ_UDPASSOCIATE : REQ_CONNECT; + int cmd = d->udp ? RETQ_UDPASSOCIATE : RETQ_CONNECT; TQByteArray buf; if(!d->real_host.isEmpty()) buf = sp_set_request(d->real_host, d->real_port, cmd); @@ -956,7 +956,7 @@ void SocksClient::continueIncoming() } else if(r == 1) { d->waiting = true; - if(s.cmd == REQ_CONNECT) { + if(s.cmd == RETQ_CONNECT) { if(!s.host.isEmpty()) d->rhost = s.host; else @@ -964,7 +964,7 @@ void SocksClient::continueIncoming() d->rport = s.port; incomingConnectRequest(d->rhost, d->rport); } - else if(s.cmd == REQ_UDPASSOCIATE) { + else if(s.cmd == RETQ_UDPASSOCIATE) { incomingUDPAssociateRequest(); } else { @@ -1068,7 +1068,7 @@ TQHostAddress SocksClient::peerAddress() const return d->sock.peerAddress(); } -Q_UINT16 SocksClient::peerPort() const +TQ_UINT16 SocksClient::peerPort() const { return d->sock.peerPort(); } @@ -1078,7 +1078,7 @@ TQString SocksClient::udpAddress() const return d->udpAddr; } -Q_UINT16 SocksClient::udpPort() const +TQ_UINT16 SocksClient::udpPort() const { return d->udpPort; } @@ -1102,8 +1102,8 @@ public: TQSocketNotifier *sn; }; -SocksServer::SocksServer(TQObject *parent) -:TQObject(parent) +SocksServer::SocksServer(TQObject *tqparent) +:TQObject(tqparent) { d = new Private; d->sd = 0; @@ -1124,7 +1124,7 @@ bool SocksServer::isActive() const return d->serv.isActive(); } -bool SocksServer::listen(Q_UINT16 port, bool udp) +bool SocksServer::listen(TQ_UINT16 port, bool udp) { stop(); if(!d->serv.listen(port)) -- cgit v1.2.1