AmMail.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00028 #ifndef _AmMail_h_
00029 #define _AmMail_h_
00030
00031 #include "AmThread.h"
00032 #include <stdio.h>
00033
00034 #include <string>
00035 #include <vector>
00036 #include <queue>
00037 using std::string;
00038
00042 struct Attachement
00043 {
00045
00046 FILE* fp;
00047
00049 string filename;
00051 string content_type;
00052
00053
00054
00055
00056 Attachement(FILE* _fp, const string& _file="", const string& _ct="")
00057 : fp(_fp), filename(_file), content_type(_ct) {}
00058 };
00059
00060 typedef std::vector<Attachement> Attachements;
00061
00062 class AmMail;
00063
00068 typedef void (*MailCleanUpFunction)(AmMail* mail);
00069
00074 struct AmMail
00075 {
00076 public:
00077 string from;
00078 string subject;
00079 string body;
00080 string to;
00081 string header;
00082
00084 string charset;
00085
00086 Attachements attachements;
00087
00089 MailCleanUpFunction clean_up;
00090
00091 int error_count;
00092
00093 AmMail(const string& _from, const string& _subject,
00094 const string& _to, const string& _body = "",
00095 const string& _header = "");
00096
00097 ~AmMail();
00098 };
00099
00105 class AmMailDeamon: public AmThread
00106 {
00107 static AmMailDeamon* _instance;
00108
00109 AmMutex event_fifo_mut;
00110 std::queue<AmMail*> event_fifo;
00111 AmCondition<bool> _run_cond;
00112
00113 AmMailDeamon() : _run_cond(false) {}
00114 AmMailDeamon(const AmMailDeamon&) : _run_cond(false) {}
00115 ~AmMailDeamon() {}
00116
00117 void run();
00118 void on_stop();
00119
00120 public:
00121 static AmMailDeamon* instance();
00122
00130 int sendQueued(AmMail* mail);
00131 };
00132
00133 #endif
00134
Generated on Fri May 16 12:02:05 2008 for SEMS by
1.5.1