diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:48:06 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:48:06 +0000 |
commit | 47c8a359c5276062c4bc17f0e82410f29081b502 (patch) | |
tree | 2d54a5f60a5b74067632f9ef6df58c2bc38155e6 /kopete/protocols/groupwise/libgroupwise/responseprotocol.cpp | |
parent | 6f82532777a35e0e60bbd2b290b2e93e646f349b (diff) | |
download | tdenetwork-47c8a359c5276062c4bc17f0e82410f29081b502.tar.gz tdenetwork-47c8a359c5276062c4bc17f0e82410f29081b502.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1157648 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kopete/protocols/groupwise/libgroupwise/responseprotocol.cpp')
-rw-r--r-- | kopete/protocols/groupwise/libgroupwise/responseprotocol.cpp | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/kopete/protocols/groupwise/libgroupwise/responseprotocol.cpp b/kopete/protocols/groupwise/libgroupwise/responseprotocol.cpp index 6784fd15..48ee8b88 100644 --- a/kopete/protocols/groupwise/libgroupwise/responseprotocol.cpp +++ b/kopete/protocols/groupwise/libgroupwise/responseprotocol.cpp @@ -16,13 +16,13 @@ ************************************************************************* */ -#include <qbuffer.h> +#include <tqbuffer.h> #include "response.h" #include "responseprotocol.h" -ResponseProtocol::ResponseProtocol(QObject* parent, const char* name): InputProtocolBase(parent, name) +ResponseProtocol::ResponseProtocol(TQObject* parent, const char* name): InputProtocolBase(parent, name) { } @@ -31,15 +31,15 @@ ResponseProtocol::~ResponseProtocol() { } -Transfer * ResponseProtocol::parse( const QByteArray & wire, uint & bytes ) +Transfer * ResponseProtocol::parse( const TQByteArray & wire, uint & bytes ) { m_bytes = 0; m_collatingFields.clear(); - //m_din = new QDataStream( wire, IO_ReadOnly ); - QBuffer inBuf( wire ); + //m_din = new TQDataStream( wire, IO_ReadOnly ); + TQBuffer inBuf( wire ); inBuf.open( IO_ReadOnly); m_din.setDevice( &inBuf ); - m_din.setByteOrder( QDataStream::LittleEndian ); + m_din.setByteOrder( TQDataStream::LittleEndian ); // check that this begins with a HTTP (is a response) Q_UINT32 val; @@ -49,20 +49,20 @@ Transfer * ResponseProtocol::parse( const QByteArray & wire, uint & bytes ) Q_ASSERT( qstrncmp( (const char *)&val, "HTTP", strlen( "HTTP" ) ) == 0 ); // read rest of HTTP header and look for a 301 redirect. - QCString headerFirst; + TQCString headerFirst; if ( !readGroupWiseLine( headerFirst ) ) return 0; // pull out the HTTP return code int firstSpace = headerFirst.find( ' ' ); - QString rtnField = headerFirst.mid( firstSpace, headerFirst.find( ' ', firstSpace + 1 ) ); + TQString rtnField = headerFirst.mid( firstSpace, headerFirst.find( ' ', firstSpace + 1 ) ); bool ok = true; int rtnCode; int packetState = -1; rtnCode = rtnField.toInt( &ok ); debug( "CoreProtocol::readResponse() got HTTP return code " ); // read rest of header - QStringList headerRest; - QCString line; + TQStringList headerRest; + TQCString line; while ( line != "\r\n" ) { if ( !readGroupWiseLine( line ) ) @@ -71,7 +71,7 @@ Transfer * ResponseProtocol::parse( const QByteArray & wire, uint & bytes ) return 0; } headerRest.append( line ); - debug( QString( "- read header line - (%1) : %2" ).arg( line.length() ).arg( line.data() ) ); + debug( TQString( "- read header line - (%1) : %2" ).arg( line.length() ).arg( line.data() ) ); } debug( "ResponseProtocol::readResponse() header finished" ); // if it's a redirect, set flag @@ -85,14 +85,14 @@ Transfer * ResponseProtocol::parse( const QByteArray & wire, uint & bytes ) // other header processing ( 500! ) if ( ok && rtnCode == 500 ) { - debug( QString( "- server error %1" ).arg( rtnCode ) ); + debug( TQString( "- server error %1" ).arg( rtnCode ) ); packetState = ServerError; m_din.unsetDevice(); return 0; } if ( ok && rtnCode == 404 ) { - debug( QString( "- server error %1" ).arg( rtnCode ) ); + debug( TQString( "- server error %1" ).arg( rtnCode ) ); packetState = ServerError; m_din.unsetDevice(); return 0; @@ -123,7 +123,7 @@ Transfer * ResponseProtocol::parse( const QByteArray & wire, uint & bytes ) if ( sf ) { tId = sf->value().toInt(); - debug( QString( "ResponseProtocol::readResponse() - transaction ID is %1" ).arg( tId ) ); + debug( TQString( "ResponseProtocol::readResponse() - transaction ID is %1" ).arg( tId ) ); m_collatingFields.remove( it ); delete sf; } @@ -135,7 +135,7 @@ Transfer * ResponseProtocol::parse( const QByteArray & wire, uint & bytes ) if ( sf ) { resultCode = sf->value().toInt(); - debug( QString( "ResponseProtocol::readResponse() - result code is %1" ).arg( resultCode ) ); + debug( TQString( "ResponseProtocol::readResponse() - result code is %1" ).arg( resultCode ) ); m_collatingFields.remove( it ); delete sf; } @@ -143,7 +143,7 @@ Transfer * ResponseProtocol::parse( const QByteArray & wire, uint & bytes ) // append to inQueue if ( tId ) { - debug( QString( "ResponseProtocol::readResponse() - setting state Available, got %1 fields in base array" ).arg(m_collatingFields.count() ) ); + debug( TQString( "ResponseProtocol::readResponse() - setting state Available, got %1 fields in base array" ).arg(m_collatingFields.count() ) ); packetState = Available; bytes = m_bytes; m_din.unsetDevice(); @@ -169,7 +169,7 @@ bool ResponseProtocol::readFields( int fieldCount, Field::FieldList * list ) // if we find the beginning of a new nested list, push the current list onto m_collatingFields debug( "ResponseProtocol::readFields()" ); if ( fieldCount > 0 ) - debug( QString( "reading %1 fields" ).arg( fieldCount ) ); + debug( TQString( "reading %1 fields" ).arg( fieldCount ) ); Field::FieldList currentList; while ( fieldCount != 0 ) // prevents bad input data from ruining our day { @@ -177,7 +177,7 @@ bool ResponseProtocol::readFields( int fieldCount, Field::FieldList * list ) // read field Q_UINT8 type, method; Q_UINT32 val; - QCString tag; + TQCString tag; // read uint8 type if ( !okToProceed() ) { @@ -209,7 +209,7 @@ bool ResponseProtocol::readFields( int fieldCount, Field::FieldList * list ) return false; } - debug( QString( "- type: %1, method: %2, tag: %3," ).arg( type ).arg( method ).arg( tag.data() ) ); + debug( TQString( "- type: %1, method: %2, tag: %3," ).arg( type ).arg( method ).arg( tag.data() ) ); // if multivalue or array if ( type == NMFIELD_TYPE_MV || type == NMFIELD_TYPE_ARRAY ) { @@ -223,7 +223,7 @@ bool ResponseProtocol::readFields( int fieldCount, Field::FieldList * list ) m_bytes += sizeof( Q_UINT32 ); // create multifield - debug( QString( " multi field containing: %1" ).arg( val ) ); + debug( TQString( " multi field containing: %1" ).arg( val ) ); Field::MultiField* m = new Field::MultiField( tag, method, 0, type ); currentList.append( m ); if ( !readFields( val, ¤tList) ) @@ -237,7 +237,7 @@ bool ResponseProtocol::readFields( int fieldCount, Field::FieldList * list ) if ( type == NMFIELD_TYPE_UTF8 || type == NMFIELD_TYPE_DN ) { - QCString rawData; + TQCString rawData; if( !safeReadBytes( rawData, val ) ) { currentList.purge(); @@ -249,8 +249,8 @@ bool ResponseProtocol::readFields( int fieldCount, Field::FieldList * list ) break; } // convert to unicode - ignore the terminating NUL, because Qt<3.3.2 doesn't sanity check val. - QString fieldValue = QString::fromUtf8( rawData.data(), val - 1 ); - debug( QString( "- utf/dn single field: %1" ).arg( fieldValue ) ); + TQString fieldValue = TQString::fromUtf8( rawData.data(), val - 1 ); + debug( TQString( "- utf/dn single field: %1" ).arg( fieldValue ) ); // create singlefield Field::SingleField* s = new Field::SingleField( tag, method, 0, type, fieldValue ); currentList.append( s ); @@ -266,7 +266,7 @@ bool ResponseProtocol::readFields( int fieldCount, Field::FieldList * list ) } m_din >> val; m_bytes += sizeof( Q_UINT32 ); - debug( QString( "- numeric field: %1" ).arg( val ) ); + debug( TQString( "- numeric field: %1" ).arg( val ) ); Field::SingleField* s = new Field::SingleField( tag, method, 0, type, val ); currentList.append( s ); } @@ -293,9 +293,9 @@ bool ResponseProtocol::readFields( int fieldCount, Field::FieldList * list ) return true; } -bool ResponseProtocol::readGroupWiseLine( QCString & line ) +bool ResponseProtocol::readGroupWiseLine( TQCString & line ) { - line = QCString(); + line = TQCString(); while ( true ) { Q_UINT8 c; @@ -304,7 +304,7 @@ bool ResponseProtocol::readGroupWiseLine( QCString & line ) return false; m_din >> c; m_bytes++; - line += QChar(c); + line += TQChar(c); if ( c == '\n' ) break; } |