Bincimap 2.0.16
Easy Imapping
Loading...
Searching...
No Matches
message.h
Go to the documentation of this file.
1
7#ifndef message_h_included
8#define message_h_included
9#include <vector>
10#include <string>
11#include <time.h>
12
13#ifndef UINTMAX
14#define UINTMAX ((unsigned int)-1)
15#endif
16
17namespace Binc {
18
31 class Message {
32 public:
33
38 enum Flags {
39 F_NONE = 0x00,
40 F_SEEN = 0x01,
41 F_ANSWERED = 0x02,
42 F_DELETED = 0x04,
43 F_DRAFT = 0x08,
44 F_RECENT = 0x10,
45 F_FLAGGED = 0x20,
46 F_EXPUNGED = 0x40,
47 F_PASSED = 0x80
48 };
49
50 virtual void setUID(unsigned int) = 0;
51 virtual unsigned int getUID(void) const = 0;
52
53 virtual void setSize(unsigned int) = 0;
54 virtual unsigned int getSize(bool render = false) const = 0;
55
56 virtual void setStdFlag(unsigned char) = 0;
57 virtual void resetStdFlags(void) = 0;
58 virtual unsigned char getStdFlags(void) const = 0;
59
60 virtual void setCustomFlag(const std::string &flag) = 0;
61 virtual void removeCustomFlag(const std::string &flag) = 0;
62 virtual void resetCustomFlags(void) = 0;
63 virtual std::vector<std::string> getCustomFlags(void) const = 0;
64
65 virtual void setFlagsUnchanged(void) = 0;
66 virtual bool hasFlagsChanged(void) const = 0;
67
68 virtual void setInternalDate(time_t) = 0;
69 virtual time_t getInternalDate(void) const = 0;
70
71 // virtual void rewind(void) = 0;
72 virtual int readChunk(std::string &) = 0;
73 virtual bool appendChunk(const std::string &) = 0;
74 virtual void close(void) = 0;
75
76 virtual void setExpunged(void) = 0;
77 virtual void setUnExpunged(void) = 0;
78 virtual bool isExpunged(void) const = 0;
79
80 virtual const std::string &getHeader(const std::string &header) = 0;
81
82 virtual bool headerContains(const std::string &header,
83 const std::string &text) = 0;
84
85 virtual bool bodyContains(const std::string &text) = 0;
86 virtual bool textContains(const std::string &text) = 0;
87
88 virtual bool printBodyStructure(bool extended = true) const = 0;
89
90 virtual bool printEnvelope(void) const = 0;
91
92 virtual bool printHeader(const std::string &section,
93 std::vector<std::string> headers,
94 bool includeHeaders = false,
95 unsigned int startOffset = 0,
96 unsigned int length = UINTMAX,
97 bool mime = false) const = 0;
98
99 virtual unsigned int getHeaderSize(const std::string &section,
100 std::vector<std::string> headers,
101 bool includeHeaders = false,
102 unsigned int startOffset = 0,
103 unsigned int length = UINTMAX,
104 bool mime = false) const = 0;
105
106 virtual bool printBody(const std::string &section,
107 unsigned int startOffset = 0,
108 unsigned int length = UINTMAX) const = 0;
109
110 virtual unsigned int getBodySize(const std::string &section,
111 unsigned int startOffset = 0,
112 unsigned int length = UINTMAX) const = 0;
113
114 virtual bool printDoc(unsigned int startOffset = 0,
115 unsigned int length = UINTMAX,
116 bool onlyText = false) const = 0;
117
118 virtual unsigned int getDocSize(unsigned int startOffset = 0,
119 unsigned int length = UINTMAX,
120 bool onlyText = false) const = 0;
121
122 Message(void);
123 virtual ~Message(void);
124
125 void setLastError(const std::string &) const;
126 const std::string &getLastError(void) const;
127
128 private:
129 static std::string lastError;
130 };
131
132 inline Message::Message(void)
133 {
134 }
135
136 inline Message::~Message(void)
137 {
138 }
139
140 inline void Message::setLastError(const std::string &error) const
141 {
142 lastError = error;
143 }
144
145 inline const std::string &Message::getLastError(void) const
146 {
147 return lastError;
148 }
149}
150
151#endif
The Message class provides an interface for IMAP messages.
Definition: message.h:31
virtual void setInternalDate(time_t)=0
virtual ~Message(void)
Definition: message.h:136
virtual bool printEnvelope(void) const =0
virtual void setUnExpunged(void)=0
virtual time_t getInternalDate(void) const =0
virtual bool textContains(const std::string &text)=0
virtual void close(void)=0
virtual unsigned int getUID(void) const =0
virtual unsigned int getBodySize(const std::string &section, unsigned int startOffset=0, unsigned int length=UINTMAX) const =0
virtual void setFlagsUnchanged(void)=0
virtual void setCustomFlag(const std::string &flag)=0
virtual void resetStdFlags(void)=0
virtual bool printDoc(unsigned int startOffset=0, unsigned int length=UINTMAX, bool onlyText=false) const =0
virtual void setExpunged(void)=0
virtual bool printBody(const std::string &section, unsigned int startOffset=0, unsigned int length=UINTMAX) const =0
virtual bool printHeader(const std::string &section, std::vector< std::string > headers, bool includeHeaders=false, unsigned int startOffset=0, unsigned int length=UINTMAX, bool mime=false) const =0
virtual bool isExpunged(void) const =0
virtual unsigned int getSize(bool render=false) const =0
virtual void setUID(unsigned int)=0
virtual void setStdFlag(unsigned char)=0
virtual unsigned int getHeaderSize(const std::string &section, std::vector< std::string > headers, bool includeHeaders=false, unsigned int startOffset=0, unsigned int length=UINTMAX, bool mime=false) const =0
virtual bool appendChunk(const std::string &)=0
virtual bool bodyContains(const std::string &text)=0
virtual void setSize(unsigned int)=0
Message(void)
Definition: message.h:132
virtual const std::string & getHeader(const std::string &header)=0
virtual unsigned char getStdFlags(void) const =0
virtual int readChunk(std::string &)=0
virtual bool printBodyStructure(bool extended=true) const =0
const std::string & getLastError(void) const
Definition: message.h:145
virtual std::vector< std::string > getCustomFlags(void) const =0
virtual void resetCustomFlags(void)=0
virtual void removeCustomFlag(const std::string &flag)=0
void setLastError(const std::string &) const
Definition: message.h:140
virtual unsigned int getDocSize(unsigned int startOffset=0, unsigned int length=UINTMAX, bool onlyText=false) const =0
virtual bool headerContains(const std::string &header, const std::string &text)=0
virtual bool hasFlagsChanged(void) const =0
#define UINTMAX
Definition: message.h:14
Definition: bincimapd.cc:9