00001 //************************************************************************************************************************** 00002 //* Blue HttpMail Extension 00003 //* Copyright (c) 2003-2004 Josh Harler 00004 //* 00005 //* Blue - General Purpose C++ Library 00006 //* Copyright (c) 2002-2004 Josh Harler 00007 //* 00008 //* This software is provided 'as-is', without any express or implied warranty. In no event 00009 //* will the authors be held liable for any damages arising from the use of this software. 00010 //* 00011 //* Permission is granted to anyone to use this software for any purpose, including commercial 00012 //* applications, and to alter it and redistribute it freely, subject to the following restrictions: 00013 //* 00014 //* 1. The origin of this software must not be misrepresented; you must not claim that you 00015 //* wrote the original software. If you use this software in a product, an acknowledgment in the 00016 //* product documentation would be appreciated but is not required. 00017 //* 00018 //* 2. Altered source versions must be plainly marked as such, and must not be misrepresented as 00019 //* being the original software. 00020 //* 00021 //* 3. This notice may not be removed or altered from any source distribution. 00022 //* 00023 //* 00024 //* file Blue/Extension/HttpMail/Message.h 00025 //** 00026 00027 #ifndef __blue_ext_httpmail_Message_h_included__ 00028 #define __blue_ext_httpmail_Message_h_included__ 00029 00030 // Public Headers ========================================================================================================== 00031 00032 // Extension headers 00033 #include "Blue/Extension/HttpMail/HttpMail.h" 00034 00035 // Blue library headers 00036 #include "Blue/Util/DateTime.h" 00037 00038 // Http Extension headers 00039 #include "Blue/Extension/Http/Session.h" 00040 00041 00042 // Public Defines/Enums/Typedefs/Etc. ====================================================================================== 00043 00044 // Public Classes/Structs ================================================================================================== 00045 00046 namespace blue { 00047 namespace ext { 00048 namespace httpmail { 00049 00050 /**** 00051 * Forward Declaration 00052 */ 00053 class Mailbox; 00054 00055 00068 class BLUE_EXPORT_HTTPMAIL Message 00069 { 00070 public: 00071 // =========================================================== 00072 // creation/destruction 00073 // =========================================================== 00074 00076 Message( Mailbox& mailbox, String url ); 00078 ~Message(); 00079 00080 00081 // =========================================================== 00082 // query 00083 // =========================================================== 00084 00086 String getUrl() const; 00087 00092 String getID() const; 00093 00095 bool isLoaded() const; 00097 bool isRead() const; 00098 00100 int getContentLength() const; 00106 String getFrom() const; 00108 String getSubject() const; 00110 util::DateTime getDate() const; 00111 00117 const Buffer getContent() const; 00118 00119 00120 // =========================================================== 00121 // manipulation 00122 // =========================================================== 00123 00125 void setUrl( String url ); 00126 00133 void setRead( bool read ); 00138 void setContentLength( int length ); 00143 void setFrom( String from ); 00148 void setSubject( String subject ); 00153 void setDate( util::DateTime date ); 00154 00156 void load(); 00158 void unload(); 00159 00160 00161 private: 00166 Message( const Message& ); 00168 const Message& operator=( const Message& ); 00169 00170 Mailbox& m_mailbox; 00171 String m_url; 00172 bool m_isRead; 00173 Buffer m_content; 00174 int m_contentLength; 00175 String m_from; 00176 String m_subject; 00177 util::DateTime m_date; 00178 }; 00179 00180 00181 00187 class BLUE_EXPORT_HTTPMAIL MessageLoadException :public HttpMailException 00188 { 00189 public: 00190 MessageLoadException( String desc ) 00191 :HttpMailException(desc) {} 00192 00193 virtual String getException() const { 00194 return ("MessageLoadException"); 00195 } 00196 }; 00197 00198 }}} // namespaces 00199 00200 00201 // Public External Variables =============================================================================================== 00202 00203 // Public Function Prototypes ============================================================================================== 00204 00205 // Public Inline Functions ================================================================================================= 00206 00207 #endif // include guard