summaryrefslogtreecommitdiffstats
path: root/src/modules/objects/class_socket.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/objects/class_socket.cpp')
-rw-r--r--src/modules/objects/class_socket.cpp102
1 files changed, 51 insertions, 51 deletions
diff --git a/src/modules/objects/class_socket.cpp b/src/modules/objects/class_socket.cpp
index f0afe3a5..4ce0b92a 100644
--- a/src/modules/objects/class_socket.cpp
+++ b/src/modules/objects/class_socket.cpp
@@ -57,7 +57,7 @@ KviScriptSocketObject::KviScriptSocketObject(KviScriptObjectClass * cla,KviScrip
{
m_uConnectionId = 0;
m_sock = KVI_INVALID_SOCKET;
- m_iStatus = KVI_SCRIPT_SOCKET_STATUS_DISCONNECTED;
+ m_itqStatus = KVI_SCRIPT_SOCKET_STATUS_DISCONNECTED;
m_uRemotePort = 0;
m_uSecondaryPort = 0;
m_pSn = 0;
@@ -68,11 +68,11 @@ KviScriptSocketObject::KviScriptSocketObject(KviScriptObjectClass * cla,KviScrip
m_uInBufferLen = 0;
m_uInDataLen = 0;
m_pOutBuffer = new KviDataBuffer();
- m_pFlushTimer = new QTimer();
+ m_pFlushTimer = new TQTimer();
m_bIpV6 = false;
m_uLocalPort = 0;
m_secondarySock = KVI_INVALID_SOCKET;
- connect(m_pFlushTimer,SIGNAL(timeout()),this,SLOT(tryFlush()));
+ connect(m_pFlushTimer,TQT_SIGNAL(timeout()),this,TQT_SLOT(tryFlush()));
}
KviScriptSocketObject::~KviScriptSocketObject()
@@ -128,7 +128,7 @@ void KviScriptSocketObject::reset()
m_pOutBuffer = new KviDataBuffer();
m_uInBufferLen = 0;
m_uInDataLen = 0;
- m_iStatus = KVI_SCRIPT_SOCKET_STATUS_DISCONNECTED;
+ m_itqStatus = KVI_SCRIPT_SOCKET_STATUS_DISCONNECTED;
m_uRemotePort = 0;
m_szRemoteIp.clear();
m_uLocalPort = 0;
@@ -218,7 +218,7 @@ void KviScriptSocketObject::reset()
the incoming connection will be automatically terminated.
!fn: $connectFailedEvent(<reason>)
- This function is called when a connection attempt fails for some reason. <reason> contains
+ This function is called when a connection attempt fails for some reason. <reason> tqcontains
the error string.[br]
This function may be called only between a call to [classfnc:socket]$connect[/classfnc]() and
the [classfnc:socket]$connectEvent[/classfnc]().
@@ -366,7 +366,7 @@ void KviScriptSocketObject::reset()
KVSO_BEGIN_REGISTERCLASS(KviKvsObject_socket,"socket","object")
- KVSO_REGISTER_HANDLER(KviKvsObject_socket,"status",functionStatus)
+ KVSO_REGISTER_HANDLER(KviKvsObject_socket,"status",functiontqStatus)
KVSO_REGISTER_HANDLER(KviKvsObject_socket,"remotePort",functionRemotePort)
KVSO_REGISTER_HANDLER(KviKvsObject_socket,"remoteIp",functionRemoteIp)
KVSO_REGISTER_HANDLER(KviKvsObject_socket,"localIp",functionLocalIp)
@@ -398,7 +398,7 @@ KVSO_BEGIN_CONSTRUCTOR(KviKvsObject_socket,KviKvsObject)
m_bUdp = false;
m_uConnectionId = 0;
m_sock = KVI_INVALID_SOCKET;
- m_iStatus = KVI_SCRIPT_SOCKET_STATUS_DISCONNECTED;
+ m_itqStatus = KVI_SCRIPT_SOCKET_STATUS_DISCONNECTED;
m_uRemotePort = 0;
m_uSecondaryPort = 0;
m_pSn = 0;
@@ -409,11 +409,11 @@ KVSO_BEGIN_CONSTRUCTOR(KviKvsObject_socket,KviKvsObject)
m_uInBufferLen = 0;
m_uInDataLen = 0;
m_pOutBuffer = new KviDataBuffer();
- m_pFlushTimer = new QTimer();
+ m_pFlushTimer = new TQTimer();
m_bIpV6 = false;
m_uLocalPort = 0;
m_secondarySock = KVI_INVALID_SOCKET;
- connect(m_pFlushTimer,SIGNAL(timeout()),this,SLOT(tryFlush()));
+ connect(m_pFlushTimer,TQT_SIGNAL(timeout()),this,TQT_SLOT(tryFlush()));
KVSO_END_CONSTRUCTOR(KviKvsObject_socket)
KVSO_BEGIN_DESTRUCTOR(KviKvsObject_socket)
@@ -430,15 +430,15 @@ KVSO_END_DESTRUCTOR(KviKvsObject_socket)
//----------------------
-bool KviKvsObject_socket::functionStatus(KviKvsObjectFunctionCall *c)
+bool KviKvsObject_socket::functiontqStatus(KviKvsObjectFunctionCall *c)
{
- c->returnValue()->setInteger(m_iStatus);
+ c->returnValue()->setInteger(m_itqStatus);
return true;
}
bool KviKvsObject_socket::functionClose(KviKvsObjectFunctionCall *c)
{
- if((m_pOutBuffer->size() != 0) && (m_iStatus == KVI_SCRIPT_SOCKET_STATUS_CONNECTED))
+ if((m_pOutBuffer->size() != 0) && (m_itqStatus == KVI_SCRIPT_SOCKET_STATUS_CONNECTED))
tryFlush();
reset();
@@ -523,18 +523,18 @@ bool KviKvsObject_socket::functionAccept(KviKvsObjectFunctionCall *c)
bool KviKvsObject_socket::functionSetProtocol(KviKvsObjectFunctionCall *c)
{
- QString m_szHex;
+ TQString m_szHex;
KVSO_PARAMETERS_BEGIN(c)
KVSO_PARAMETER("hex_string",KVS_PT_STRING,0,m_szHex)
KVSO_PARAMETERS_END(c)
- m_bUdp=KviQString::equalCI(m_szHex,"udp");
+ m_bUdp=KviTQString::equalCI(m_szHex,"udp");
return false;
}
bool KviKvsObject_socket::functionWriteHex(KviKvsObjectFunctionCall *c)
{
- QString m_szHex;
+ TQString m_szHex;
KVSO_PARAMETERS_BEGIN(c)
KVSO_PARAMETER("hex_string",KVS_PT_STRING,0,m_szHex)
KVSO_PARAMETERS_END(c)
@@ -542,11 +542,11 @@ bool KviKvsObject_socket::functionWriteHex(KviKvsObjectFunctionCall *c)
if(m_szHex.length() > 0)
{
bool bOk;
- QString szTmp;
+ TQString szTmp;
szTmp=m_szHex.setNum(m_szHex.toInt(&bOk,16),16);
if(szTmp.length()>0)
{
- KviQCString szData8 = szTmp.utf8();
+ KviTQCString szData8 = szTmp.utf8();
m_pOutBuffer->append((const unsigned char *)(szData8.data()),szData8.length());
delayedFlush(0);
c->returnValue()->setInteger(szData8.length());
@@ -591,7 +591,7 @@ bool KviKvsObject_socket::functionConnect(KviKvsObjectFunctionCall *c)
c->warning(__tr2qs("Value %d for port is out of range (values allowed are from 0 to 65535"),m_uRemotePort);
return true;
}
- if((m_sock != KVI_INVALID_SOCKET) || (m_iStatus != KVI_SCRIPT_SOCKET_STATUS_DISCONNECTED))
+ if((m_sock != KVI_INVALID_SOCKET) || (m_itqStatus != KVI_SCRIPT_SOCKET_STATUS_DISCONNECTED))
{
c->warning(__tr2qs("Another connection in progress"));
c->returnValue()->setBoolean(true);
@@ -608,11 +608,11 @@ bool KviKvsObject_socket::functionConnect(KviKvsObjectFunctionCall *c)
debug ("ok connecting");
debug ("connectinhg on ip %s ",m_szRemoteIp.latin1());
debug ("non so ip");
- m_iStatus = KVI_SCRIPT_SOCKET_STATUS_CONNECTING;
+ m_itqStatus = KVI_SCRIPT_SOCKET_STATUS_CONNECTING;
delayedConnect();
} else {
debug ("connectinhg on ip %s port %d",m_szRemoteIp.latin1(),m_uRemotePort);
- m_iStatus = KVI_SCRIPT_SOCKET_STATUS_DNS;
+ m_itqStatus = KVI_SCRIPT_SOCKET_STATUS_DNS;
delayedLookupRemoteIp();
}
c->returnValue()->setBoolean(true);
@@ -626,14 +626,14 @@ bool KviKvsObject_socket::functionConnect(KviKvsObjectFunctionCall *c)
bool KviKvsObject_socket::functionListen(KviKvsObjectFunctionCall *c)
{
- if((m_sock != KVI_INVALID_SOCKET) || (m_iStatus != KVI_SCRIPT_SOCKET_STATUS_DISCONNECTED))
+ if((m_sock != KVI_INVALID_SOCKET) || (m_itqStatus != KVI_SCRIPT_SOCKET_STATUS_DISCONNECTED))
{
c->warning(__tr2qs("Another connection in progress"));
c->returnValue()->setBoolean(false);
return true;
}
kvs_uint_t uLocalPort;
- QString m_szLocalIp;
+ TQString m_szLocalIp;
bool m_bIpV6;
KVSO_PARAMETERS_BEGIN(c)
KVSO_PARAMETER("local_port",KVS_PT_UNSIGNEDINTEGER,0,uLocalPort)
@@ -766,11 +766,11 @@ bool KviKvsObject_socket::functionListen(KviKvsObjectFunctionCall *c)
}
// and setup the READ notifier...
- m_pSn = new QSocketNotifier(m_sock,QSocketNotifier::Read);
- QObject::connect(m_pSn,SIGNAL(activated(int)),this,SLOT(incomingConnection(int)));
+ m_pSn = new TQSocketNotifier(m_sock,TQSocketNotifier::Read);
+ TQObject::connect(m_pSn,TQT_SIGNAL(activated(int)),this,TQT_SLOT(incomingConnection(int)));
m_pSn->setEnabled(true);
- m_iStatus = KVI_SCRIPT_SOCKET_STATUS_LISTENING;
+ m_itqStatus = KVI_SCRIPT_SOCKET_STATUS_LISTENING;
c->returnValue()->setBoolean(true);
return true;
@@ -846,18 +846,18 @@ void KviKvsObject_socket::acceptConnection(kvi_socket_t s,kvi_u32_t uPort,const
sareal.getStringAddress(m_szLocalIp);
}
- m_iStatus = KVI_SCRIPT_SOCKET_STATUS_CONNECTED;
+ m_itqStatus = KVI_SCRIPT_SOCKET_STATUS_CONNECTED;
- m_pSn = new QSocketNotifier((int)m_sock,QSocketNotifier::Read);
- QObject::connect(m_pSn,SIGNAL(activated(int)),this,SLOT(readNotifierFired(int)));
+ m_pSn = new TQSocketNotifier((int)m_sock,TQSocketNotifier::Read);
+ TQObject::connect(m_pSn,TQT_SIGNAL(activated(int)),this,TQT_SLOT(readNotifierFired(int)));
m_pSn->setEnabled(true);
}
void KviKvsObject_socket::delayedConnect()
{
if(m_pDelayTimer)delete m_pDelayTimer;
- m_pDelayTimer = new QTimer();
- connect(m_pDelayTimer,SIGNAL(timeout()),this,SLOT(doConnect()));
+ m_pDelayTimer = new TQTimer();
+ connect(m_pDelayTimer,TQT_SIGNAL(timeout()),this,TQT_SLOT(doConnect()));
m_pDelayTimer->start(0,true);
}
@@ -873,13 +873,13 @@ void KviKvsObject_socket::doConnect()
if(!sa.socketAddress())
{
unsigned int uOldConnectionId = m_uConnectionId;
- QString ipAddressError=__tr2qs("Invalid ip address ");
+ TQString ipAddressError=__tr2qs("Invalid ip address ");
ipAddressError.append(m_szRemoteIp);
KviKvsVariantList params;
- QString tmp;
- KviQString::sprintf(tmp,__tr2qs("Invalid ip address (%Q)"),&m_szRemoteIp);
+ TQString tmp;
+ KviTQString::sprintf(tmp,__tr2qs("Invalid ip address (%Q)"),&m_szRemoteIp);
params.append(new KviKvsVariant(tmp));
callFunction(this,"connectFailedEvent",&params);
/* callEventFunction("connectFailedEvent",0,new KviParameterList(
@@ -936,7 +936,7 @@ debug ("Socket created");
(void *)&sockError,&iSize))sockError=0;
}
unsigned int uOldConnectionId = m_uConnectionId;
- QString callBackError=__tr2qs("Connect failure: ");
+ TQString callBackError=__tr2qs("Connect failure: ");
callBackError.append((KviError::getDescription(KviError::translateSystemError(sockError)).utf8().data()));
callFunction(this,"connectFailedEvent",new KviKvsVariantList(
@@ -950,12 +950,12 @@ debug ("Socket created");
}
}
debug ("Socket connected");
- m_pDelayTimer = new QTimer();
- connect(m_pDelayTimer,SIGNAL(timeout()),this,SLOT(connectTimeout()));
+ m_pDelayTimer = new TQTimer();
+ connect(m_pDelayTimer,TQT_SIGNAL(timeout()),this,TQT_SLOT(connectTimeout()));
m_pDelayTimer->start(m_uConnectTimeout,true);
- m_pSn = new QSocketNotifier((int)m_sock,QSocketNotifier::Write);
- QObject::connect(m_pSn,SIGNAL(activated(int)),this,SLOT(writeNotifierFired(int)));
+ m_pSn = new TQSocketNotifier((int)m_sock,TQSocketNotifier::Write);
+ TQObject::connect(m_pSn,TQT_SIGNAL(activated(int)),this,TQT_SLOT(writeNotifierFired(int)));
m_pSn->setEnabled(true);
}
@@ -972,8 +972,8 @@ void KviKvsObject_socket::connectTimeout()
void KviKvsObject_socket::delayedLookupRemoteIp()
{
if(m_pDelayTimer)delete m_pDelayTimer;
- m_pDelayTimer = new QTimer();
- connect(m_pDelayTimer,SIGNAL(timeout()),this,SLOT(lookupRemoteIp()));
+ m_pDelayTimer = new TQTimer();
+ connect(m_pDelayTimer,TQT_SIGNAL(timeout()),this,TQT_SLOT(lookupRemoteIp()));
m_pDelayTimer->start(0,true);
}
@@ -984,7 +984,7 @@ void KviKvsObject_socket::lookupRemoteIp()
m_pDelayTimer = 0;
if(m_pDns)delete m_pDns;
m_pDns = new KviDns();
- connect(m_pDns,SIGNAL(lookupDone(KviDns *)),this,SLOT(lookupDone(KviDns *)));
+ connect(m_pDns,TQT_SIGNAL(lookupDone(KviDns *)),this,TQT_SLOT(lookupDone(KviDns *)));
if(!m_pDns->lookup(m_szRemoteIp,KviDns::Any))
{
unsigned int uOldConnectionId = m_uConnectionId;
@@ -1051,8 +1051,8 @@ void KviKvsObject_socket::writeNotifierFired(int)
} else {
// Succesfully connected
// create the correct read notifier now...
- m_pSn = new QSocketNotifier((int)m_sock,QSocketNotifier::Read);
- QObject::connect(m_pSn,SIGNAL(activated(int)),this,SLOT(readNotifierFired(int)));
+ m_pSn = new TQSocketNotifier((int)m_sock,TQSocketNotifier::Read);
+ TQObject::connect(m_pSn,TQT_SIGNAL(activated(int)),this,TQT_SLOT(readNotifierFired(int)));
m_pSn->setEnabled(true);
#ifdef COMPILE_IPV6_SUPPORT
@@ -1070,7 +1070,7 @@ void KviKvsObject_socket::writeNotifierFired(int)
KviKvsVariantList *params=0;
callFunction(this,"connectEvent",params);
if(m_uConnectionId == uOldConnectionId)
- m_iStatus = KVI_SCRIPT_SOCKET_STATUS_CONNECTED;
+ m_itqStatus = KVI_SCRIPT_SOCKET_STATUS_CONNECTED;
// else the connection has been already changed!
}
}
@@ -1110,7 +1110,7 @@ void KviKvsObject_socket::readNotifierFired(int)
if(err > 0)
{
- // QString error=KviError::translateSystemError(err);
+ // TQString error=KviError::translateSystemError(err);
callFunction(this,"disconnectEvent",new KviKvsVariantList(
new KviKvsVariant((kvs_int_t)KviError::translateSystemError(err))));
} else {
@@ -1129,7 +1129,7 @@ void KviKvsObject_socket::readNotifierFired(int)
m_uInDataLen += readLength;
//KviStr * s = new KviStr();
- QString s;
+ TQString s;
s.setNum(m_uInDataLen);
@@ -1256,7 +1256,7 @@ void KviKvsObject_socket::reset()
m_pOutBuffer = new KviDataBuffer();
m_uInBufferLen = 0;
m_uInDataLen = 0;
- m_iStatus = KVI_SCRIPT_SOCKET_STATUS_DISCONNECTED;
+ m_itqStatus = KVI_SCRIPT_SOCKET_STATUS_DISCONNECTED;
m_uRemotePort = 0;
m_szRemoteIp="";
m_uLocalPort = 0;
@@ -1284,7 +1284,7 @@ bool KviKvsObject_socket::functionRead(KviKvsObjectFunctionCall *c)
{
if(!m_pInBuffer[i])m_pInBuffer[i] = (char)(255);
}
- QString tmpBuffer = QString::fromUtf8(m_pInBuffer,uLen);
+ TQString tmpBuffer = TQString::fromUtf8(m_pInBuffer,uLen);
c->returnValue()->setString(tmpBuffer);
eatInData(uLen);
@@ -1299,7 +1299,7 @@ bool KviKvsObject_socket::functionReadHex(KviKvsObjectFunctionCall *c)
bool bOk;
if(uLen > 0)
{
- QString szTmp;
+ TQString szTmp;
szTmp =m_pInBuffer;
szTmp.toInt(&bOk,16);
c->returnValue()->setString(szTmp);
@@ -1310,12 +1310,12 @@ bool KviKvsObject_socket::functionReadHex(KviKvsObjectFunctionCall *c)
bool KviKvsObject_socket::functionWrite(KviKvsObjectFunctionCall *c)
{
- QString szData;
+ TQString szData;
KVSO_PARAMETERS_BEGIN(c)
KVSO_PARAMETER("szData",KVS_PT_STRING,0,szData)
KVSO_PARAMETERS_END(c)
-KviQCString szData8 = szData.utf8();
+KviTQCString szData8 = szData.utf8();
if(szData8.length() > 0)
{
m_pOutBuffer->append((const unsigned char*)szData8.data(),szData8.length());