00001 // Account.hh - source file for the mailfilter program 00002 // Copyright (c) 2000 - 2002 Andreas Bauer <baueran@in.tum.de> 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 ACCOUNT_HH 00020 #define ACCOUNT_HH 00021 00022 #define POP3 0 00023 #define IMAP 1 00024 00025 #include <string> 00026 #include <vector> 00027 #include "Header.hh" 00028 #include "Feedback.hh" 00029 #include "Connection.hh" 00030 #include "SocketConnection.hh" 00031 00032 using namespace std; 00033 00034 namespace acc { 00035 00036 class Account { 00037 public: 00038 fb::Feedback* report; 00039 string server; 00040 int port; 00041 string user; 00042 string pass; 00043 int protocol; 00044 vector<string> msgIDs; 00045 00046 // Add more defines for other kinds of connection interfaces, for example: 00047 // #ifdef _WIN32 00048 // conn::WinSockConnection host; 00049 // #endif 00050 // You get the idea... 00051 #ifndef _WIN32 00052 conn::SocketConnection host; 00053 #else 00054 conn::WinSockConnection host; 00055 #endif 00056 00057 virtual int loginHost(void) = 0; // Returns error code why login failed, or 0 on success 00058 virtual bool logoutHost(void) = 0; // Returns FALSE if logout fails 00059 virtual int removeMessage(int) = 0; // Delete a message on the e-mail server 00060 00061 // Networking functions/wrappers 00062 int sendHost(const string&); 00063 string receiveHost(const bool); 00064 int connectHost(const string&, int, int); 00065 int disconnectHost(void); 00066 00067 public: 00068 Account(fb::Feedback*); 00069 virtual ~Account() = 0; 00070 virtual int check(void) = 0; 00071 const vector<string>& getMessageIDs(void); // Get all message IDs of already parsed message headers 00072 void addMessageIDs(const vector<string>&); // Add IDs to the pile of already parsed message headers 00073 }; 00074 00075 } 00076 00077 #endif