00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef MESSAGE_HH
00034 #define MESSAGE_HH
00035
00036 #include <string>
00037 #include "packet.hh"
00038
00039 namespace jabberoo
00040 {
00046 class Message
00047 : public Packet
00048 {
00049 public:
00050
00051
00055 static const unsigned int numTypes;
00056
00061 enum Type {
00062 mtNormal,
00063 mtError,
00064 mtChat,
00065 mtGroupchat,
00066 mtHeadline
00067 };
00068
00074 Message(const judo::Element& t);
00075
00085 Message(const std::string& jid, const std::string& body, Type mtype = mtNormal);
00086
00087
00092 void setBody(const std::string& body);
00093
00098 void setSubject(const std::string& subject);
00099
00105 void setThread(const std::string& thread);
00106
00111 void setType(Message::Type mtype);
00112
00118 void requestDelivered();
00119
00125 void requestDisplayed();
00126
00132 void requestComposing();
00133
00134
00139 const std::string getBody() const;
00144 const std::string getSubject() const;
00149 const std::string getThread() const;
00154 Type getType() const;
00159 const std::string getDateTime(const std::string& format = "") const;
00160
00161
00167 Message replyTo(const std::string& body) const;
00168
00175 Message Message::delivered() const;
00176
00183 Message Message::displayed() const;
00184
00191 Message Message::composing() const;
00192
00193
00200 static void setDateTimeFormat(const std::string& format);
00204 static const std::string& getDateTimeFormat();
00205 protected:
00206
00207 Message(const Message& m, const std::string& body);
00208
00209 static std::string translateType(Type mtype);
00210 static Type translateType(const std::string& mtype);
00211 private:
00212 Type _type;
00213 time_t _timestamp;
00214 static std::string _dtFormat;
00215 };
00216
00217 }
00218
00219 #endif // MESSAGE_HH