summaryrefslogtreecommitdiffstats
path: root/libkdegames/kgame/kmessageserver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libkdegames/kgame/kmessageserver.cpp')
-rw-r--r--libkdegames/kgame/kmessageserver.cpp102
1 files changed, 51 insertions, 51 deletions
diff --git a/libkdegames/kgame/kmessageserver.cpp b/libkdegames/kgame/kmessageserver.cpp
index 618a6079..69609002 100644
--- a/libkdegames/kgame/kmessageserver.cpp
+++ b/libkdegames/kgame/kmessageserver.cpp
@@ -31,8 +31,8 @@
// --------------- internal class KMessageServerSocket
-KMessageServerSocket::KMessageServerSocket (Q_UINT16 port, TQObject *parent)
- : TQServerSocket (port, 0, parent)
+KMessageServerSocket::KMessageServerSocket (TQ_UINT16 port, TQObject *tqparent)
+ : TQServerSocket (port, 0, tqparent)
{
}
@@ -50,10 +50,10 @@ void KMessageServerSocket::newConnection (int socket)
class MessageBuffer
{
public:
- MessageBuffer (Q_UINT32 clientID, const TQByteArray &messageData)
+ MessageBuffer (TQ_UINT32 clientID, const TQByteArray &messageData)
: id (clientID), data (messageData) { }
~MessageBuffer () {}
- Q_UINT32 id;
+ TQ_UINT32 id;
TQByteArray data;
};
@@ -71,9 +71,9 @@ public:
int mMaxClients;
int mGameId;
- Q_UINT16 mCookie;
- Q_UINT32 mUniqueClientNumber;
- Q_UINT32 mAdminID;
+ TQ_UINT16 mCookie;
+ TQ_UINT32 mUniqueClientNumber;
+ TQ_UINT32 mAdminID;
KMessageServerSocket* mServerSocket;
@@ -86,8 +86,8 @@ public:
// ------------------ KMessageServer
-KMessageServer::KMessageServer (Q_UINT16 cookie,TQObject* parent)
- : TQObject(parent, 0)
+KMessageServer::KMessageServer (TQ_UINT16 cookie,TQObject* tqparent)
+ : TQObject(tqparent, 0)
{
d = new KMessageServerPrivate;
d->mIsRecursive=false;
@@ -115,7 +115,7 @@ KMessageServer::~KMessageServer()
//------------------------------------- TCP/IP server stuff
-bool KMessageServer::initNetwork (Q_UINT16 port)
+bool KMessageServer::initNetwork (TQ_UINT16 port)
{
kdDebug(11001) << k_funcinfo << endl;
@@ -143,7 +143,7 @@ bool KMessageServer::initNetwork (Q_UINT16 port)
return true;
}
-Q_UINT16 KMessageServer::serverPort () const
+TQ_UINT16 KMessageServer::serverPort () const
{
if (d->mServerSocket)
return d->mServerSocket->port();
@@ -190,18 +190,18 @@ void KMessageServer::addClient (KMessageIO* client)
// Tell everyone about the new guest
// Note: The new client doesn't get this message!
- TQDataStream (msg, IO_WriteOnly) << Q_UINT32 (EVNT_CLIENT_CONNECTED) << client->id();
+ TQDataStream (msg, IO_WriteOnly) << TQ_UINT32 (EVNT_CLIENT_CONNECTED) << client->id();
broadcastMessage (msg);
// add to our list
d->mClientList.append (client);
// tell it its ID
- TQDataStream (msg, IO_WriteOnly) << Q_UINT32 (ANS_CLIENT_ID) << client->id();
+ TQDataStream (msg, IO_WriteOnly) << TQ_UINT32 (ANS_CLIENT_ID) << client->id();
client->send (msg);
// Give it the complete list of client IDs
- TQDataStream (msg, IO_WriteOnly) << Q_UINT32 (ANS_CLIENT_LIST) << clientIDs();
+ TQDataStream (msg, IO_WriteOnly) << TQ_UINT32 (ANS_CLIENT_LIST) << clientIDs();
client->send (msg);
@@ -213,7 +213,7 @@ void KMessageServer::addClient (KMessageIO* client)
else
{
// otherwise tell it who is the admin
- TQDataStream (msg, IO_WriteOnly) << Q_UINT32 (ANS_ADMIN_ID) << adminID();
+ TQDataStream (msg, IO_WriteOnly) << TQ_UINT32 (ANS_ADMIN_ID) << adminID();
client->send (msg);
}
@@ -222,7 +222,7 @@ void KMessageServer::addClient (KMessageIO* client)
void KMessageServer::removeClient (KMessageIO* client, bool broken)
{
- Q_UINT32 clientID = client->id();
+ TQ_UINT32 clientID = client->id();
if (!d->mClientList.removeRef (client))
{
kdError(11001) << k_funcinfo << ": Deleting client that wasn't added before!" << endl;
@@ -231,7 +231,7 @@ void KMessageServer::removeClient (KMessageIO* client, bool broken)
// tell everyone about the removed client
TQByteArray msg;
- TQDataStream (msg, IO_WriteOnly) << Q_UINT32 (EVNT_CLIENT_DISCONNECTED) << client->id() << (Q_INT8)broken;
+ TQDataStream (msg, IO_WriteOnly) << TQ_UINT32 (EVNT_CLIENT_DISCONNECTED) << client->id() << (TQ_INT8)broken;
broadcastMessage (msg);
// If it was the admin, select a new admin.
@@ -280,15 +280,15 @@ int KMessageServer::clientCount() const
return d->mClientList.count();
}
-TQValueList <Q_UINT32> KMessageServer::clientIDs () const
+TQValueList <TQ_UINT32> KMessageServer::clientIDs () const
{
- TQValueList <Q_UINT32> list;
+ TQValueList <TQ_UINT32> list;
for (TQPtrListIterator <KMessageIO> iter (d->mClientList); *iter; ++iter)
list.append ((*iter)->id());
return list;
}
-KMessageIO* KMessageServer::findClient (Q_UINT32 no) const
+KMessageIO* KMessageServer::findClient (TQ_UINT32 no) const
{
if (no == 0)
no = d->mAdminID;
@@ -303,12 +303,12 @@ KMessageIO* KMessageServer::findClient (Q_UINT32 no) const
return 0;
}
-Q_UINT32 KMessageServer::adminID () const
+TQ_UINT32 KMessageServer::adminID () const
{
return d->mAdminID;
}
-void KMessageServer::setAdmin (Q_UINT32 adminID)
+void KMessageServer::setAdmin (TQ_UINT32 adminID)
{
// Trying to set the the client that is already admin => nothing to do
if (adminID == d->mAdminID)
@@ -323,7 +323,7 @@ void KMessageServer::setAdmin (Q_UINT32 adminID)
d->mAdminID = adminID;
TQByteArray msg;
- TQDataStream (msg, IO_WriteOnly) << Q_UINT32 (ANS_ADMIN_ID) << adminID;
+ TQDataStream (msg, IO_WriteOnly) << TQ_UINT32 (ANS_ADMIN_ID) << adminID;
// Tell everyone about the new master
broadcastMessage (msg);
@@ -332,7 +332,7 @@ void KMessageServer::setAdmin (Q_UINT32 adminID)
//------------------------------------------- ID stuff
-Q_UINT32 KMessageServer::uniqueClientNumber() const
+TQ_UINT32 KMessageServer::uniqueClientNumber() const
{
return d->mUniqueClientNumber++;
}
@@ -345,16 +345,16 @@ void KMessageServer::broadcastMessage (const TQByteArray &msg)
(*iter)->send (msg);
}
-void KMessageServer::sendMessage (Q_UINT32 id, const TQByteArray &msg)
+void KMessageServer::sendMessage (TQ_UINT32 id, const TQByteArray &msg)
{
KMessageIO *client = findClient (id);
if (client)
client->send (msg);
}
-void KMessageServer::sendMessage (const TQValueList <Q_UINT32> &ids, const TQByteArray &msg)
+void KMessageServer::sendMessage (const TQValueList <TQ_UINT32> &ids, const TQByteArray &msg)
{
- for (TQValueListConstIterator <Q_UINT32> iter = ids.begin(); iter != ids.end(); ++iter)
+ for (TQValueListConstIterator <TQ_UINT32> iter = ids.begin(); iter != ids.end(); ++iter)
sendMessage (*iter, msg);
}
@@ -367,7 +367,7 @@ void KMessageServer::getReceivedMessage (const TQByteArray &msg)
}
//kdDebug(11001) << k_funcinfo << ": size=" << msg.size() << endl;
KMessageIO *client = (KMessageIO *) sender();
- Q_UINT32 clientID = client->id();
+ TQ_UINT32 clientID = client->id();
//TQByteArray *ta=new TQByteArray;
//ta->duplicate(msg);
@@ -395,7 +395,7 @@ void KMessageServer::processOneMessage ()
MessageBuffer *msg_buf = d->mMessageQueue.head();
- Q_UINT32 clientID = msg_buf->id;
+ TQ_UINT32 clientID = msg_buf->id;
TQBuffer in_buffer (msg_buf->data);
in_buffer.open (IO_ReadOnly);
TQDataStream in_stream (&in_buffer);
@@ -408,56 +408,56 @@ void KMessageServer::processOneMessage ()
bool unknown = false;
TQByteArray ttt=in_buffer.buffer();
- Q_UINT32 messageID;
+ TQ_UINT32 messageID;
in_stream >> messageID;
//kdDebug(11001) << k_funcinfo << ": got message with messageID=" << messageID << endl;
switch (messageID)
{
- case REQ_BROADCAST:
- out_stream << Q_UINT32 (MSG_BROADCAST) << clientID;
+ case RETQ_BROADCAST:
+ out_stream << TQ_UINT32 (MSG_BROADCAST) << clientID;
// FIXME, compiler bug?
- // this should be okay, since TQBuffer is subclass of QIODevice! :
+ // this should be okay, since TQBuffer is subclass of TQIODevice! :
// out_buffer.writeBlock (in_buffer.readAll());
- out_buffer.TQIODevice::writeBlock (in_buffer.readAll());
+ TQT_TQIODEVICE(&out_buffer)->writeBlock (in_buffer.readAll());
broadcastMessage (out_msg);
break;
- case REQ_FORWARD:
+ case RETQ_FORWARD:
{
- TQValueList <Q_UINT32> clients;
+ TQValueList <TQ_UINT32> clients;
in_stream >> clients;
- out_stream << Q_UINT32 (MSG_FORWARD) << clientID << clients;
+ out_stream << TQ_UINT32 (MSG_FORWARD) << clientID << clients;
// see above!
- out_buffer.TQIODevice::writeBlock (in_buffer.readAll());
+ TQT_TQIODEVICE(&out_buffer)->writeBlock (in_buffer.readAll());
sendMessage (clients, out_msg);
}
break;
- case REQ_CLIENT_ID:
- out_stream << Q_UINT32 (ANS_CLIENT_ID) << clientID;
+ case RETQ_CLIENT_ID:
+ out_stream << TQ_UINT32 (ANS_CLIENT_ID) << clientID;
sendMessage (clientID, out_msg);
break;
- case REQ_ADMIN_ID:
- out_stream << Q_UINT32 (ANS_ADMIN_ID) << d->mAdminID;
+ case RETQ_ADMIN_ID:
+ out_stream << TQ_UINT32 (ANS_ADMIN_ID) << d->mAdminID;
sendMessage (clientID, out_msg);
break;
- case REQ_ADMIN_CHANGE:
+ case RETQ_ADMIN_CHANGE:
if (clientID == d->mAdminID)
{
- Q_UINT32 newAdmin;
+ TQ_UINT32 newAdmin;
in_stream >> newAdmin;
setAdmin (newAdmin);
}
break;
- case REQ_REMOVE_CLIENT:
+ case RETQ_REMOVE_CLIENT:
if (clientID == d->mAdminID)
{
- TQValueList <Q_UINT32> client_list;
+ TQValueList <TQ_UINT32> client_list;
in_stream >> client_list;
- for (TQValueListIterator <Q_UINT32> iter = client_list.begin(); iter != client_list.end(); ++iter)
+ for (TQValueListIterator <TQ_UINT32> iter = client_list.begin(); iter != client_list.end(); ++iter)
{
KMessageIO *client = findClient (*iter);
if (client)
@@ -468,18 +468,18 @@ void KMessageServer::processOneMessage ()
}
break;
- case REQ_MAX_NUM_CLIENTS:
+ case RETQ_MAX_NUM_CLIENTS:
if (clientID == d->mAdminID)
{
- Q_INT32 maximum_clients;
+ TQ_INT32 maximum_clients;
in_stream >> maximum_clients;
setMaxClients (maximum_clients);
}
break;
- case REQ_CLIENT_LIST:
+ case RETQ_CLIENT_LIST:
{
- out_stream << Q_UINT32 (ANS_CLIENT_LIST) << clientIDs();
+ out_stream << TQ_UINT32 (ANS_CLIENT_LIST) << clientIDs();
sendMessage (clientID, out_msg);
}
break;