From d2983aecee07161aba43ccd58ebbe50c9755641d Mon Sep 17 00:00:00 2001 From: Manjeet Dahiya Date: Sat, 5 Sep 2009 09:56:38 +0000 Subject: Fix Issue 2: problem when sending messages with < or > characters in body fields Fix Issue 3: QXmppClient::connected signal --- source/utils.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'source/utils.cpp') diff --git a/source/utils.cpp b/source/utils.cpp index abeab27b..0ee7cfaf 100644 --- a/source/utils.cpp +++ b/source/utils.cpp @@ -64,3 +64,23 @@ void log(const QByteArray& str) { QXmppLogger::getLogger()->log(str); } + +QString escapeString(const QString& str) +{ + QString strOut = str; + strOut.replace(QChar('&'), "&"); + strOut.replace(QChar('<'), "<"); + strOut.replace(QChar('>'), ">"); + strOut.replace(QChar('"'), """); + return strOut; +} + +QString unescapeString(const QString& str) +{ + QString strOut = str; + strOut.replace("<", QChar('<')); + strOut.replace(">", QChar('>')); + strOut.replace(""", QChar('"')); + strOut.replace("&", QChar('&')); + return strOut; +} -- cgit v1.2.3