[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdenetwork/kopete/protocols/groupwise/libgroupwise
From:       Will Stephenson <wstephenson () kde ! org>
Date:       2008-05-08 15:49:54
Message-ID: 1210261794.939259.4704.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 805433 by wstephens:

get the field tag comparison working again

 M  +29 -9     gwfield.cpp  
 M  +6 -2      gwfield.h  
 M  +10 -4     responseprotocol.cpp  


--- trunk/KDE/kdenetwork/kopete/protocols/groupwise/libgroupwise/gwfield.cpp \
#805432:805433 @@ -151,7 +151,7 @@
 {
 	const FieldListIterator myEnd = end();
 	if ( !offset )
-//		kDebug() << ( recursive ? ", recursively" : ", non-recursive" );
+		kDebug() << ( recursive ? ", recursively" : ", non-recursive" );
 	for( FieldListIterator it = begin(); it != myEnd; ++it )
 	{
 		QString s;
@@ -163,7 +163,7 @@
 			s.append( " :" );
 			s.append( sf->value().toString() );
 		}
-//		kDebug() << s;
+		kDebug() << s;
 		if ( recursive )
 		{
 			MultiField * mf;
@@ -218,15 +218,15 @@
 
 /* === FieldBase ========================================================= */
 
-FieldBase::FieldBase( QLatin1String tag, quint8 method, quint8 flags, quint8 type )
+FieldBase::FieldBase( const QByteArray & tag, quint8 method, quint8 flags, quint8 \
type )  : m_tag( tag ), m_method( method ), m_flags( flags ), m_type( type )
 {
-
+	kDebug() << "tag is :" << m_tag;
 }
 
 QLatin1String FieldBase::tag() const
 {
-	return m_tag;
+	return QLatin1String( m_tag );
 }
 
 quint8 FieldBase::method() const
@@ -251,16 +251,26 @@
 
 /* === SingleField ========================================================= */
 
-SingleField::SingleField( QLatin1String tag, quint8 method, quint8 flags, quint8 \
type, QVariant value ) +SingleField::SingleField( const QByteArray & tag, quint8 \
method, quint8 flags, quint8 type, QVariant value )  : FieldBase( tag, method, flags, \
type ), m_value( value )  {
 }
 
-SingleField::SingleField( QLatin1String tag, quint8 flags, quint8 type, QVariant \
value ) +SingleField::SingleField( QLatin1String tag, quint8 method, quint8 flags, \
quint8 type, QVariant value ) +: FieldBase( tag.latin1(), method, flags, type ), \
m_value( value ) +{
+}
+
+SingleField::SingleField( const QByteArray & tag, quint8 flags, quint8 type, \
QVariant value )  : FieldBase( tag, NMFIELD_METHOD_VALID, flags, type ), m_value( \
value )  {
 }
 
+SingleField::SingleField( QLatin1String tag, quint8 flags, quint8 type, QVariant \
value ) +: FieldBase( tag.latin1(), NMFIELD_METHOD_VALID, flags, type ), m_value( \
value ) +{
+}
+
 SingleField::~SingleField()
 {
 }
@@ -277,16 +287,26 @@
 
 /* === MultiField ========================================================= */
 
-MultiField::MultiField( QLatin1String tag, quint8 method, quint8 flags, quint8 type, \
FieldList fields ) +MultiField::MultiField( const QByteArray & tag, quint8 method, \
quint8 flags, quint8 type, FieldList fields )  : FieldBase( tag, method, flags, type \
), m_fields( fields )  {
 }
 
-MultiField::MultiField( QLatin1String tag, quint8 method, quint8 flags, quint8 type \
) +MultiField::MultiField( const QByteArray & tag, quint8 method, quint8 flags, \
quint8 type )  : FieldBase( tag, method, flags, type )
 {
 }
 
+MultiField::MultiField( QLatin1String tag, quint8 method, quint8 flags, quint8 type, \
FieldList fields ) +: FieldBase( tag.latin1(), method, flags, type ), m_fields( \
fields ) +{
+}
+
+MultiField::MultiField( QLatin1String tag, quint8 method, quint8 flags, quint8 type \
) +: FieldBase( tag.latin1(), method, flags, type )
+{
+}
+
 MultiField::~MultiField()
 {
 	m_fields.purge();
--- trunk/KDE/kdenetwork/kopete/protocols/groupwise/libgroupwise/gwfield.h \
#805432:805433 @@ -174,7 +174,7 @@
 	{
 	public:
 //		FieldBase() {}
-		FieldBase( QLatin1String tag, quint8 method, quint8 flags, quint8 type );
+		FieldBase( const QByteArray & tag, quint8 method, quint8 flags, quint8 type );
 		virtual ~FieldBase() {}
 		QLatin1String tag() const;
 		quint8 method() const;
@@ -182,7 +182,7 @@
 		quint8 type() const;
 		void setFlags( const quint8 flags );
 	protected:
-		QLatin1String m_tag;
+		QByteArray m_tag;
 		quint8 m_method;
 		quint8 m_flags;
 		quint8 m_type;  // doch needed
@@ -249,10 +249,12 @@
 		/** 
 		 * Single field constructor
 		 */
+		SingleField( const QByteArray & tag, quint8 method, quint8 flags, quint8 type, \
QVariant value );  SingleField( QLatin1String tag, quint8 method, quint8 flags, \
quint8 type, QVariant value );  /** 
 		 * Convenience constructor for NMFIELD_METHOD_VALID fields
 		 */
+		SingleField( const QByteArray & tag, quint8 flags, quint8 type, QVariant value );
 		SingleField( QLatin1String tag, quint8 flags, quint8 type, QVariant value );
 		~SingleField();
 		void setValue( const QVariant v );
@@ -268,6 +270,8 @@
 	class MultiField : public FieldBase
 	{
 	public:  
+		MultiField( const QByteArray & tag, quint8 method, quint8 flags, quint8 type );
+		MultiField( const QByteArray & tag, quint8 method, quint8 flags, quint8 type, \
FieldList fields );  MultiField( QLatin1String tag, quint8 method, quint8 flags, \
quint8 type );  MultiField( QLatin1String tag, quint8 method, quint8 flags, quint8 \
type, FieldList fields );  ~MultiField();
--- trunk/KDE/kdenetwork/kopete/protocols/groupwise/libgroupwise/responseprotocol.cpp \
#805432:805433 @@ -18,6 +18,7 @@
 
 #include <QBuffer>
 #include <QByteArray>
+#include <QDebug>
 #include <QStringList>
 
 #include "response.h"
@@ -57,12 +58,12 @@
 		return 0;
 	// pull out the HTTP return code
 	int firstSpace = headerFirst.indexOf( ' ' );
-	QString rtnField = headerFirst.mid( firstSpace, headerFirst.indexOf( ' ', \
firstSpace + 1 ) ); +	QByteArray rtnField = headerFirst.mid( firstSpace + 1, 3 );
 	bool ok = true;
 	int rtnCode;
 	int packetState = -1;
 	rtnCode = rtnField.toInt( &ok );
-	debug( "CoreProtocol::readResponse() got HTTP return code " );
+	debug( QString("CoreProtocol::readResponse() got HTTP return code '%1'").arg( \
rtnCode) );  // read rest of header
 	QStringList headerRest;
 	QByteArray line;
@@ -119,6 +120,8 @@
 	int resultCode = -1;
 	Field::FieldListIterator it;
 	Field::FieldListIterator end = m_collatingFields.end();
+	qDebug() << "got " << m_collatingFields.count() << "fields";
+	m_collatingFields.dump(true);
 	it = m_collatingFields.find( Field::NM_A_SZ_TRANSACTION_ID );
 	if ( it != end )
 	{
@@ -231,6 +234,7 @@
 			// create multifield
 			debug( QString( " multi field containing: %1" ).arg( val ) );
 			Field::MultiField* m = new Field::MultiField( QLatin1String(tag.data()), method, \
0, type ); +			qDebug() << " constructed field's tag: " << m->tag();
 			currentList.append( m );
 			if ( !readFields( val, &currentList) )
 			{
@@ -238,7 +242,7 @@
 				return false;
 			}
 		}
-		else 
+		else
 		{
 		
 			if ( type == NMFIELD_TYPE_UTF8 || type == NMFIELD_TYPE_DN )
@@ -259,6 +263,7 @@
 				debug( QString( "- utf/dn single field: %1" ).arg( fieldValue ) );
 				// create singlefield
 				Field::SingleField* s = new Field::SingleField( QLatin1String(tag.data()), \
method, 0, type, fieldValue ); +				qDebug() << " constructed field's tag: " << \
s->tag();  currentList.append( s );
 			}
 			else
@@ -274,6 +279,7 @@
 				m_bytes += sizeof( quint32 );
 				debug( QString( "- numeric field: %1" ).arg( val ) );
 				Field::SingleField* s = new Field::SingleField( QLatin1String(tag.data()), \
method, 0, type, val ); +				qDebug() << " constructed field's tag: " << s->tag();
 				currentList.append( s );
 			}
 		}
@@ -314,7 +320,7 @@
 		if ( c == '\n' )
 			break;
 	}
-	return true;	
+	return true;
 }
 
 #include "responseprotocol.moc"


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic