Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members  

message.hh

00001 // message.hh
00002 // Jabber client library
00003 //
00004 // Original Code Copyright (C) 1999-2001 Dave Smith (dave@jabber.org)
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License, or (at your option) any later version.
00010 // 
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 // 
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019 //
00020 // Contributor(s): Julian Missig
00021 //
00022 // This Original Code has been modified by IBM Corporation. Modifications 
00023 // made by IBM described herein are Copyright (c) International Business 
00024 // Machines Corporation, 2002.
00025 //
00026 // Date             Modified by     Description of modification
00027 // 01/20/2002       IBM Corp.       Updated to libjudo 1.1.1
00028 // 2002-03-05       IBM Corp.       Updated to libjudo 1.1.5
00029 // 2002-07-09       IBM Corp.       Added Roster::getSession()
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                // Make sure numTypes is updated in jabberoo-message.cc if you add
00051                // a new Message Type
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                // Modifiers
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                // Accessors
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                // Factory methods
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                // Static class methods
00200                static void setDateTimeFormat(const std::string& format);
00204                static const std::string& getDateTimeFormat();
00205           protected:
00206                // Specialized reply-to constructor
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 } // namespace jabberoo
00218 
00219 #endif // MESSAGE_HH

Generated on Thu Jul 24 13:31:51 2003 for jabberoo by doxygen1.3-rc3