summaryrefslogtreecommitdiffstats
path: root/kopete/protocols/groupwise/libgroupwise/coreprotocol.cpp
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:48:06 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-07-31 19:48:06 +0000
commit47c8a359c5276062c4bc17f0e82410f29081b502 (patch)
tree2d54a5f60a5b74067632f9ef6df58c2bc38155e6 /kopete/protocols/groupwise/libgroupwise/coreprotocol.cpp
parent6f82532777a35e0e60bbd2b290b2e93e646f349b (diff)
downloadtdenetwork-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/coreprotocol.cpp')
-rw-r--r--kopete/protocols/groupwise/libgroupwise/coreprotocol.cpp84
1 files changed, 42 insertions, 42 deletions
diff --git a/kopete/protocols/groupwise/libgroupwise/coreprotocol.cpp b/kopete/protocols/groupwise/libgroupwise/coreprotocol.cpp
index 1e15287e..4c811eba 100644
--- a/kopete/protocols/groupwise/libgroupwise/coreprotocol.cpp
+++ b/kopete/protocols/groupwise/libgroupwise/coreprotocol.cpp
@@ -24,9 +24,9 @@
#include <iostream>
#include <stdlib.h>
-#include <qdatastream.h>
-#include <qdatetime.h>
-#include <qtextstream.h>
+#include <tqdatastream.h>
+#include <tqdatetime.h>
+#include <tqtextstream.h>
#include <kdebug.h>
@@ -62,7 +62,7 @@ url_escape_string( const char *src)
static const char hex_table[17] = "0123456789abcdef";
if (src == NULL) {
- return QCString();
+ return TQCString();
}
/* Find number of chars to escape */
@@ -73,7 +73,7 @@ url_escape_string( const char *src)
}
}
- QCString encoded((p - src) + (escape * 2) + 1);
+ TQCString encoded((p - src) + (escape * 2) + 1);
/* Escape the string */
for (p = src, q = 0; *p != '\0'; p++) {
@@ -102,7 +102,7 @@ url_escape_string( const char *src)
return encoded;
}
-CoreProtocol::CoreProtocol() : QObject()
+CoreProtocol::CoreProtocol() : TQObject()
{
m_eventProtocol = new EventProtocol( this, "eventprotocol" );
m_responseProtocol = new ResponseProtocol( this, "responseprotocol" );
@@ -117,7 +117,7 @@ int CoreProtocol::state()
return m_state;
}
-void CoreProtocol::debug( const QString &str )
+void CoreProtocol::debug( const TQString &str )
{
#ifdef LIBGW_USE_KDEBUG
kdDebug( 14191 ) << "debug: " << str << endl;
@@ -126,7 +126,7 @@ void CoreProtocol::debug( const QString &str )
#endif
}
-void CoreProtocol::addIncomingData( const QByteArray & incomingBytes )
+void CoreProtocol::addIncomingData( const TQByteArray & incomingBytes )
{
// store locally
debug( "CoreProtocol::addIncomingData()");
@@ -142,13 +142,13 @@ void CoreProtocol::addIncomingData( const QByteArray & incomingBytes )
while ( m_in.size() && ( parsedBytes = wireToTransfer( m_in ) ) )
{
transferCount++;
- debug( QString( "CoreProtocol::addIncomingData() - parsed transfer #%1 in chunk" ).arg( transferCount ) );
+ debug( TQString( "CoreProtocol::addIncomingData() - parsed transfer #%1 in chunk" ).arg( transferCount ) );
int size = m_in.size();
if ( parsedBytes < size )
{
debug( " - more data in chunk!" );
// copy the unparsed bytes into a new qbytearray and replace m_in with that
- QByteArray remainder( size - parsedBytes );
+ TQByteArray remainder( size - parsedBytes );
memcpy( remainder.data(), m_in.data() + parsedBytes, remainder.size() );
m_in = remainder;
}
@@ -182,10 +182,10 @@ Transfer* CoreProtocol::incomingTransfer()
}
}
-void cp_dump( const QByteArray &bytes )
+void cp_dump( const TQByteArray &bytes )
{
#ifdef LIBGW_DEBUG
- CoreProtocol::debug( QString( "contains: %1 bytes" ).arg( bytes.count() ) );
+ CoreProtocol::debug( TQString( "contains: %1 bytes" ).arg( bytes.count() ) );
for ( uint i = 0; i < bytes.count(); ++i )
{
printf( "%02x ", bytes[ i ] );
@@ -214,19 +214,19 @@ void CoreProtocol::outgoingTransfer( Request* outgoing )
fields.append( fld );
// convert to QByteArray
- QByteArray bytesOut;
- QTextStream dout( bytesOut, IO_WriteOnly );
- dout.setEncoding( QTextStream::Latin1 );
- //dout.setByteOrder( QDataStream::LittleEndian );
+ TQByteArray bytesOut;
+ TQTextStream dout( bytesOut, IO_WriteOnly );
+ dout.setEncoding( TQTextStream::Latin1 );
+ //dout.setByteOrder( TQDataStream::LittleEndian );
// strip out any embedded host and port in the command string
- QCString command, host, port;
+ TQCString command, host, port;
if ( request->command().section( ':', 0, 0 ) == "login" )
{
command = "login";
host = request->command().section( ':', 1, 1 ).ascii();
port = request->command().section( ':', 2, 2 ).ascii();
- debug( QString( "Host: %1 Port: %2" ).arg( host.data() ).arg( port.data() ) );
+ debug( TQString( "Host: %1 Port: %2" ).arg( host.data() ).arg( port.data() ) );
}
else
command = request->command().ascii();
@@ -246,7 +246,7 @@ void CoreProtocol::outgoingTransfer( Request* outgoing )
else
dout << "\r\n";
- debug( QString( "data out: %1" ).arg( bytesOut.data() ) );
+ debug( TQString( "data out: %1" ).arg( bytesOut.data() ) );
emit outgoingData( bytesOut );
// now convert
@@ -261,7 +261,7 @@ void CoreProtocol::fieldsToWire( Field::FieldList fields, int depth )
debug( "CoreProtocol::fieldsToWire()");
int subFieldCount = 0;
- // TODO: consider constructing this as a QStringList and then join()ing it.
+ // TODO: consider constructing this as a TQStringList and then join()ing it.
Field::FieldListIterator it;
Field::FieldListIterator end = fields.end();
Field::FieldBase* field;
@@ -269,9 +269,9 @@ void CoreProtocol::fieldsToWire( Field::FieldList fields, int depth )
{
field = *it;
//debug( " - writing a field" );
- QByteArray bytesOut;
- QDataStream dout( bytesOut, IO_WriteOnly );
- dout.setByteOrder( QDataStream::LittleEndian );
+ TQByteArray bytesOut;
+ TQDataStream dout( bytesOut, IO_WriteOnly );
+ dout.setByteOrder( TQDataStream::LittleEndian );
// these fields are ignored by Gaim's novell
if ( field->type() == NMFIELD_TYPE_BINARY || field->method() == NMFIELD_METHOD_IGNORE )
@@ -299,7 +299,7 @@ void CoreProtocol::fieldsToWire( Field::FieldList fields, int depth )
{
//debug( " - it's a single string" );
const Field::SingleField *sField = static_cast<const Field::SingleField*>( field );
-// QString encoded = KURL::encode_string( sField->value().toString(), 106 /* UTF-8 */);
+// TQString encoded = KURL::encode_string( sField->value().toString(), 106 /* UTF-8 */);
// encoded.replace( "%20", "+" );
// dout << encoded.ascii();
@@ -313,7 +313,7 @@ void CoreProtocol::fieldsToWire( Field::FieldList fields, int depth )
//debug( " - it's a multi" );
const Field::MultiField *mField = static_cast<const Field::MultiField*>( field );
subFieldCount = mField->fields().count(); // determines if we have a subarray to send after this field
- //dout << QString::number( subFieldCount ).ascii();
+ //dout << TQString::number( subFieldCount ).ascii();
snprintf( valString, NMFIELD_MAX_STR_LENGTH, "%u", subFieldCount );
break;
}
@@ -321,7 +321,7 @@ void CoreProtocol::fieldsToWire( Field::FieldList fields, int depth )
{
//debug( " - it's a number" );
const Field::SingleField *sField = static_cast<const Field::SingleField*>( field );
- //dout << QString::number( sField->value().toInt() ).ascii();
+ //dout << TQString::number( sField->value().toInt() ).ascii();
snprintf( valString, NMFIELD_MAX_STR_LENGTH, "%u", sField->value().toInt() );
}
}
@@ -329,15 +329,15 @@ void CoreProtocol::fieldsToWire( Field::FieldList fields, int depth )
// type
//dout.writeRawBytes( GW_URLVAR_TYPE, sizeof( GW_URLVAR_TYPE ) );
- //dout << QString::number( field->type() ).ascii();
- QCString typeString;
+ //dout << TQString::number( field->type() ).ascii();
+ TQCString typeString;
typeString.setNum( field->type() );
- QCString outgoing = GW_URLVAR_TAG + field->tag()
+ TQCString outgoing = GW_URLVAR_TAG + field->tag()
+ GW_URLVAR_METHOD + (char)encode_method( field->method() )
+ GW_URLVAR_VAL + (const char *)valString
+ GW_URLVAR_TYPE + typeString;
- debug( QString( "CoreProtocol::fieldsToWire - outgoing data: %1" ).arg( outgoing.data() ) );
+ debug( TQString( "CoreProtocol::fieldsToWire - outgoing data: %1" ).arg( outgoing.data() ) );
dout.writeRawBytes( outgoing.data(), outgoing.length() );
// write what we have so far, we may be calling this function recursively
//kdDebug( 14999 ) << k_funcinfo << "writing \'" << bout << "\'" << endl;
@@ -356,9 +356,9 @@ void CoreProtocol::fieldsToWire( Field::FieldList fields, int depth )
if ( depth == 0 ) // this call to the function was not recursive, so the entire request has been sent at this point
{
// very important, don't send put the \r\n on the wire as a string or it will be preceded with the string length and 0 terminated, which the server reads as a request to disconnect.
- QByteArray bytesOut;
- QDataStream dout( bytesOut, IO_WriteOnly );
- dout.setByteOrder( QDataStream::LittleEndian );
+ TQByteArray bytesOut;
+ TQDataStream dout( bytesOut, IO_WriteOnly );
+ dout.setByteOrder( TQDataStream::LittleEndian );
dout.writeRawBytes( "\r\n", 2 );
emit outgoingData( bytesOut );
debug( "CoreProtocol::fieldsToWire - request completed" );
@@ -366,13 +366,13 @@ void CoreProtocol::fieldsToWire( Field::FieldList fields, int depth )
//debug( " - method done" );
}
-int CoreProtocol::wireToTransfer( const QByteArray& wire )
+int CoreProtocol::wireToTransfer( const TQByteArray& wire )
{
// processing incoming data and reassembling it into transfers
// may be an event or a response
uint bytesParsed = 0;
- m_din = new QDataStream( wire, IO_ReadOnly );
- m_din->setByteOrder( QDataStream::LittleEndian );
+ m_din = new TQDataStream( wire, IO_ReadOnly );
+ m_din->setByteOrder( TQDataStream::LittleEndian );
// look at first four bytes and decide what to do with the chunk
Q_UINT32 val;
@@ -398,12 +398,12 @@ int CoreProtocol::wireToTransfer( const QByteArray& wire )
}
else // otherwise -> Event code
{
- debug( QString( "CoreProtocol::wireToTransfer() - looks like an EVENT: %1, length %2" ).arg( val ).arg( wire.size() ) );
+ debug( TQString( "CoreProtocol::wireToTransfer() - looks like an EVENT: %1, length %2" ).arg( val ).arg( wire.size() ) );
Transfer * t = m_eventProtocol->parse( wire, bytesParsed );
if ( t )
{
m_inTransfer = t;
- debug( QString( "CoreProtocol::wireToTransfer() - got an EVENT: %1, parsed: %2" ).arg( val ).arg( bytesParsed ) );
+ debug( TQString( "CoreProtocol::wireToTransfer() - got an EVENT: %1, parsed: %2" ).arg( val ).arg( bytesParsed ) );
m_state = Available;
emit incomingData();
}
@@ -423,9 +423,9 @@ void CoreProtocol::reset()
m_in.resize( 0 );
}
-QChar CoreProtocol::encode_method( Q_UINT8 method )
+TQChar CoreProtocol::encode_method( Q_UINT8 method )
{
- QChar str;
+ TQChar str;
switch (method) {
case NMFIELD_METHOD_EQUAL:
@@ -484,9 +484,9 @@ QChar CoreProtocol::encode_method( Q_UINT8 method )
return str;
}
-void CoreProtocol::slotOutgoingData( const QCString &out )
+void CoreProtocol::slotOutgoingData( const TQCString &out )
{
- debug( QString( "CoreProtocol::slotOutgoingData() %1" ).arg( out ) );
+ debug( TQString( "CoreProtocol::slotOutgoingData() %1" ).arg( out ) );
}
bool CoreProtocol::okToProceed()