QXmpp Version:0.3.91
|
00001 /* 00002 * Copyright (C) 2008-2011 The QXmpp developers 00003 * 00004 * Author: 00005 * Manjeet Dahiya 00006 * 00007 * Source: 00008 * http://code.google.com/p/qxmpp 00009 * 00010 * This file is a part of QXmpp library. 00011 * 00012 * This library is free software; you can redistribute it and/or 00013 * modify it under the terms of the GNU Lesser General Public 00014 * License as published by the Free Software Foundation; either 00015 * version 2.1 of the License, or (at your option) any later version. 00016 * 00017 * This library is distributed in the hope that it will be useful, 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00020 * Lesser General Public License for more details. 00021 * 00022 */ 00023 00024 00025 #ifndef QXMPPMESSAGE_H 00026 #define QXMPPMESSAGE_H 00027 00028 #include <QDateTime> 00029 #include "QXmppStanza.h" 00030 00035 00036 class QXmppMessage : public QXmppStanza 00037 { 00038 public: 00040 enum Type 00041 { 00042 Error = 0, 00043 Normal, 00044 Chat, 00045 GroupChat, 00046 Headline 00047 }; 00048 00051 enum State 00052 { 00053 None = 0, 00054 Active, 00055 Inactive, 00056 Gone, 00057 Composing, 00058 Paused, 00059 }; 00060 00061 QXmppMessage(const QString& from = "", const QString& to = "", 00062 const QString& body = "", const QString& thread = ""); 00063 ~QXmppMessage(); 00064 00065 QString body() const; 00066 void setBody(const QString&); 00067 00068 bool isAttentionRequested() const; 00069 void setAttentionRequested(bool requested); 00070 00071 QDateTime stamp() const; 00072 void setStamp(const QDateTime &stamp); 00073 00074 QXmppMessage::State state() const; 00075 void setState(QXmppMessage::State); 00076 00077 QString subject() const; 00078 void setSubject(const QString&); 00079 00080 QString thread() const; 00081 void setThread(const QString&); 00082 00083 QXmppMessage::Type type() const; 00084 void setType(QXmppMessage::Type); 00085 00087 void parse(const QDomElement &element); 00088 void toXml(QXmlStreamWriter *writer) const; 00090 00091 private: 00093 enum StampType 00094 { 00095 LegacyDelayedDelivery, 00096 DelayedDelivery, 00097 }; 00098 00099 QString getTypeStr() const; 00100 void setTypeFromStr(const QString&); 00101 00102 Type m_type; 00103 QDateTime m_stamp; 00104 StampType m_stampType; 00105 State m_state; 00106 00107 bool m_attentionRequested; 00108 QString m_body; 00109 QString m_subject; 00110 QString m_thread; 00111 }; 00112 00113 #endif // QXMPPMESSAGE_H