QXmpp Version:0.3.91
|
00001 /* 00002 * Copyright (C) 2008-2011 The QXmpp developers 00003 * 00004 * Authors: 00005 * Manjeet Dahiya 00006 * Jeremy Lainé 00007 * 00008 * Source: 00009 * http://code.google.com/p/qxmpp 00010 * 00011 * This file is a part of QXmpp library. 00012 * 00013 * This library is free software; you can redistribute it and/or 00014 * modify it under the terms of the GNU Lesser General Public 00015 * License as published by the Free Software Foundation; either 00016 * version 2.1 of the License, or (at your option) any later version. 00017 * 00018 * This library is distributed in the hope that it will be useful, 00019 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00021 * Lesser General Public License for more details. 00022 * 00023 */ 00024 00025 00026 #ifndef QXMPPUTILS_H 00027 #define QXMPPUTILS_H 00028 00029 // forward declarations of QXmlStream* classes will not work on Mac, we need to 00030 // include the whole header. 00031 // See http://lists.trolltech.com/qt-interest/2008-07/thread00798-0.html 00032 // for an explanation. 00033 #include <QXmlStreamWriter> 00034 00035 class QByteArray; 00036 class QDateTime; 00037 class QDomElement; 00038 class QString; 00039 class QStringList; 00040 00041 // XEP-0082: XMPP Date and Time Profiles 00042 QDateTime datetimeFromString(const QString &str); 00043 QString datetimeToString(const QDateTime &dt); 00044 int timezoneOffsetFromString(const QString &str); 00045 QString timezoneOffsetToString(int secs); 00046 00047 QString jidToDomain(const QString& jid); 00048 QString jidToResource(const QString& jid); 00049 QString jidToUser(const QString& jid); 00050 QString jidToBareJid(const QString& jid); 00051 00052 quint32 generateCrc32(const QByteArray &input); 00053 QByteArray generateHmacMd5(const QByteArray &key, const QByteArray &text); 00054 QByteArray generateHmacSha1(const QByteArray &key, const QByteArray &text); 00055 int generateRandomInteger(int N); 00056 QByteArray generateRandomBytes(int length); 00057 QString generateStanzaHash(int length=32); 00058 00059 void helperToXmlAddAttribute(QXmlStreamWriter* stream, const QString& name, 00060 const QString& value); 00061 void helperToXmlAddDomElement(QXmlStreamWriter* stream, 00062 const QDomElement& element, const QStringList &omitNamespaces); 00063 void helperToXmlAddTextElement(QXmlStreamWriter* stream, const QString& name, 00064 const QString& value); 00065 00066 #endif // QXMPPUTILS_H