pop3.h

Go to the documentation of this file.
00001 //
00002 // Copyright 2002, Lowell Boggs Jr.
00003 //
00004 // This file or directory, containing source code for a computer program,
00005 // is Copyrighted by Lowell Boggs, Jr.  987 Regency Drive, Lewisville
00006 // TX (USA), 75067.  You may use, copy, modify, and distribute this
00007 // source file without charge or obligation so long as you agree to
00008 // the following:
00009 //
00010 //  1.  You must indemnify Lowell Boggs against any and all financial
00011 //      obligations caused by its use, misuse, function, or malfunction.
00012 //      Further, you acknowledge that there is no warranty of any kind,
00013 //      whatsoever.
00014 //
00015 //  2.  You agree not to attempt to patent any portion of this original
00016 //      work -- though you may attempt to patent your own extensions to
00017 //      it if you so choose.
00018 //
00019 //  3.  You keep this copyright notice with the file and all copies
00020 //      of the file and do not change it anyway except language translation.
00021 //
00022 // You are responsible for enforcing your own compliance with these
00023 // conditions and may not use this source file if you cannot agree to the
00024 // above terms and conditions.
00025 //
00026 // Warning:  not all files in this directory structure are covered by the
00027 // same copyright.  Some of them are part of the GNU source distribution
00028 // and you must obey the GPL copyright for those files.
00029 
00030 #ifndef POP3_CLASS_HEADER
00031 #define POP3_CLASS_HEADER
00032 
00033 #include <string>
00034 #include <list>
00035 #include <cxxtls/file.h>
00036 
00037 class POP3
00038   //
00085   //
00086   //
00087 {
00088   struct Impl;           
00089   Impl*  impl_;          
00090 
00091 public:
00092 
00093   typedef std::string            string;
00094   typedef std::list<string>      stringlist_t;
00095 
00096   enum constants
00097   {
00098     ok,                          // must be zero
00099     connected,
00100     not_connected,
00101     connect_failed,
00102     last_constant
00103   };
00104 
00105   POP3();
00106  ~POP3();
00107 
00108   char const* connect(string server, string user, string password);
00109     //
00115     //
00116                 
00117   int connect_status() const;
00118     //
00124     //
00125 
00126   void disconnect();
00127     //
00129     //
00130 
00131   struct User
00132   {
00133     string email_address_;  
00134     string user_name_;      
00135 
00136     User(string const &email="")
00137     : email_address_(email)
00138     {
00139     }
00140 
00141   };
00142 
00143   typedef std::list<User>  userlist_t;
00144 
00145   struct Header
00146   {
00147     userlist_t        to_;        
00148     userlist_t        from_;      
00149     userlist_t        bcc_;       
00150     string            subject_;   
00151 
00152     cxxtls::FileTime  date_;      
00153 
00154 
00155                                 
00156     stringlist_t      options_;  
00157 
00158 
00159     string            id_;        
00160   };
00161 
00162   struct Attachment
00163   {
00164     string              name_;
00165     string              mime_type_;
00166     string              encoding_;
00167     stringlist_t        lines_;
00168   };
00169 
00170   struct Body
00171   {
00172     stringlist_t             lines_;
00173     std::list<Attachment*>   attachments_;
00174 
00175   };
00176 
00177   struct Message
00178   {
00179     Header header_;
00180     Body   body_;
00181   };
00182 
00183 
00184   size_t messages() const; 
00185 
00186   char const *message_header(size_t message_number, Header **header);
00187     //
00191 
00192   char const *message_body(size_t message_number, Body **header);
00193     //
00197 
00198 
00199 };
00200 
00201 
00202 #endif
Generated on Wed Feb 29 22:50:05 2012 for CXXUtilities by  doxygen 1.6.3