00001 // pop3.hh - source file for the mailfilter program 00002 // Copyright (c) 2003 - 2009 Andreas Bauer <baueran@gmail.com> 00003 // 00004 // This program is free software; you can redistribute it and/or modify 00005 // it under the terms of the GNU General Public License as published by 00006 // the Free Software Foundation; either version 2 of the License, or 00007 // (at your option) any later version. 00008 // 00009 // This program is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU General Public License 00015 // along with this program; if not, write to the Free Software 00016 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 00017 // USA. 00018 00019 #ifndef POP3_HH 00020 #define POP3_HH 00021 00022 #include "header.hh" 00023 #include "protocol.hh" 00024 00025 using namespace std; 00026 00027 // True, if the server replied and its status message was anything, 00028 // but an error. 00029 #define REPLY_OK ((conn->c_read () > 0 && conn->c_reply ()) ? \ 00030 (((conn->c_reply ()->c_str ())[0] == '+') ? true : false) \ 00031 : false) 00032 00033 // This macro is similar to REPLY_OK, except it sets a flag for c_read 00034 // in order to tell the function that an entire message header is 00035 // about to be received. Further comments inside socket.cc:c_read(). 00036 #define HEADER_OK ((conn->c_read (true) > 0 && conn->c_reply ())? \ 00037 (((conn->c_reply ()->c_str ())[0] == '+') ? true : false) \ 00038 : false) 00039 00040 class POP3 : public Protocol 00041 { 00042 private: 00043 int invoke_msg_parser (const string*, 00044 const Header*) const; 00045 public: 00046 bool login (const char*, 00047 const char*, 00048 const unsigned int) const; 00049 bool logout (void) const; 00050 int remove_msg (const unsigned int) const; 00051 int status (void) const; 00052 int scan (void) const; 00053 }; 00054 00055 #endif