00001 /* Account.hh - source file for the mailfilter program 00002 * Copyright (c) 2000 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 00020 #ifndef ACCOUNT_HH 00021 #define ACCOUNT_HH 00022 00023 #include <string> 00024 #include <vector> 00025 00026 namespace acc { 00027 00028 // Structure of a _single_ line of a header 00029 typedef struct { 00030 string descr; 00031 string content; 00032 } Line; 00033 00034 00035 // Structure of the _entire_ header of an e-mail 00036 typedef struct { 00037 int number; 00038 int size; 00039 vector<Line> lines; 00040 00041 // We store those values seperately so it's easier to log the information 00042 string sender; 00043 string subject; 00044 string date; 00045 } Header; 00046 00047 00048 class Account { 00049 protected: 00050 string server; 00051 int port; 00052 string user; 00053 string pass; 00054 vector<Header> headers; // All e-mail headers of a mail box 00055 00056 virtual int login() = 0; 00057 virtual int logout() = 0; 00058 virtual int deleteMessage(int) = 0; 00059 virtual int storeMessageHeader(string, int, int); // string contains the entire header 00060 // int#1 contains the number of the message 00061 // int#2 is the message size in bytes 00062 virtual string cleanString(string); // Removes hidden line breaks and the like 00063 00064 public: 00065 virtual ~Account() = 0; 00066 virtual int check() = 0; 00067 }; 00068 00069 } 00070 00071 #endif