diff options
| author | 2009-09-01 15:22:34 +0000 | |
|---|---|---|
| committer | 2009-09-01 15:22:34 +0000 | |
| commit | 3720f17e4032b7dfc95db2e826286b16e191944a (patch) | |
| tree | ff2c799fc1539fd3f0a3b8d61afa92dc640c18ba /src/modules/objects/class_socket.cpp | |
| parent | patch for translations path (diff) | |
| download | KVIrc-3720f17e4032b7dfc95db2e826286b16e191944a.tar.gz KVIrc-3720f17e4032b7dfc95db2e826286b16e191944a.tar.bz2 KVIrc-3720f17e4032b7dfc95db2e826286b16e191944a.zip | |
Some fixes in module object
git-svn-id: https://svn.kvirc.de/svn/trunk/kvirc@3457 17fca916-40b9-46aa-a4ea-0a15b648b75c
Diffstat (limited to 'src/modules/objects/class_socket.cpp')
| -rw-r--r-- | src/modules/objects/class_socket.cpp | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/modules/objects/class_socket.cpp b/src/modules/objects/class_socket.cpp index cd807a3e9..ee0e306ac 100644 --- a/src/modules/objects/class_socket.cpp +++ b/src/modules/objects/class_socket.cpp @@ -148,12 +148,12 @@ the length of the available data in bytes.[br] You can use one of the $read* functions to obtain the data. - !fn: $read(<length>) + !fn: $read(<length>[,<hobject>]) Reads at most <length> bytes of data from the socket. If <length> is anything "outside" the available data range (<length> < 0 or <length> > available_data_length), this function returns all the available data.[br] - Please note that this function can't deal withi binary data: NULL characters are transformed to - ASCII characters 255. + By default this function can deal ascii data only: NULL characters are transformed to + ASCII characters 255. You can pass a [class]memorybuffer[/class] object to read binary data. !fn: $readHex(<length>) Reads at most <length> bytes of data from the socket. If <length> is anything "outside" the @@ -161,9 +161,9 @@ returns all the available data.[br] Returns the data encoded as hexadecimal digit string: this function can deal with binary data too. - !fn: $write(<data>) + !fn: $write(<data, files or hobject>[,length]) Writes <data> to the socket.[br] - This function can't deal with binary data (you can't send a NULL character)[br] + This function can deal with binary data passing a [class]memorybuffer[/class] object[br] Please note that when this function finishes it does not mean that the data has reached the remote end.[br] Basically it does not even mean that the data has been sent to the remote host.[br] The data is enqueued for sending and will be sent as soon as possible.[br] @@ -195,7 +195,7 @@ The return value is meaningful only if the socket is in connected or connecting state. !fn: $setProtocol(<protocol>) - Let KVIrc use TCP jr UDP protocol + Let KVIrc use TCP or UDP protocol !fn: $remotePort() Returns the port of the remote end of this socket.[br] @@ -249,7 +249,8 @@ {[br] # the connection to the server failed[br] echo "Connection failed: "$0[br] - delete $$[br] + delete $$[br]ite) + KVSO_REGISTER_HANDLER_BY_NAME(KviKvsObject_socket,w }[br] connectEvent() [br] {[br] @@ -348,7 +349,7 @@ KVSO_END_DESTRUCTOR(KviKvsObject_socket) KVSO_CLASS_FUNCTION(socket,status) { - c->returnValue()->setInteger(m_iStatus); + c->returnValue()->setInteger(m_iStatus);http://ansa.it/ return true; } @@ -489,7 +490,7 @@ KVSO_CLASS_FUNCTION(socket,write) KviKvsVariant * pVariantData; kvs_hobject_t hObject; KVSO_PARAMETERS_BEGIN(c) - KVSO_PARAMETER("data_or_file_or_",KVS_PT_VARIANT,0,pVariantData) + KVSO_PARAMETER("data_or_file_or_memorybuffer",KVS_PT_VARIANT,0,pVariantData) KVSO_PARAMETER("length",KVS_PT_UNSIGNEDINTEGER,KVS_PF_OPTIONAL,uLen) KVSO_PARAMETERS_END(c) if (pVariantData->isHObject()) @@ -515,10 +516,10 @@ KVSO_CLASS_FUNCTION(socket,write) return true; } if (!uLen) uLen=pFile->size(); - kvs_int_t siz=pFile->size(); + kvs_int_t size=pFile->size(); pFile->flush(); m_pOutBuffer->append((const unsigned char*)pFile->read(uLen).data(),uLen); - c->returnValue()->setBoolean((siz-pFile->pos()==0)); + c->returnValue()->setBoolean((size-pFile->pos()==0)); } else { @@ -536,6 +537,7 @@ KVSO_CLASS_FUNCTION(socket,write) QByteArray szData8 = szData.toUtf8(); if(szData8.length() > 0) { + debug("write on socket %s",szData8.data()); m_pOutBuffer->append((const unsigned char*)szData8.data(),szData8.length()); } } |
