[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdenetwork/kopete/protocols/oscar/liboscar/tasks
From: Roman Jarosz <kedgedev () centrum ! cz>
Date: 2008-09-09 19:39:29
Message-ID: 1220989169.970154.28761.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 859212 by rjarosz:
Parse Miranda's file transfer description.
M +25 -1 filetransfertask.cpp
M +1 -0 filetransfertask.h
--- trunk/KDE/kdenetwork/kopete/protocols/oscar/liboscar/tasks/filetransfertask.cpp #859211:859212
@@ -26,6 +26,7 @@
#include <QtNetwork/QHostAddress>
#include <QtNetwork/QTcpServer>
#include <QtNetwork/QTcpSocket>
+#include <QtXml/QDomDocument>
#include <ksocketfactory.h>
#include <krandom.h>
@@ -217,7 +218,7 @@
kDebug(OSCAR_RAW_DEBUG) << "port " << m_port;
break;
case 0x0c:
- m_desc = tlv.data; //FIXME: what codec?
+ m_desc = parseDescription( tlv.data ); //FIXME: what codec?
kDebug(OSCAR_RAW_DEBUG) << "user message: " << tlv.data;
break;
case 0x0d:
@@ -853,6 +854,29 @@
return msg;
}
+QString FileTransferTask::parseDescription( const QByteArray &description ) const
+{
+ QString xmlDesc = QString::fromUtf8( description );
+ xmlDesc.replace( QLatin1String( ">" ), QLatin1String( ">" ) );
+ xmlDesc.replace( QLatin1String( "<" ), QLatin1String( "<" ) );
+ xmlDesc.replace( QLatin1String( """ ), QLatin1String( "\"" ) );
+ xmlDesc.replace( QLatin1String( " " ), QLatin1String( " " ) );
+ xmlDesc.replace( QLatin1String( "&" ), QLatin1String( "&" ) );
+
+ QDomDocument xmlDocument;
+ if ( !xmlDocument.setContent( xmlDesc ) )
+ {
+ kDebug(OSCAR_RAW_DEBUG) << "Cannot parse description!";
+ return QString::fromUtf8( description );
+ }
+
+ QDomNodeList descList = xmlDocument.elementsByTagName( "DESC" );
+ if ( descList.count() == 1 )
+ return descList.at( 0 ).toElement().text();
+ else
+ return QString::fromUtf8( description );
+}
+
#include "filetransfertask.moc"
//kate: space-indent off; tab-width 4; indent-mode csands;
--- trunk/KDE/kdenetwork/kopete/protocols/oscar/liboscar/tasks/filetransfertask.h #859211:859212
@@ -107,6 +107,7 @@
void doneConnect();
void connectFailed(); //tries another method of connecting
void doOft();
+ QString parseDescription( const QByteArray &description ) const;
Oscar::OFTRendezvous m_oftRendezvous;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic