QXmpp  Version:0.4.0
QXmppMessage.h
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     bool isReceiptRequested() const;
00072     void setReceiptRequested(bool requested);
00073 
00074     QString receiptId() const;
00075     void setReceiptId(const QString &id);
00076 
00077     QDateTime stamp() const;
00078     void setStamp(const QDateTime &stamp);
00079 
00080     QXmppMessage::State state() const;
00081     void setState(QXmppMessage::State);
00082 
00083     QString subject() const;
00084     void setSubject(const QString&);
00085 
00086     QString thread() const;
00087     void setThread(const QString&);
00088 
00089     QXmppMessage::Type type() const;
00090     void setType(QXmppMessage::Type);
00091 
00093     void parse(const QDomElement &element);
00094     void toXml(QXmlStreamWriter *writer) const;
00096 
00097 private:
00099     enum StampType
00100     {
00101         LegacyDelayedDelivery,  
00102         DelayedDelivery,        
00103     };
00104 
00105     QString getTypeStr() const;
00106     void setTypeFromStr(const QString&);
00107 
00108     Type m_type;
00109     QDateTime m_stamp;
00110     StampType m_stampType;
00111     State m_state;
00112 
00113     bool m_attentionRequested;
00114     QString m_body;
00115     QString m_subject;
00116     QString m_thread;
00117 
00118     // Request message receipt as per XEP-0184.
00119     QString m_receiptId;
00120     bool m_receiptRequested;
00121 };
00122 
00123 #endif // QXMPPMESSAGE_H
 All Classes Functions Enumerations Enumerator Properties