From e2be03e254a956024c9d67b19b8a809c9692b6f1 Mon Sep 17 00:00:00 2001 From: Manjeet Dahiya Date: Tue, 20 Oct 2009 11:43:45 +0000 Subject: Using QXmlStreamWriter for directly writing to the socket. This will avoid string concatenations and problems with XML escaping rules. and Fix for Issue 19: XMPP Version < 1.0 send NonSASL Auth query --- source/QXmppBind.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'source/QXmppBind.cpp') diff --git a/source/QXmppBind.cpp b/source/QXmppBind.cpp index f7282151..1d37e025 100644 --- a/source/QXmppBind.cpp +++ b/source/QXmppBind.cpp @@ -27,6 +27,7 @@ #include "QXmppConstants.h" #include +#include QXmppBind::QXmppBind(QXmppIq::Type type) : QXmppIq(type) @@ -61,18 +62,15 @@ void QXmppBind::setResource(const QString& str) m_resource = str; } -QByteArray QXmppBind::toXmlElementFromChild() const +void QXmppBind::toXmlElementFromChild(QXmlStreamWriter *writer) const { QString data; QTextStream stream(&data); - stream << ""; - helperToXmlAddElement(stream, "jid", getJid()); - helperToXmlAddElement(stream, "resource", getResource()); - stream << ""; - - return data.toAscii(); + writer->writeStartElement("bind"); + helperToXmlAddAttribute(writer, "xmlns", ns_bind); + helperToXmlAddTextElement(writer, "jid", getJid() ); + helperToXmlAddTextElement(writer, "resource", getResource()); + writer->writeEndElement(); } -- cgit v1.2.3