summaryrefslogtreecommitdiffstats
path: root/libktorrent/kademlia
diff options
context:
space:
mode:
Diffstat (limited to 'libktorrent/kademlia')
-rw-r--r--libktorrent/kademlia/announcetask.cpp10
-rw-r--r--libktorrent/kademlia/announcetask.h4
-rw-r--r--libktorrent/kademlia/database.cpp12
-rw-r--r--libktorrent/kademlia/database.h10
-rw-r--r--libktorrent/kademlia/dht.cpp22
-rw-r--r--libktorrent/kademlia/dht.h21
-rw-r--r--libktorrent/kademlia/dhtbase.h17
-rw-r--r--libktorrent/kademlia/dhttrackerbackend.cpp18
-rw-r--r--libktorrent/kademlia/dhttrackerbackend.h5
-rw-r--r--libktorrent/kademlia/kbucket.cpp26
-rw-r--r--libktorrent/kademlia/kbucket.h9
-rw-r--r--libktorrent/kademlia/kclosestnodessearch.cpp2
-rw-r--r--libktorrent/kademlia/kclosestnodessearch.h4
-rw-r--r--libktorrent/kademlia/key.cpp4
-rw-r--r--libktorrent/kademlia/key.h6
-rw-r--r--libktorrent/kademlia/node.cpp10
-rw-r--r--libktorrent/kademlia/node.h13
-rw-r--r--libktorrent/kademlia/nodelookup.cpp6
-rw-r--r--libktorrent/kademlia/pack.cpp4
-rw-r--r--libktorrent/kademlia/pack.h4
-rw-r--r--libktorrent/kademlia/rpccall.cpp6
-rw-r--r--libktorrent/kademlia/rpccall.h10
-rw-r--r--libktorrent/kademlia/rpcmsg.cpp134
-rw-r--r--libktorrent/kademlia/rpcmsg.h38
-rw-r--r--libktorrent/kademlia/rpcserver.cpp30
-rw-r--r--libktorrent/kademlia/rpcserver.h11
-rw-r--r--libktorrent/kademlia/task.cpp6
-rw-r--r--libktorrent/kademlia/task.h9
-rw-r--r--libktorrent/kademlia/taskmanager.cpp4
-rw-r--r--libktorrent/kademlia/taskmanager.h4
30 files changed, 234 insertions, 225 deletions
diff --git a/libktorrent/kademlia/announcetask.cpp b/libktorrent/kademlia/announcetask.cpp
index b7350a2..5e5b925 100644
--- a/libktorrent/kademlia/announcetask.cpp
+++ b/libktorrent/kademlia/announcetask.cpp
@@ -52,13 +52,13 @@ namespace dht
if (gpr->containsNodes())
{
- const QByteArray & n = gpr->getData();
+ const TQByteArray & n = gpr->getData();
Uint32 nval = n.size() / 26;
for (Uint32 i = 0;i < nval;i++)
{
// add node to todo list
KBucketEntry e = UnpackBucketEntry(n,i*26);
- if (!todo.contains(e) && !visited.contains(e) &&
+ if (!todo.tqcontains(e) && !visited.tqcontains(e) &&
todo.count() < 100)
{
todo.append(e);
@@ -78,7 +78,7 @@ namespace dht
// add the peer who responded to the answered list, so we can do an announce
KBucketEntry e(rsp->getOrigin(),rsp->getID());
- if (!answered.contains(KBucketEntryAndToken(e,gpr->getToken())) && !answered_visited.contains(e))
+ if (!answered.tqcontains(KBucketEntryAndToken(e,gpr->getToken())) && !answered_visited.tqcontains(e))
{
answered.append(KBucketEntryAndToken(e,gpr->getToken()));
}
@@ -101,7 +101,7 @@ namespace dht
while (!answered.empty() && canDoRequest())
{
KBucketEntryAndToken & e = answered.first();
- if (!answered_visited.contains(e))
+ if (!answered_visited.tqcontains(e))
{
AnnounceReq* anr = new AnnounceReq(node->getOurID(),info_hash,port,e.getToken());
anr->setOrigin(e.getAddress());
@@ -117,7 +117,7 @@ namespace dht
{
KBucketEntry e = todo.first();
// onLy send a findNode if we haven't allrready visited the node
- if (!visited.contains(e))
+ if (!visited.tqcontains(e))
{
// send a findNode to the node
GetPeersReq* gpr = new GetPeersReq(node->getOurID(),info_hash);
diff --git a/libktorrent/kademlia/announcetask.h b/libktorrent/kademlia/announcetask.h
index d6bfa7c..02dec19 100644
--- a/libktorrent/kademlia/announcetask.h
+++ b/libktorrent/kademlia/announcetask.h
@@ -62,8 +62,8 @@ namespace dht
private:
dht::Key info_hash;
bt::Uint16 port;
- QValueList<KBucketEntryAndToken> answered; // nodes which have answered with values
- QValueList<KBucketEntry> answered_visited; // nodes which have answered with values which have been visited
+ TQValueList<KBucketEntryAndToken> answered; // nodes which have answered with values
+ TQValueList<KBucketEntry> answered_visited; // nodes which have answered with values which have been visited
Database* db;
DBItemList returned_items;
diff --git a/libktorrent/kademlia/database.cpp b/libktorrent/kademlia/database.cpp
index 447975f..c4b34fd 100644
--- a/libktorrent/kademlia/database.cpp
+++ b/libktorrent/kademlia/database.cpp
@@ -72,7 +72,7 @@ namespace dht
void Database::store(const dht::Key & key,const DBItem & dbi)
{
- DBItemList* dbl = items.find(key);
+ DBItemList* dbl = items.tqfind(key);
if (!dbl)
{
dbl = new DBItemList();
@@ -83,7 +83,7 @@ namespace dht
void Database::sample(const dht::Key & key,DBItemList & tdbl,bt::Uint32 max_entries)
{
- DBItemList* dbl = items.find(key);
+ DBItemList* dbl = items.tqfind(key);
if (!dbl)
return;
@@ -144,7 +144,7 @@ namespace dht
bool Database::checkToken(const dht::Key & token,Uint32 ip,Uint16 port)
{
// the token must be in the map
- if (!tokens.contains(token))
+ if (!tokens.tqcontains(token))
{
Out(SYS_DHT|LOG_DEBUG) << "Unknown token" << endl;
return false;
@@ -169,14 +169,14 @@ namespace dht
return true;
}
- bool Database::contains(const dht::Key & key) const
+ bool Database::tqcontains(const dht::Key & key) const
{
- return items.find(key) != 0;
+ return items.tqfind(key) != 0;
}
void Database::insert(const dht::Key & key)
{
- DBItemList* dbl = items.find(key);
+ DBItemList* dbl = items.tqfind(key);
if (!dbl)
{
dbl = new DBItemList();
diff --git a/libktorrent/kademlia/database.h b/libktorrent/kademlia/database.h
index 94e6b3f..12e8373 100644
--- a/libktorrent/kademlia/database.h
+++ b/libktorrent/kademlia/database.h
@@ -20,8 +20,8 @@
#ifndef DHTDATABASE_H
#define DHTDATABASE_H
-#include <qmap.h>
-#include <qvaluelist.h>
+#include <tqmap.h>
+#include <tqvaluelist.h>
#include <util/ptrmap.h>
#include <util/constants.h>
#include <util/array.h>
@@ -58,7 +58,7 @@ namespace dht
DBItem & operator = (const DBItem & item);
};
- typedef QValueList<DBItem> DBItemList;
+ typedef TQValueList<DBItem> DBItemList;
/**
* @author Joris Guisson
@@ -68,7 +68,7 @@ namespace dht
class Database
{
bt::PtrMap<dht::Key,DBItemList> items;
- QMap<dht::Key,bt::TimeStamp> tokens;
+ TQMap<dht::Key,bt::TimeStamp> tokens;
public:
Database();
virtual ~Database();
@@ -118,7 +118,7 @@ namespace dht
bool checkToken(const dht::Key & token,bt::Uint32 ip,bt::Uint16 port);
/// Test wether or not the DB contains a key
- bool contains(const dht::Key & key) const;
+ bool tqcontains(const dht::Key & key) const;
/// Insert an empty item (only if it isn't already in the DB)
void insert(const dht::Key & key);
diff --git a/libktorrent/kademlia/dht.cpp b/libktorrent/kademlia/dht.cpp
index 1d00ab8..3eecd7c 100644
--- a/libktorrent/kademlia/dht.cpp
+++ b/libktorrent/kademlia/dht.cpp
@@ -17,7 +17,7 @@
* Free Software Foundation, Inc., *
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
-#include <qmap.h>
+#include <tqmap.h>
#include <kresolver.h>
#include <util/log.h>
#include <util/array.h>
@@ -46,7 +46,7 @@ namespace dht
DHT::DHT() : node(0),srv(0),db(0),tman(0)
{
- connect(&update_timer,SIGNAL(timeout()),this,SLOT(update()));
+ connect(&update_timer,TQT_SIGNAL(timeout()),this,TQT_SLOT(update()));
}
@@ -56,7 +56,7 @@ namespace dht
stop();
}
- void DHT::start(const QString & table,const QString & key_file,bt::Uint16 port)
+ void DHT::start(const TQString & table,const TQString & key_file,bt::Uint16 port)
{
if (running)
return;
@@ -133,7 +133,7 @@ namespace dht
Uint32 rs = kns.requiredSpace();
// create the data
- QByteArray nodes(rs);
+ TQByteArray nodes(rs);
// pack the found nodes in a byte array
if (rs > 0)
kns.pack(nodes);
@@ -198,7 +198,7 @@ namespace dht
node->findKClosestNodes(kns);
Uint32 rs = kns.requiredSpace();
// create the data
- QByteArray nodes(rs);
+ TQByteArray nodes(rs);
// pack the found nodes in a byte array
if (rs > 0)
kns.pack(nodes);
@@ -228,7 +228,7 @@ namespace dht
{}
- void DHT::portRecieved(const QString & ip,bt::Uint16 port)
+ void DHT::portRecieved(const TQString & ip,bt::Uint16 port)
{
if (!running)
return;
@@ -264,7 +264,7 @@ namespace dht
AnnounceTask* at = new AnnounceTask(db,srv,node,info_hash,port);
at->start(kns,!canStartTask());
tman->addTask(at);
- if (!db->contains(info_hash))
+ if (!db->tqcontains(info_hash))
db->insert(info_hash);
return at;
}
@@ -333,21 +333,21 @@ namespace dht
node->onTimeout(r);
}
- void DHT::addDHTNode(const QString & host,Uint16 hport)
+ void DHT::addDHTNode(const TQString & host,Uint16 hport)
{
if (!running)
return;
- KResolverResults res = KResolver::resolve(host,QString::number(hport));
+ KResolverResults res = KResolver::resolve(host,TQString::number(hport));
if (res.count() > 0)
{
srv->ping(node->getOurID(),res.front().address());
}
}
- QMap<QString, int> DHT::getClosestGoodNodes(int maxNodes)
+ TQMap<TQString, int> DHT::getClosestGoodNodes(int maxNodes)
{
- QMap<QString, int> map;
+ TQMap<TQString, int> map;
if(!node)
return map;
diff --git a/libktorrent/kademlia/dht.h b/libktorrent/kademlia/dht.h
index 8642836..11daf82 100644
--- a/libktorrent/kademlia/dht.h
+++ b/libktorrent/kademlia/dht.h
@@ -20,9 +20,9 @@
#ifndef DHTDHT_H
#define DHTDHT_H
-#include <qtimer.h>
-#include <qstring.h>
-#include <qmap.h>
+#include <tqtimer.h>
+#include <tqstring.h>
+#include <tqmap.h>
#include <util/constants.h>
#include <util/timer.h>
#include "key.h"
@@ -64,6 +64,7 @@ namespace dht
class DHT : public DHTBase
{
Q_OBJECT
+ TQ_OBJECT
public:
DHT();
virtual ~DHT();
@@ -81,7 +82,7 @@ namespace dht
* @param ip The IP of the peer
* @param port The port in the PORT message
*/
- void portRecieved(const QString & ip,bt::Uint16 port);
+ void portRecieved(const TQString & ip,bt::Uint16 port);
/**
* Do an announce on the DHT network
@@ -107,16 +108,16 @@ namespace dht
/// See if it is possible to start a task
bool canStartTask() const;
- void start(const QString & table,const QString & key_file,bt::Uint16 port);
+ void start(const TQString & table,const TQString & key_file,bt::Uint16 port);
void stop();
- void addDHTNode(const QString & host,bt::Uint16 hport);
+ void addDHTNode(const TQString & host,bt::Uint16 hport);
/**
* Returns maxNodes number of <IP address, port> nodes
* that are closest to ourselves and are good.
- * @param maxNodes maximum nr of nodes in QMap to return.
+ * @param maxNodes maximum nr of nodes in TQMap to return.
*/
- QMap<QString, int> getClosestGoodNodes(int maxNodes);
+ TQMap<TQString, int> getClosestGoodNodes(int maxNodes);
private slots:
void update();
@@ -127,8 +128,8 @@ namespace dht
Database* db;
TaskManager* tman;
bt::Timer expire_timer;
- QString table_file;
- QTimer update_timer;
+ TQString table_file;
+ TQTimer update_timer;
};
}
diff --git a/libktorrent/kademlia/dhtbase.h b/libktorrent/kademlia/dhtbase.h
index dfa880a..05699c8 100644
--- a/libktorrent/kademlia/dhtbase.h
+++ b/libktorrent/kademlia/dhtbase.h
@@ -20,10 +20,10 @@
#ifndef DHTDHTBASE_H
#define DHTDHTBASE_H
-#include <qobject.h>
+#include <tqobject.h>
#include <util/constants.h>
-class QString;
+class TQString;
namespace bt
{
@@ -48,9 +48,10 @@ namespace dht
* Interface for DHT class, this is to keep other things separate from the inner workings
* of the DHT.
*/
- class DHTBase : public QObject
+ class DHTBase : public TQObject
{
Q_OBJECT
+ TQ_OBJECT
public:
DHTBase();
virtual ~DHTBase();
@@ -62,7 +63,7 @@ namespace dht
* @param key_file The file where the key is stored
* @param port The port to use
*/
- virtual void start(const QString & table,const QString & key_file,bt::Uint16 port) = 0;
+ virtual void start(const TQString & table,const TQString & key_file,bt::Uint16 port) = 0;
/**
* Stop the DHT
@@ -79,7 +80,7 @@ namespace dht
* @param ip The IP of the peer
* @param port The port in the PORT message
*/
- virtual void portRecieved(const QString & ip,bt::Uint16 port) = 0;
+ virtual void portRecieved(const TQString & ip,bt::Uint16 port) = 0;
/**
* Do an announce on the DHT network
@@ -105,14 +106,14 @@ namespace dht
* @param host The hostname or ip
* @param hport The port of the host
*/
- virtual void addDHTNode(const QString & host,bt::Uint16 hport) = 0;
+ virtual void addDHTNode(const TQString & host,bt::Uint16 hport) = 0;
/**
* Returns maxNodes number of <IP address, port> nodes
* that are closest to ourselves and are good.
- * @param maxNodes maximum nr of nodes in QMap to return.
+ * @param maxNodes maximum nr of nodes in TQMap to return.
*/
- virtual QMap<QString, int> getClosestGoodNodes(int maxNodes) = 0;
+ virtual TQMap<TQString, int> getClosestGoodNodes(int maxNodes) = 0;
signals:
void started();
diff --git a/libktorrent/kademlia/dhttrackerbackend.cpp b/libktorrent/kademlia/dhttrackerbackend.cpp
index c90e6f7..96277a3 100644
--- a/libktorrent/kademlia/dhttrackerbackend.cpp
+++ b/libktorrent/kademlia/dhttrackerbackend.cpp
@@ -18,7 +18,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
***************************************************************************/
#include <kurl.h>
-#include <qhostaddress.h>
+#include <tqhostaddress.h>
#include <util/log.h>
#include <util/functions.h>
#include <torrent/globals.h>
@@ -37,9 +37,9 @@ namespace dht
DHTTrackerBackend::DHTTrackerBackend(DHTBase & dh_table,kt::TorrentInterface* tor)
: dh_table(dh_table),curr_task(0),tor(tor)
{
- connect(&timer,SIGNAL(timeout()),this,SLOT(onTimeout()));
- connect(&dh_table,SIGNAL(started()),this,SLOT(manualUpdate()));
- connect(&dh_table,SIGNAL(stopped()),this,SLOT(dhtStopped()));
+ connect(&timer,TQT_SIGNAL(timeout()),this,TQT_SLOT(onTimeout()));
+ connect(&dh_table,TQT_SIGNAL(started()),this,TQT_SLOT(manualUpdate()));
+ connect(&dh_table,TQT_SIGNAL(stopped()),this,TQT_SLOT(dhtStopped()));
started = false;
}
@@ -98,8 +98,8 @@ namespace dht
const kt::DHTNode & n = tor->getDHTNode(i);
curr_task->addDHTNode(n.ip,n.port);
}
- connect(curr_task,SIGNAL(dataReady( Task* )),this,SLOT(onDataReady( Task* )));
- connect(curr_task,SIGNAL(finished( Task* )),this,SLOT(onFinished( Task* )));
+ connect(curr_task,TQT_SIGNAL(dataReady( Task* )),this,TQT_SLOT(onDataReady( Task* )));
+ connect(curr_task,TQT_SIGNAL(finished( Task* )),this,TQT_SLOT(onFinished( Task* )));
return true;
}
@@ -127,7 +127,7 @@ namespace dht
while (curr_task->takeItem(item))
{
Uint16 port = bt::ReadUint16(item.getData(),4);
- QString ip = QHostAddress(ReadUint32(item.getData(),0)).toString();
+ TQString ip = TQHostAddress(ReadUint32(item.getData(),0)).toString();
addPeer(ip,port);
cnt++;
@@ -136,8 +136,8 @@ namespace dht
if (cnt)
{
Out(SYS_DHT|LOG_NOTICE) <<
- QString("DHT: Got %1 potential peers for torrent %2")
- .arg(cnt).arg(tor->getStats().torrent_name) << endl;
+ TQString("DHT: Got %1 potential peers for torrent %2")
+ .tqarg(cnt).tqarg(tor->getStats().torrent_name) << endl;
peersReady(this);
}
}
diff --git a/libktorrent/kademlia/dhttrackerbackend.h b/libktorrent/kademlia/dhttrackerbackend.h
index 355aab9..91141c8 100644
--- a/libktorrent/kademlia/dhttrackerbackend.h
+++ b/libktorrent/kademlia/dhttrackerbackend.h
@@ -20,7 +20,7 @@
#ifndef DHTDHTTRACKERBACKEND_H
#define DHTDHTTRACKERBACKEND_H
-#include <qtimer.h>
+#include <tqtimer.h>
#include <interfaces/peersource.h>
#include "task.h"
@@ -47,6 +47,7 @@ namespace dht
class DHTTrackerBackend : public kt::PeerSource
{
Q_OBJECT
+ TQ_OBJECT
public:
DHTTrackerBackend(DHTBase & dh_table,kt::TorrentInterface* tor);
virtual ~DHTTrackerBackend();
@@ -66,7 +67,7 @@ namespace dht
DHTBase & dh_table;
AnnounceTask* curr_task;
kt::TorrentInterface* tor;
- QTimer timer;
+ TQTimer timer;
bool started;
};
diff --git a/libktorrent/kademlia/kbucket.cpp b/libktorrent/kademlia/kbucket.cpp
index fb60d1b..76986b9 100644
--- a/libktorrent/kademlia/kbucket.cpp
+++ b/libktorrent/kademlia/kbucket.cpp
@@ -119,7 +119,7 @@ namespace dht
void KBucket::insert(const KBucketEntry & entry)
{
- QValueList<KBucketEntry>::iterator i = entries.find(entry);
+ TQValueList<KBucketEntry>::iterator i = entries.tqfind(entry);
// If in the list, move it to the end
if (i != entries.end())
@@ -149,7 +149,7 @@ namespace dht
{
last_modified = bt::GetCurrentTime();
- if (!pending_entries_busy_pinging.contains(c))
+ if (!pending_entries_busy_pinging.tqcontains(c))
return;
KBucketEntry entry = pending_entries_busy_pinging[c];
@@ -166,13 +166,13 @@ namespace dht
void KBucket::onTimeout(RPCCall* c)
{
- if (!pending_entries_busy_pinging.contains(c))
+ if (!pending_entries_busy_pinging.tqcontains(c))
return;
KBucketEntry entry = pending_entries_busy_pinging[c];
// replace the entry which timed out
- QValueList<KBucketEntry>::iterator i;
+ TQValueList<KBucketEntry>::iterator i;
for (i = entries.begin();i != entries.end();i++)
{
KBucketEntry & e = *i;
@@ -203,7 +203,7 @@ namespace dht
return;
}
- QValueList<KBucketEntry>::iterator i;
+ TQValueList<KBucketEntry>::iterator i;
// we haven't found any bad ones so try the questionable ones
for (i = entries.begin();i != entries.end();i++)
{
@@ -228,7 +228,7 @@ namespace dht
bool KBucket::replaceBadEntry(const KBucketEntry & entry)
{
- QValueList<KBucketEntry>::iterator i;
+ TQValueList<KBucketEntry>::iterator i;
for (i = entries.begin();i != entries.end();i++)
{
KBucketEntry & e = *i;
@@ -244,14 +244,14 @@ namespace dht
return false;
}
- bool KBucket::contains(const KBucketEntry & entry) const
+ bool KBucket::tqcontains(const KBucketEntry & entry) const
{
- return entries.contains(entry);
+ return entries.tqcontains(entry);
}
void KBucket::findKClosestNodes(KClosestNodesSearch & kns)
{
- QValueList<KBucketEntry>::iterator i = entries.begin();
+ TQValueList<KBucketEntry>::iterator i = entries.begin();
while (i != entries.end())
{
kns.tryInsert(*i);
@@ -261,7 +261,7 @@ namespace dht
bool KBucket::onTimeout(const KInetSocketAddress & addr)
{
- QValueList<KBucketEntry>::iterator i;
+ TQValueList<KBucketEntry>::iterator i;
for (i = entries.begin();i != entries.end();i++)
{
@@ -302,7 +302,7 @@ namespace dht
hdr.num_entries = entries.count();
fptr.write(&hdr,sizeof(BucketHeader));
- QValueList<KBucketEntry>::iterator i;
+ TQValueList<KBucketEntry>::iterator i;
for (i = entries.begin();i != entries.end();i++)
{
KBucketEntry & e = *i;
@@ -345,8 +345,8 @@ namespace dht
refresh_task = t;
if (refresh_task)
{
- connect(refresh_task,SIGNAL(finished( Task* )),
- this,SLOT(onFinished( Task* )));
+ connect(refresh_task,TQT_SIGNAL(finished( Task* )),
+ this,TQT_SLOT(onFinished( Task* )));
}
}
diff --git a/libktorrent/kademlia/kbucket.h b/libktorrent/kademlia/kbucket.h
index 139ce10..cfd932d 100644
--- a/libktorrent/kademlia/kbucket.h
+++ b/libktorrent/kademlia/kbucket.h
@@ -20,7 +20,7 @@
#ifndef DHTKBUCKET_H
#define DHTKBUCKET_H
-#include <qvaluelist.h>
+#include <tqvaluelist.h>
#include <util/constants.h>
#include <ksocketaddress.h>
#include "key.h"
@@ -143,12 +143,13 @@ namespace dht
class KBucket : public RPCCallListener
{
Q_OBJECT
+ TQ_OBJECT
Uint32 idx;
- QValueList<KBucketEntry> entries,pending_entries;
+ TQValueList<KBucketEntry> entries,pending_entries;
RPCServer* srv;
Node* node;
- QMap<RPCCall*,KBucketEntry> pending_entries_busy_pinging;
+ TQMap<RPCCall*,KBucketEntry> pending_entries_busy_pinging;
mutable bt::TimeStamp last_modified;
Task* refresh_task;
public:
@@ -168,7 +169,7 @@ namespace dht
Uint32 getNumEntries() const {return entries.count();}
/// See if this bucket contains an entry
- bool contains(const KBucketEntry & entry) const;
+ bool tqcontains(const KBucketEntry & entry) const;
/**
* Find the K closest entries to a key and store them in the KClosestNodesSearch
diff --git a/libktorrent/kademlia/kclosestnodessearch.cpp b/libktorrent/kademlia/kclosestnodessearch.cpp
index 4a97c7f..5421b6c 100644
--- a/libktorrent/kademlia/kclosestnodessearch.cpp
+++ b/libktorrent/kademlia/kclosestnodessearch.cpp
@@ -65,7 +65,7 @@ namespace dht
}
- void KClosestNodesSearch::pack(QByteArray & ba)
+ void KClosestNodesSearch::pack(TQByteArray & ba)
{
// make sure we do not writ to much
Uint32 max_items = ba.size() / 26;
diff --git a/libktorrent/kademlia/kclosestnodessearch.h b/libktorrent/kademlia/kclosestnodessearch.h
index e006a25..f4b460d 100644
--- a/libktorrent/kademlia/kclosestnodessearch.h
+++ b/libktorrent/kademlia/kclosestnodessearch.h
@@ -31,7 +31,7 @@ namespace dht
* @author Joris Guisson <joris.guisson@gmail.com>
*
* Class used to store the search results during a K closests nodes search
- * Note: we use a std::map because of lack of functionality in QMap
+ * Note: we use a std::map because of lack of functionality in TQMap
*/
class KClosestNodesSearch
{
@@ -82,7 +82,7 @@ namespace dht
* enough space to store requiredSpace() bytes.
* @param ba The buffer
*/
- void pack(QByteArray & ba);
+ void pack(TQByteArray & ba);
};
}
diff --git a/libktorrent/kademlia/key.cpp b/libktorrent/kademlia/key.cpp
index 6e62ff6..35ecfff 100644
--- a/libktorrent/kademlia/key.cpp
+++ b/libktorrent/kademlia/key.cpp
@@ -19,7 +19,7 @@
***************************************************************************/
#include <time.h>
#include <stdlib.h>
-#include <qcstring.h>
+#include <tqcstring.h>
#include <util/constants.h>
#include "key.h"
@@ -39,7 +39,7 @@ namespace dht
{
}
- Key::Key(const QByteArray & ba)
+ Key::Key(const TQByteArray & ba)
{
for (Uint32 i = 0;i < 20 && i < ba.size();i++)
hash[i] = ba[i];
diff --git a/libktorrent/kademlia/key.h b/libktorrent/kademlia/key.h
index e818dc1..e383a5e 100644
--- a/libktorrent/kademlia/key.h
+++ b/libktorrent/kademlia/key.h
@@ -20,7 +20,7 @@
#ifndef DHTKEY_H
#define DHTKEY_H
-#include <qcstring.h>
+#include <tqcstring.h>
#include <util/sha1hash.h>
@@ -52,9 +52,9 @@ namespace dht
/**
* Make a key out of a bytearray
- * @param ba The QByteArray
+ * @param ba The TQByteArray
*/
- Key(const QByteArray & ba);
+ Key(const TQByteArray & ba);
/**
* Make a key out of a 20 byte array.
diff --git a/libktorrent/kademlia/node.cpp b/libktorrent/kademlia/node.cpp
index 96c39a4..bd450e4 100644
--- a/libktorrent/kademlia/node.cpp
+++ b/libktorrent/kademlia/node.cpp
@@ -37,7 +37,7 @@ using namespace KNetwork;
namespace dht
{
- static void SaveKey(const dht::Key & key,const QString & key_file)
+ static void SaveKey(const dht::Key & key,const TQString & key_file)
{
bt::File fptr;
if (!fptr.open(key_file,"wb"))
@@ -50,7 +50,7 @@ namespace dht
fptr.close();
}
- static dht::Key LoadKey(const QString & key_file,bool & new_key)
+ static dht::Key LoadKey(const TQString & key_file,bool & new_key)
{
bt::File fptr;
if (!fptr.open(key_file,"rb"))
@@ -75,7 +75,7 @@ namespace dht
return dht::Key(data);
}
- Node::Node(RPCServer* srv,const QString & key_file) : srv(srv)
+ Node::Node(RPCServer* srv,const TQString & key_file) : srv(srv)
{
num_receives = 0;
num_entries = 0;
@@ -224,7 +224,7 @@ namespace dht
}
- void Node::saveTable(const QString & file)
+ void Node::saveTable(const TQString & file)
{
bt::File fptr;
if (!fptr.open(file,"wb"))
@@ -243,7 +243,7 @@ namespace dht
}
}
- void Node::loadTable(const QString & file)
+ void Node::loadTable(const TQString & file)
{
if (delete_table)
{
diff --git a/libktorrent/kademlia/node.h b/libktorrent/kademlia/node.h
index 56f41f1..7d871e0 100644
--- a/libktorrent/kademlia/node.h
+++ b/libktorrent/kademlia/node.h
@@ -20,7 +20,7 @@
#ifndef DHTNODE_H
#define DHTNODE_H
-#include <qobject.h>
+#include <tqobject.h>
#include "key.h"
#include "kbucket.h"
@@ -37,16 +37,17 @@ namespace dht
/**
* @author Joris Guisson
*
- * A Node represents us in the kademlia network. It contains
+ * A Node represents us in the kademlia network. It tqcontains
* our id and 160 KBucket's.
* A KBucketEntry is in node i, when the difference between our id and
* the KBucketEntry's id is between 2 to the power i and 2 to the power i+1.
*/
- class Node : public QObject
+ class Node : public TQObject
{
Q_OBJECT
+ TQ_OBJECT
public:
- Node(RPCServer* srv,const QString & key_file);
+ Node(RPCServer* srv,const TQString & key_file);
virtual ~Node();
/**
@@ -77,10 +78,10 @@ namespace dht
void refreshBuckets(DHT* dh_table);
/// Save the routing table to a file
- void saveTable(const QString & file);
+ void saveTable(const TQString & file);
/// Load the routing table from a file
- void loadTable(const QString & file);
+ void loadTable(const TQString & file);
/// Get the number of entries in the routing table
Uint32 getNumEntriesInRoutingTable() const {return num_entries;}
diff --git a/libktorrent/kademlia/nodelookup.cpp b/libktorrent/kademlia/nodelookup.cpp
index 9fa616c..9175f7d 100644
--- a/libktorrent/kademlia/nodelookup.cpp
+++ b/libktorrent/kademlia/nodelookup.cpp
@@ -49,14 +49,14 @@ namespace dht
if (rsp->getMethod() == dht::FIND_NODE && rsp->getType() == dht::RSP_MSG)
{
FindNodeRsp* fnr = (FindNodeRsp*)rsp;
- const QByteArray & nodes = fnr->getNodes();
+ const TQByteArray & nodes = fnr->getNodes();
Uint32 nnodes = nodes.size() / 26;
for (Uint32 j = 0;j < nnodes;j++)
{
// unpack an entry and add it to the todo list
KBucketEntry e = UnpackBucketEntry(nodes,j*26);
// lets not talk to ourself
- if (e.getID() != node->getOurID() && !todo.contains(e) && !visited.contains(e))
+ if (e.getID() != node->getOurID() && !todo.tqcontains(e) && !visited.tqcontains(e))
todo.append(e);
}
num_nodes_rsp++;
@@ -78,7 +78,7 @@ namespace dht
{
KBucketEntry e = todo.first();
// only send a findNode if we haven't allrready visited the node
- if (!visited.contains(e))
+ if (!visited.tqcontains(e))
{
// send a findNode to the node
FindNodeReq* fnr = new FindNodeReq(node->getOurID(),node_id);
diff --git a/libktorrent/kademlia/pack.cpp b/libktorrent/kademlia/pack.cpp
index a5acafb..200c686 100644
--- a/libktorrent/kademlia/pack.cpp
+++ b/libktorrent/kademlia/pack.cpp
@@ -27,7 +27,7 @@ using namespace KNetwork;
namespace dht
{
- void PackBucketEntry(const KBucketEntry & e,QByteArray & ba,Uint32 off)
+ void PackBucketEntry(const KBucketEntry & e,TQByteArray & ba,Uint32 off)
{
// first check size
if (off + 26 > ba.size())
@@ -43,7 +43,7 @@ namespace dht
bt::WriteUint16(ptr,24,addr.port());
}
- KBucketEntry UnpackBucketEntry(const QByteArray & ba,Uint32 off)
+ KBucketEntry UnpackBucketEntry(const TQByteArray & ba,Uint32 off)
{
if (off + 26 > ba.size())
throw bt::Error("Not enough room in buffer");
diff --git a/libktorrent/kademlia/pack.h b/libktorrent/kademlia/pack.h
index dab1523..46c2405 100644
--- a/libktorrent/kademlia/pack.h
+++ b/libktorrent/kademlia/pack.h
@@ -32,7 +32,7 @@ namespace dht
* @param ba The byte array
* @param off The offset into the array
*/
- void PackBucketEntry(const KBucketEntry & e,QByteArray & ba,Uint32 off);
+ void PackBucketEntry(const KBucketEntry & e,TQByteArray & ba,Uint32 off);
/**
* Unpack a KBucketEntry from a byte array.
@@ -41,7 +41,7 @@ namespace dht
* @param off The offset
* @return The entry
*/
- KBucketEntry UnpackBucketEntry(const QByteArray & ba,Uint32 off);
+ KBucketEntry UnpackBucketEntry(const TQByteArray & ba,Uint32 off);
}
diff --git a/libktorrent/kademlia/rpccall.cpp b/libktorrent/kademlia/rpccall.cpp
index b86e8f7..9ed926a 100644
--- a/libktorrent/kademlia/rpccall.cpp
+++ b/libktorrent/kademlia/rpccall.cpp
@@ -33,7 +33,7 @@ namespace dht
RPCCall::RPCCall(RPCServer* rpc,MsgBase* msg,bool queued) : msg(msg),rpc(rpc),queued(queued)
{
- connect(&timer,SIGNAL(timeout()),this,SLOT(onTimeout()));
+ connect(&timer,TQT_SIGNAL(timeout()),this,TQT_SLOT(onTimeout()));
if (!queued)
timer.start(30*1000,true);
}
@@ -71,8 +71,8 @@ namespace dht
void RPCCall::addListener(RPCCallListener* cl)
{
- connect(this,SIGNAL(onCallResponse( RPCCall*, MsgBase* )),cl,SLOT(onResponse( RPCCall*, MsgBase* )));
- connect(this,SIGNAL(onCallTimeout( RPCCall* )),cl,SLOT(onTimeout( RPCCall* )));
+ connect(this,TQT_SIGNAL(onCallResponse( RPCCall*, MsgBase* )),cl,TQT_SLOT(onResponse( RPCCall*, MsgBase* )));
+ connect(this,TQT_SIGNAL(onCallTimeout( RPCCall* )),cl,TQT_SLOT(onTimeout( RPCCall* )));
}
}
diff --git a/libktorrent/kademlia/rpccall.h b/libktorrent/kademlia/rpccall.h
index 6e54933..2a9682e 100644
--- a/libktorrent/kademlia/rpccall.h
+++ b/libktorrent/kademlia/rpccall.h
@@ -20,7 +20,7 @@
#ifndef DHTRPCCALL_H
#define DHTRPCCALL_H
-#include <qtimer.h>
+#include <tqtimer.h>
#include "key.h"
#include "rpcmsg.h"
@@ -32,9 +32,10 @@ namespace dht
/**
* Class which objects should derive from, if they want to know the result of a call.
*/
- class RPCCallListener : public QObject
+ class RPCCallListener : public TQObject
{
Q_OBJECT
+ TQ_OBJECT
public:
RPCCallListener();
virtual ~RPCCallListener();
@@ -58,9 +59,10 @@ namespace dht
/**
* @author Joris Guisson
*/
- class RPCCall : public QObject
+ class RPCCall : public TQObject
{
Q_OBJECT
+ TQ_OBJECT
public:
RPCCall(RPCServer* rpc,MsgBase* msg,bool queued);
virtual ~RPCCall();
@@ -100,7 +102,7 @@ namespace dht
private:
MsgBase* msg;
- QTimer timer;
+ TQTimer timer;
RPCServer* rpc;
bool queued;
};
diff --git a/libktorrent/kademlia/rpcmsg.cpp b/libktorrent/kademlia/rpcmsg.cpp
index 97364e1..53cb4f1 100644
--- a/libktorrent/kademlia/rpcmsg.cpp
+++ b/libktorrent/kademlia/rpcmsg.cpp
@@ -30,14 +30,14 @@ using namespace bt;
namespace dht
{
- const QString TID = "t";
- const QString REQ = "q";
- const QString RSP = "r";
- const QString TYP = "y";
- const QString ARG = "a";
- // ERR apparently is defined as a macro on solaris in some header file,
+ const TQString TID = "t";
+ const TQString REQ = "q";
+ const TQString RSP = "r";
+ const TQString TYP = "y";
+ const TQString ARG = "a";
+ // ERR aptqparently is defined as a macro on solaris in some header file,
// which causes things not to compile on it, so we have changed it to ERR_DHT
- const QString ERR_DHT = "e";
+ const TQString ERR_DHT = "e";
MsgBase* MakeMsg(bt::BDictNode* dict);
@@ -57,13 +57,13 @@ namespace dht
return 0;
Key id = Key(args->getValue("id")->data().toByteArray());
- QByteArray mtid_d = dict->getValue(TID)->data().toByteArray();
+ TQByteArray mtid_d = dict->getValue(TID)->data().toByteArray();
if (mtid_d.size() == 0)
return 0;
Uint8 mtid = (Uint8)mtid_d.at(0);
MsgBase* msg = 0;
- QString str = vn->data().toString();
+ TQString str = vn->data().toString();
if (str == "ping")
{
msg = new PingReq(id);
@@ -116,7 +116,7 @@ namespace dht
if (args->getValue("token"))
{
Key token = args->getValue("token")->data().toByteArray();
- QByteArray data;
+ TQByteArray data;
BListNode* vals = args->getList("values");
DBItemList dbl;
if (vals)
@@ -163,7 +163,7 @@ namespace dht
}
- QByteArray ba = dict->getValue(TID)->data().toByteArray();
+ TQByteArray ba = dict->getValue(TID)->data().toByteArray();
// check for empty byte arrays should prevent 144416
if (ba.size() == 0)
return 0;
@@ -188,12 +188,12 @@ namespace dht
return 0;
Key id = Key(args->getValue("id")->data().toByteArray());
- QString mt_id = dict->getValue(TID)->data().toString();
+ TQString mt_id = dict->getValue(TID)->data().toString();
if (mt_id.length() == 0)
return 0;
- Uint8 mtid = (char)mt_id.at(0).latin1();
- QString str = vn->data().toString();
+ Uint8 mtid = (char)mt_id.tqat(0).latin1();
+ TQString str = vn->data().toString();
return new ErrMsg(mtid,id,str);
}
@@ -252,7 +252,7 @@ namespace dht
////////////////////////////////
- PingReq::PingReq(const Key & id) : MsgBase(0xFF,PING,REQ_MSG,id)
+ PingReq::PingReq(const Key & id) : MsgBase(0xFF,PING,RETQ_MSG,id)
{
}
@@ -266,20 +266,20 @@ namespace dht
void PingReq::print()
{
- Out(SYS_DHT|LOG_DEBUG) << QString("REQ: %1 %2 : ping").arg(mtid).arg(id.toString()) << endl;
+ Out(SYS_DHT|LOG_DEBUG) << TQString("REQ: %1 %2 : ping").tqarg(mtid).tqarg(id.toString()) << endl;
}
- void PingReq::encode(QByteArray & arr)
+ void PingReq::encode(TQByteArray & arr)
{
BEncoder enc(new BEncoderBufferOutput(arr));
enc.beginDict();
{
enc.write(ARG); enc.beginDict();
{
- enc.write("id"); enc.write(id.getData(),20);
+ enc.write(TQString("id")); enc.write(id.getData(),20);
}
enc.end();
- enc.write(REQ); enc.write("ping");
+ enc.write(REQ); enc.write(TQString("ping"));
enc.write(TID); enc.write(&mtid,1);
enc.write(TYP); enc.write(REQ);
}
@@ -289,7 +289,7 @@ namespace dht
////////////////////////////////
FindNodeReq::FindNodeReq(const Key & id,const Key & target)
- : MsgBase(0xFF,FIND_NODE,REQ_MSG,id),target(target)
+ : MsgBase(0xFF,FIND_NODE,RETQ_MSG,id),target(target)
{}
FindNodeReq::~FindNodeReq()
@@ -302,22 +302,22 @@ namespace dht
void FindNodeReq::print()
{
- Out(SYS_DHT|LOG_NOTICE) << QString("REQ: %1 %2 : find_node %3")
- .arg(mtid).arg(id.toString()).arg(target.toString()) << endl;
+ Out(SYS_DHT|LOG_NOTICE) << TQString("REQ: %1 %2 : find_node %3")
+ .tqarg(mtid).tqarg(id.toString()).tqarg(target.toString()) << endl;
}
- void FindNodeReq::encode(QByteArray & arr)
+ void FindNodeReq::encode(TQByteArray & arr)
{
BEncoder enc(new BEncoderBufferOutput(arr));
enc.beginDict();
{
enc.write(ARG); enc.beginDict();
{
- enc.write("id"); enc.write(id.getData(),20);
- enc.write("target"); enc.write(target.getData(),20);
+ enc.write(TQString("id")); enc.write(id.getData(),20);
+ enc.write(TQString("target")); enc.write(target.getData(),20);
}
enc.end();
- enc.write(REQ); enc.write("find_node");
+ enc.write(REQ); enc.write(TQString("find_node"));
enc.write(TID); enc.write(&mtid,1);
enc.write(TYP); enc.write(REQ);
}
@@ -328,7 +328,7 @@ namespace dht
////////////////////////////////
GetPeersReq::GetPeersReq(const Key & id,const Key & info_hash)
- : MsgBase(0xFF,GET_PEERS,REQ_MSG,id),info_hash(info_hash)
+ : MsgBase(0xFF,GET_PEERS,RETQ_MSG,id),info_hash(info_hash)
{}
GetPeersReq::~GetPeersReq()
@@ -341,22 +341,22 @@ namespace dht
void GetPeersReq::print()
{
- Out(SYS_DHT|LOG_DEBUG) << QString("REQ: %1 %2 : get_peers %3")
- .arg(mtid).arg(id.toString()).arg(info_hash.toString()) << endl;
+ Out(SYS_DHT|LOG_DEBUG) << TQString("REQ: %1 %2 : get_peers %3")
+ .tqarg(mtid).tqarg(id.toString()).tqarg(info_hash.toString()) << endl;
}
- void GetPeersReq::encode(QByteArray & arr)
+ void GetPeersReq::encode(TQByteArray & arr)
{
BEncoder enc(new BEncoderBufferOutput(arr));
enc.beginDict();
{
enc.write(ARG); enc.beginDict();
{
- enc.write("id"); enc.write(id.getData(),20);
- enc.write("info_hash"); enc.write(info_hash.getData(),20);
+ enc.write(TQString("id")); enc.write(id.getData(),20);
+ enc.write(TQString("info_hash")); enc.write(info_hash.getData(),20);
}
enc.end();
- enc.write(REQ); enc.write("get_peers");
+ enc.write(REQ); enc.write(TQString("get_peers"));
enc.write(TID); enc.write(&mtid,1);
enc.write(TYP); enc.write(REQ);
}
@@ -380,25 +380,25 @@ namespace dht
void AnnounceReq::print()
{
- Out(SYS_DHT|LOG_DEBUG) << QString("REQ: %1 %2 : announce_peer %3 %4 %5")
- .arg(mtid).arg(id.toString()).arg(info_hash.toString())
- .arg(port).arg(token.toString()) << endl;
+ Out(SYS_DHT|LOG_DEBUG) << TQString("REQ: %1 %2 : announce_peer %3 %4 %5")
+ .tqarg(mtid).tqarg(id.toString()).tqarg(info_hash.toString())
+ .tqarg(port).tqarg(token.toString()) << endl;
}
- void AnnounceReq::encode(QByteArray & arr)
+ void AnnounceReq::encode(TQByteArray & arr)
{
BEncoder enc(new BEncoderBufferOutput(arr));
enc.beginDict();
{
enc.write(ARG); enc.beginDict();
{
- enc.write("id"); enc.write(id.getData(),20);
- enc.write("info_hash"); enc.write(info_hash.getData(),20);
- enc.write("port"); enc.write((Uint32)port);
- enc.write("token"); enc.write(token.getData(),20);
+ enc.write(TQString("id")); enc.write(id.getData(),20);
+ enc.write(TQString("info_hash")); enc.write(info_hash.getData(),20);
+ enc.write(TQString("port")); enc.write((Uint32)port);
+ enc.write(TQString("token")); enc.write(token.getData(),20);
}
enc.end();
- enc.write(REQ); enc.write("announce_peer");
+ enc.write(REQ); enc.write(TQString("announce_peer"));
enc.write(TID); enc.write(&mtid,1);
enc.write(TYP); enc.write(REQ);
}
@@ -420,18 +420,18 @@ namespace dht
void PingRsp::print()
{
- Out(SYS_DHT|LOG_DEBUG) << QString("RSP: %1 %2 : ping")
- .arg(mtid).arg(id.toString()) << endl;
+ Out(SYS_DHT|LOG_DEBUG) << TQString("RSP: %1 %2 : ping")
+ .tqarg(mtid).tqarg(id.toString()) << endl;
}
- void PingRsp::encode(QByteArray & arr)
+ void PingRsp::encode(TQByteArray & arr)
{
BEncoder enc(new BEncoderBufferOutput(arr));
enc.beginDict();
{
enc.write(RSP); enc.beginDict();
{
- enc.write("id"); enc.write(id.getData(),20);
+ enc.write(TQString("id")); enc.write(id.getData(),20);
}
enc.end();
enc.write(TID); enc.write(&mtid,1);
@@ -442,7 +442,7 @@ namespace dht
////////////////////////////////
- FindNodeRsp::FindNodeRsp(Uint8 mtid,const Key & id,const QByteArray & nodes)
+ FindNodeRsp::FindNodeRsp(Uint8 mtid,const Key & id,const TQByteArray & nodes)
: MsgBase(mtid,FIND_NODE,RSP_MSG,id),nodes(nodes)
{}
@@ -455,19 +455,19 @@ namespace dht
void FindNodeRsp::print()
{
- Out(SYS_DHT|LOG_DEBUG) << QString("RSP: %1 %2 : find_node")
- .arg(mtid).arg(id.toString()) << endl;
+ Out(SYS_DHT|LOG_DEBUG) << TQString("RSP: %1 %2 : find_node")
+ .tqarg(mtid).tqarg(id.toString()) << endl;
}
- void FindNodeRsp::encode(QByteArray & arr)
+ void FindNodeRsp::encode(TQByteArray & arr)
{
BEncoder enc(new BEncoderBufferOutput(arr));
enc.beginDict();
{
enc.write(RSP); enc.beginDict();
{
- enc.write("id"); enc.write(id.getData(),20);
- enc.write("nodes"); enc.write(nodes);
+ enc.write(TQString("id")); enc.write(id.getData(),20);
+ enc.write(TQString("nodes")); enc.write(nodes);
}
enc.end();
enc.write(TID); enc.write(&mtid,1);
@@ -478,7 +478,7 @@ namespace dht
////////////////////////////////
- GetPeersRsp::GetPeersRsp(Uint8 mtid,const Key & id,const QByteArray & data,const Key & token)
+ GetPeersRsp::GetPeersRsp(Uint8 mtid,const Key & id,const TQByteArray & data,const Key & token)
: MsgBase(mtid,dht::GET_PEERS,dht::RSP_MSG,id),token(token),data(data)
{
this->data.detach();
@@ -497,27 +497,27 @@ namespace dht
}
void GetPeersRsp::print()
{
- Out() << QString("RSP: %1 %2 : get_peers(%3)")
- .arg(mtid).arg(id.toString()).arg(data.size() > 0 ? "nodes" : "values") << endl;
+ Out() << TQString("RSP: %1 %2 : get_peers(%3)")
+ .tqarg(mtid).tqarg(id.toString()).tqarg(data.size() > 0 ? "nodes" : "values") << endl;
}
- void GetPeersRsp::encode(QByteArray & arr)
+ void GetPeersRsp::encode(TQByteArray & arr)
{
BEncoder enc(new BEncoderBufferOutput(arr));
enc.beginDict();
{
enc.write(RSP); enc.beginDict();
{
- enc.write("id"); enc.write(id.getData(),20);
+ enc.write(TQString("id")); enc.write(id.getData(),20);
if (data.size() > 0)
{
- enc.write("nodes"); enc.write(data);
- enc.write("token"); enc.write(token.getData(),20);
+ enc.write(TQString("nodes")); enc.write(data);
+ enc.write(TQString("token")); enc.write(token.getData(),20);
}
else
{
- enc.write("token"); enc.write(token.getData(),20);
- enc.write("values"); enc.beginList();
+ enc.write(TQString("token")); enc.write(token.getData(),20);
+ enc.write(TQString("values")); enc.beginList();
DBItemList::iterator i = items.begin();
while (i != items.end())
{
@@ -551,18 +551,18 @@ namespace dht
void AnnounceRsp::print()
{
- Out() << QString("RSP: %1 %2 : announce_peer")
- .arg(mtid).arg(id.toString()) << endl;
+ Out() << TQString("RSP: %1 %2 : announce_peer")
+ .tqarg(mtid).tqarg(id.toString()) << endl;
}
- void AnnounceRsp::encode(QByteArray & arr)
+ void AnnounceRsp::encode(TQByteArray & arr)
{
BEncoder enc(new BEncoderBufferOutput(arr));
enc.beginDict();
{
enc.write(RSP); enc.beginDict();
{
- enc.write("id"); enc.write(id.getData(),20);
+ enc.write(TQString("id")); enc.write(id.getData(),20);
}
enc.end();
enc.write(TID); enc.write(&mtid,1);
@@ -574,7 +574,7 @@ namespace dht
////////////////////////////////
- ErrMsg::ErrMsg(Uint8 mtid,const Key & id,const QString & msg)
+ ErrMsg::ErrMsg(Uint8 mtid,const Key & id,const TQString & msg)
: MsgBase(mtid,NONE,ERR_MSG,id),msg(msg)
{}
@@ -591,6 +591,6 @@ namespace dht
Out(SYS_DHT|LOG_NOTICE) << "ERR: " << mtid << " " << msg << endl;
}
- void ErrMsg::encode(QByteArray & )
+ void ErrMsg::encode(TQByteArray & )
{}
}
diff --git a/libktorrent/kademlia/rpcmsg.h b/libktorrent/kademlia/rpcmsg.h
index 4863ae2..7e04d7a 100644
--- a/libktorrent/kademlia/rpcmsg.h
+++ b/libktorrent/kademlia/rpcmsg.h
@@ -40,7 +40,7 @@ namespace dht
enum Type
{
- REQ_MSG,
+ RETQ_MSG,
RSP_MSG,
ERR_MSG,
INVALID
@@ -83,7 +83,7 @@ namespace dht
* BEncode the message.
* @param arr Data array
*/
- virtual void encode(QByteArray & arr) = 0;
+ virtual void encode(TQByteArray & arr) = 0;
/// Set the origin (i.e. where the message came from)
void setOrigin(const KNetwork::KSocketAddress & o) {origin = o;}
@@ -133,14 +133,14 @@ namespace dht
class ErrMsg : public MsgBase
{
public:
- ErrMsg(Uint8 mtid,const Key & id,const QString & msg);
+ ErrMsg(Uint8 mtid,const Key & id,const TQString & msg);
virtual ~ErrMsg();
virtual void apply(DHT* dh_table);
virtual void print();
- virtual void encode(QByteArray & arr);
+ virtual void encode(TQByteArray & arr);
private:
- QString msg;
+ TQString msg;
};
class PingReq : public MsgBase
@@ -151,7 +151,7 @@ namespace dht
virtual void apply(DHT* dh_table);
virtual void print();
- virtual void encode(QByteArray & arr);
+ virtual void encode(TQByteArray & arr);
};
class FindNodeReq : public MsgBase
@@ -162,7 +162,7 @@ namespace dht
virtual void apply(DHT* dh_table);
virtual void print();
- virtual void encode(QByteArray & arr);
+ virtual void encode(TQByteArray & arr);
const Key & getTarget() const {return target;}
@@ -179,7 +179,7 @@ namespace dht
const Key & getInfoHash() const {return info_hash;}
virtual void apply(DHT* dh_table);
virtual void print();
- virtual void encode(QByteArray & arr);
+ virtual void encode(TQByteArray & arr);
protected:
Key info_hash;
};
@@ -192,7 +192,7 @@ namespace dht
virtual void apply(DHT* dh_table);
virtual void print();
- virtual void encode(QByteArray & arr);
+ virtual void encode(TQByteArray & arr);
const Key & getToken() const {return token;}
bt::Uint16 getPort() const {return port;}
@@ -209,7 +209,7 @@ namespace dht
virtual void apply(DHT* dh_table);
virtual void print();
- virtual void encode(QByteArray & arr);
+ virtual void encode(TQByteArray & arr);
};
@@ -217,37 +217,37 @@ namespace dht
class FindNodeRsp : public MsgBase
{
public:
- FindNodeRsp(Uint8 mtid,const Key & id,const QByteArray & nodes);
+ FindNodeRsp(Uint8 mtid,const Key & id,const TQByteArray & nodes);
virtual ~FindNodeRsp();
virtual void apply(DHT* dh_table);
virtual void print();
- virtual void encode(QByteArray & arr);
+ virtual void encode(TQByteArray & arr);
- const QByteArray & getNodes() const {return nodes;}
+ const TQByteArray & getNodes() const {return nodes;}
protected:
- QByteArray nodes;
+ TQByteArray nodes;
};
class GetPeersRsp : public MsgBase
{
public:
- GetPeersRsp(Uint8 mtid,const Key & id,const QByteArray & data,const Key & token);
+ GetPeersRsp(Uint8 mtid,const Key & id,const TQByteArray & data,const Key & token);
GetPeersRsp(Uint8 mtid,const Key & id,const DBItemList & values,const Key & token);
virtual ~GetPeersRsp();
virtual void apply(DHT* dh_table);
virtual void print();
- virtual void encode(QByteArray & arr);
+ virtual void encode(TQByteArray & arr);
- const QByteArray & getData() const {return data;}
+ const TQByteArray & getData() const {return data;}
const DBItemList & getItemList() const {return items;}
const Key & getToken() const {return token;}
bool containsNodes() const {return data.size() > 0;}
bool containsValues() const {return data.size() == 0;}
private:
Key token;
- QByteArray data;
+ TQByteArray data;
DBItemList items;
};
@@ -260,7 +260,7 @@ namespace dht
virtual void apply(DHT* dh_table);
virtual void print();
- virtual void encode(QByteArray & arr);
+ virtual void encode(TQByteArray & arr);
};
diff --git a/libktorrent/kademlia/rpcserver.cpp b/libktorrent/kademlia/rpcserver.cpp
index 1242dae..9f65b95 100644
--- a/libktorrent/kademlia/rpcserver.cpp
+++ b/libktorrent/kademlia/rpcserver.cpp
@@ -42,7 +42,7 @@ namespace dht
- RPCServer::RPCServer(DHT* dh_table,Uint16 port,QObject *parent) : QObject(parent),dh_table(dh_table),next_mtid(0),port(port)
+ RPCServer::RPCServer(DHT* dh_table,Uint16 port,TQObject *tqparent) : TQObject(tqparent),dh_table(dh_table),next_mtid(0),port(port)
{
sock = new KDatagramSocket(this);
sock->setBlocking(false);
@@ -63,7 +63,7 @@ namespace dht
void RPCServer::start()
{
sock->setBlocking(true);
- if (!sock->bind(QString::null,QString::number(port)))
+ if (!sock->bind(TQString(),TQString::number(port)))
{
Out(SYS_DHT|LOG_IMPORTANT) << "DHT: Failed to bind to UDP port " << port << " for DHT" << endl;
}
@@ -72,7 +72,7 @@ namespace dht
bt::Globals::instance().getPortList().addNewPort(port,net::UDP,true);
}
sock->setBlocking(false);
- connect(sock,SIGNAL(readyRead()),this,SLOT(readPacket()));
+ connect(sock,TQT_SIGNAL(readyRead()),this,TQT_SLOT(readPacket()));
}
void RPCServer::stop()
@@ -81,13 +81,13 @@ namespace dht
sock->close();
}
- static void PrintRawData(const QByteArray & data)
+ static void PrintRawData(const TQByteArray & data)
{
- QString tmp;
+ TQString tmp;
for (Uint32 i = 0;i < data.size();i++)
{
- char c = QChar(data[i]).latin1();
- if (!QChar(data[i]).isPrint() || c == 0)
+ char c = TQChar(data[i]).latin1();
+ if (!TQChar(data[i]).isPrint() || c == 0)
tmp += '#';
else
tmp += c;
@@ -134,10 +134,10 @@ namespace dht
msg->setOrigin(pck.address());
msg->apply(dh_table);
// erase an existing call
- if (msg->getType() == RSP_MSG && calls.contains(msg->getMTID()))
+ if (msg->getType() == RSP_MSG && calls.tqcontains(msg->getMTID()))
{
// delete the call, but first notify it off the response
- RPCCall* c = calls.find(msg->getMTID());
+ RPCCall* c = calls.tqfind(msg->getMTID());
c->response(msg);
calls.erase(msg->getMTID());
c->deleteLater();
@@ -157,7 +157,7 @@ namespace dht
}
- void RPCServer::send(const KNetwork::KSocketAddress & addr,const QByteArray & msg)
+ void RPCServer::send(const KNetwork::KSocketAddress & addr,const TQByteArray & msg)
{
sock->send(KNetwork::KDatagramPacket(msg,addr));
}
@@ -165,7 +165,7 @@ namespace dht
RPCCall* RPCServer::doCall(MsgBase* msg)
{
Uint8 start = next_mtid;
- while (calls.contains(next_mtid))
+ while (calls.tqcontains(next_mtid))
{
next_mtid++;
if (next_mtid == start) // if this happens we cannot do any calls
@@ -187,7 +187,7 @@ namespace dht
void RPCServer::sendMsg(MsgBase* msg)
{
- QByteArray data;
+ TQByteArray data;
msg->encode(data);
send(msg->getDestination(),data);
@@ -197,7 +197,7 @@ namespace dht
void RPCServer::timedOut(Uint8 mtid)
{
// delete the call
- RPCCall* c = calls.find(mtid);
+ RPCCall* c = calls.tqfind(mtid);
if (c)
{
dh_table->timeout(c->getRequest());
@@ -214,7 +214,7 @@ namespace dht
RPCCall* c = call_queue.first();
call_queue.removeFirst();
- while (calls.contains(next_mtid))
+ while (calls.tqcontains(next_mtid))
next_mtid++;
MsgBase* msg = c->getRequest();
@@ -227,7 +227,7 @@ namespace dht
const RPCCall* RPCServer::findCall(Uint8 mtid) const
{
- return calls.find(mtid);
+ return calls.tqfind(mtid);
}
void RPCServer::ping(const dht::Key & our_id,const KNetwork::KSocketAddress & addr)
diff --git a/libktorrent/kademlia/rpcserver.h b/libktorrent/kademlia/rpcserver.h
index 4e54076..393db7a 100644
--- a/libktorrent/kademlia/rpcserver.h
+++ b/libktorrent/kademlia/rpcserver.h
@@ -20,7 +20,7 @@
#ifndef DHTRPCSERVER_H
#define DHTRPCSERVER_H
-#include <qptrlist.h>
+#include <tqptrlist.h>
#include <kdatagramsocket.h>
#include <util/constants.h>
#include <util/array.h>
@@ -52,11 +52,12 @@ namespace dht
*
* Class to handle incoming and outgoing RPC messages.
*/
- class RPCServer : public QObject
+ class RPCServer : public TQObject
{
Q_OBJECT
+ TQ_OBJECT
public:
- RPCServer(DHT* dh_table,Uint16 port,QObject *parent = 0);
+ RPCServer(DHT* dh_table,Uint16 port,TQObject *tqparent = 0);
virtual ~RPCServer();
/// Start the server
@@ -105,14 +106,14 @@ namespace dht
void readPacket();
private:
- void send(const KNetwork::KSocketAddress & addr,const QByteArray & msg);
+ void send(const KNetwork::KSocketAddress & addr,const TQByteArray & msg);
void doQueuedCalls();
private:
KDatagramSocket* sock;
DHT* dh_table;
bt::PtrMap<bt::Uint8,RPCCall> calls;
- QPtrList<RPCCall> call_queue;
+ TQPtrList<RPCCall> call_queue;
bt::Uint8 next_mtid;
bt::Uint16 port;
};
diff --git a/libktorrent/kademlia/task.cpp b/libktorrent/kademlia/task.cpp
index 877a698..96e37b4 100644
--- a/libktorrent/kademlia/task.cpp
+++ b/libktorrent/kademlia/task.cpp
@@ -115,10 +115,10 @@ namespace dht
finished(this);
}
- void Task::addDHTNode(const QString & ip,bt::Uint16 port)
+ void Task::addDHTNode(const TQString & ip,bt::Uint16 port)
{
- KResolver::resolveAsync(this,SLOT(onResolverResults(KResolverResults )),
- ip,QString::number(port));
+ KResolver::resolveAsync(this,TQT_SLOT(onResolverResults(KResolverResults )),
+ ip,TQString::number(port));
}
void Task::onResolverResults(KResolverResults res)
diff --git a/libktorrent/kademlia/task.h b/libktorrent/kademlia/task.h
index 5a33ac0..3d7189f 100644
--- a/libktorrent/kademlia/task.h
+++ b/libktorrent/kademlia/task.h
@@ -20,7 +20,7 @@
#ifndef DHTTASK_H
#define DHTTASK_H
-#include <qvaluelist.h>
+#include <tqvaluelist.h>
#include "rpccall.h"
//#include "kbucket.h"
@@ -49,6 +49,7 @@ namespace dht
class Task : public RPCCallListener
{
Q_OBJECT
+ TQ_OBJECT
public:
/**
* Create a task.
@@ -134,7 +135,7 @@ namespace dht
* @param ip The ip or hostname of the node
* @param port The port
*/
- void addDHTNode(const QString & ip,bt::Uint16 port);
+ void addDHTNode(const TQString & ip,bt::Uint16 port);
signals:
/**
@@ -157,8 +158,8 @@ namespace dht
void onResolverResults(KResolverResults res);
protected:
- QValueList<KBucketEntry> visited; // nodes visited
- QValueList<KBucketEntry> todo; // nodes todo
+ TQValueList<KBucketEntry> visited; // nodes visited
+ TQValueList<KBucketEntry> todo; // nodes todo
Node* node;
private:
diff --git a/libktorrent/kademlia/taskmanager.cpp b/libktorrent/kademlia/taskmanager.cpp
index f71fc0d..4e1e21a 100644
--- a/libktorrent/kademlia/taskmanager.cpp
+++ b/libktorrent/kademlia/taskmanager.cpp
@@ -54,14 +54,14 @@ namespace dht
void TaskManager::removeFinishedTasks(const DHT* dh_table)
{
- QValueList<Uint32> rm;
+ TQValueList<Uint32> rm;
for (TaskItr i = tasks.begin();i != tasks.end();i++)
{
if (i->second->isFinished())
rm.append(i->first);
}
- for (QValueList<Uint32>::iterator i = rm.begin();i != rm.end();i++)
+ for (TQValueList<Uint32>::iterator i = rm.begin();i != rm.end();i++)
{
tasks.erase(*i);
}
diff --git a/libktorrent/kademlia/taskmanager.h b/libktorrent/kademlia/taskmanager.h
index 3df52b6..5349d8c 100644
--- a/libktorrent/kademlia/taskmanager.h
+++ b/libktorrent/kademlia/taskmanager.h
@@ -20,7 +20,7 @@
#ifndef DHTTASKMANAGER_H
#define DHTTASKMANAGER_H
-#include <qptrlist.h>
+#include <tqptrlist.h>
#include <util/ptrmap.h>
#include <util/constants.h>
#include "task.h"
@@ -60,7 +60,7 @@ namespace dht
private:
bt::PtrMap<Uint32,Task> tasks;
- QPtrList<Task> queued;
+ TQPtrList<Task> queued;
bt::Uint32 next_id;
};