Bincimap 2.0.16
Easy Imapping
Loading...
Searching...
No Matches
operators.h
Go to the documentation of this file.
1
7#ifndef operators_h_included
8#define operators_h_included
9#include <string>
10#include <vector>
11
12#include "imapparser.h"
13#include "depot.h"
14#include "message.h"
15
16namespace Binc {
17
18 //--------------------------------------------------------------------
19 class Operator {
20 public:
23
25 virtual ParseResult parse(Request &) const = 0;
26 virtual int getState(void) const = 0;
27 virtual const std::string getName(void) const = 0;
28
29 //--
30 virtual ~Operator(void) {};
31 };
32
33 //--------------------------------------------------------------------
34 class AppendOperator : public Operator {
35 public:
37 virtual ParseResult parse(Request &) const;
38 const std::string getName(void) const;
39 int getState(void) const;
40
41 AppendOperator(void);
42 ~AppendOperator(void);
43 };
44
45 //--------------------------------------------------------------------
47 public:
49 virtual ParseResult parse(Request &) const;
50
51 const std::string getName(void) const;
52 int getState(void) const;
53
54 ProcessResult Login(std::string& username, std::string& password);
55 ProcessResult Plain(std::string& username, std::string& password);
56 ProcessResult Cram(std::string& username, std::string& password,
57 std::string& challenge);
58
61 };
62
63 //--------------------------------------------------------------------
65 std::vector<std::string> capabilities;
66 public:
68 virtual ParseResult parse(Request &) const;
69
70 const std::string getName(void) const;
71 int getState(void) const;
72
73 void addCapability(const std::string &cap);
74
77 };
78
79 //--------------------------------------------------------------------
80 class CheckOperator : public Operator {
81 public:
83 virtual ParseResult parse(Request &) const;
84
85 const std::string getName(void) const;
86 int getState(void) const;
87
88 CheckOperator(void);
89 ~CheckOperator(void);
90 };
91
92 //--------------------------------------------------------------------
93 class CreateOperator : public Operator {
94 public:
96 virtual ParseResult parse(Request &) const;
97
98 const std::string getName(void) const;
99 int getState(void) const;
100
101 CreateOperator(void);
102 ~CreateOperator(void);
103 };
104
105 //--------------------------------------------------------------------
106 class CloseOperator : public Operator {
107 public:
109 virtual ParseResult parse(Request &) const;
110
111 const std::string getName(void) const;
112 int getState(void) const;
113
114 CloseOperator(void);
115 ~CloseOperator(void);
116 };
117
118 //--------------------------------------------------------------------
119 class CopyOperator : public Operator {
120 public:
122 virtual ParseResult parse(Request &) const;
123
124 const std::string getName(void) const;
125 int getState(void) const;
126
127 CopyOperator(void);
128 ~CopyOperator(void);
129 };
130
131 //--------------------------------------------------------------------
132 class DeleteOperator : public Operator {
133 public:
135 virtual ParseResult parse(Request &) const;
136
137 const std::string getName(void) const;
138 int getState(void) const;
139
140 DeleteOperator(void);
141 ~DeleteOperator(void);
142 };
143
144 //--------------------------------------------------------------------
145 class ExpungeOperator : public Operator {
146 public:
148 virtual ParseResult parse(Request &) const;
149
150 const std::string getName(void) const;
151 int getState(void) const;
152
153 ExpungeOperator(void);
154 ~ExpungeOperator(void);
155 };
156
157 //--------------------------------------------------------------------
158 class FetchOperator : public Operator {
159 protected:
165 public:
167 virtual ParseResult parse(Request &) const;
168
169 const std::string getName(void) const;
170 int getState(void) const;
171
172 FetchOperator(void);
173 ~FetchOperator(void);
174 };
175
176 //--------------------------------------------------------------------
177 class IdOperator : public Operator {
178 public:
180 virtual ParseResult parse(Request &) const;
181
182 const std::string getName(void) const;
183 int getState(void) const;
184
185 IdOperator(void);
186 ~IdOperator(void);
187 };
188
189 //--------------------------------------------------------------------
190 class IdleOperator : public Operator {
191 protected:
197 public:
199 virtual ParseResult parse(Request &) const;
200
201 const std::string getName(void) const;
202 int getState(void) const;
203
204 IdleOperator(void);
205 ~IdleOperator(void);
206 };
207
208 //--------------------------------------------------------------------
209 class ListOperator : public Operator {
210 protected:
215 DIR_LEAF = 0x08
216 };
217
218 std::map<std::string, unsigned int> cache;
220 public:
222 virtual ParseResult parse(Request &) const;
223
224 const std::string getName(void) const;
225 int getState(void) const;
226
227 ListOperator(void);
228 ~ListOperator(void);
229 };
230
231 //--------------------------------------------------------------------
232 class LoginOperator : public Operator {
233 public:
235 virtual ParseResult parse(Request &) const;
236
237 const std::string getName(void) const;
238 int getState(void) const;
239
240 LoginOperator(void);
241 ~LoginOperator(void);
242 };
243
244 //--------------------------------------------------------------------
245 class LogoutOperator : public Operator {
246 public:
248 virtual ParseResult parse(Request &) const;
249
250 const std::string getName(void) const;
251 int getState(void) const;
252
253 LogoutOperator(void);
254 ~LogoutOperator(void);
255 };
256
257 //--------------------------------------------------------------------
258 class LsubOperator : public Operator {
259 public:
261 virtual ParseResult parse(Request &) const;
262
263 const std::string getName(void) const;
264 int getState(void) const;
265
266 LsubOperator(void);
267 ~LsubOperator(void);
268 };
269
270 //--------------------------------------------------------------------
272 public:
273 virtual ProcessResult process(Depot &, Request &);
274 virtual ParseResult parse(Request &) const;
275
276 const std::string getName(void) const;
277 int getState(void) const;
278
279 NamespaceOperator(void);
280 ~NamespaceOperator(void);
281 };
282
283 //--------------------------------------------------------------------
284 class NoopOperator : public Operator {
285 public:
286 virtual ProcessResult process(Depot &, Request &);
287 virtual ParseResult parse(Request &) const;
288
289 const std::string getName(void) const;
290 int getState(void) const;
291
292 NoopOperator(void);
293 ~NoopOperator(void);
294 };
295
296 //--------------------------------------------------------------------
298 public:
300
303 };
304
305 //--------------------------------------------------------------------
306 class RenameOperator : public Operator {
307 public:
309 virtual ParseResult parse(Request &) const;
310
311 const std::string getName(void) const;
312 int getState(void) const;
313
314 RenameOperator(void);
315 ~RenameOperator(void);
316 };
317
318 //--------------------------------------------------------------------
319 class SearchOperator : public Operator {
320 protected:
322
323 //------------------------------------------------------------------
325
326 std::string date;
327 std::string astring;
328 std::string bstring;
329 unsigned int number;
330
331 int type;
332 mutable int weight;
333 const SequenceSet *bset;
334
335 std::vector<SearchNode> children;
336
337 public:
338 enum {
345 };
346
347 static bool convertDate(const std::string &date, time_t &t, const std::string &delim = "-");
348 static bool convertDateHeader(const std::string &d_in, time_t &t);
349
350 void order(void);
351
352 bool match(Mailbox *, Message *,
353 unsigned seqnr, unsigned int lastmessage,
354 unsigned int lastuid) const;
355
356 int getType(void) const;
357 int getWeight(void) const;
358 void setWeight(int i);
359
360 void init(const BincImapParserSearchKey &a);
361
362 //-
363 static bool compareNodes(const SearchNode &a,
364 const SearchNode &b)
365 {
366 return a.getWeight() < b.getWeight();
367 }
368
369 SearchNode(void);
371 };
372
373 public:
374
376 virtual ParseResult parse(Request &) const;
377
378 const std::string getName(void) const;
379 int getState(void) const;
380
381 SearchOperator(void);
382 ~SearchOperator(void);
383 };
384
385 //--------------------------------------------------------------------
386 class SelectOperator : public Operator {
387 public:
389 virtual ParseResult parse(Request &) const;
390
391 const std::string getName(void) const;
392 int getState(void) const;
393
394 SelectOperator(void);
395 ~SelectOperator(void);
396 };
397
398 //--------------------------------------------------------------------
400 public:
401 const std::string getName(void) const;
402 ExamineOperator(void);
403 ~ExamineOperator(void);
404 };
405
406 //--------------------------------------------------------------------
407 class StarttlsOperator : public Operator {
408 public:
410 virtual ParseResult parse(Request &) const;
411
412 const std::string getName(void) const;
413 int getState(void) const;
414 int goStartTLS(void) const;
415
416 StarttlsOperator(void);
417 ~StarttlsOperator(void);
418 };
419
420 //--------------------------------------------------------------------
421 class StatusOperator : public Operator {
422
423 std::map<int, Status> statuses;
424
425 public:
427 virtual ParseResult parse(Request &) const;
428
429 const std::string getName(void) const;
430 int getState(void) const;
431
432 StatusOperator(void);
433 ~StatusOperator(void);
434 };
435
436 //--------------------------------------------------------------------
437 class StoreOperator : public Operator {
438 public:
440 virtual ParseResult parse(Request &) const;
441
442 const std::string getName(void) const;
443 int getState(void) const;
444
445 StoreOperator(void);
446 ~StoreOperator(void);
447 };
448
449 //--------------------------------------------------------------------
451 public:
453 virtual ParseResult parse(Request &) const;
454
455 const std::string getName(void) const;
456 int getState(void) const;
457
458 SubscribeOperator(void);
459 ~SubscribeOperator(void);
460 };
461
462 //--------------------------------------------------------------------
464 public:
466 virtual ParseResult parse(Request &) const;
467
468 const std::string getName(void) const;
469 int getState(void) const;
470
473 };
474}
475
476#endif
virtual ParseResult parse(Request &) const
int getState(void) const
ProcessResult process(Depot &, Request &)
const std::string getName(void) const
ProcessResult Plain(std::string &username, std::string &password)
virtual ParseResult parse(Request &) const
ProcessResult Cram(std::string &username, std::string &password, std::string &challenge)
ProcessResult process(Depot &, Request &)
ProcessResult Login(std::string &username, std::string &password)
const std::string getName(void) const
virtual ParseResult parse(Request &) const
void addCapability(const std::string &cap)
ProcessResult process(Depot &, Request &)
const std::string getName(void) const
virtual ParseResult parse(Request &) const
int getState(void) const
ProcessResult process(Depot &, Request &)
const std::string getName(void) const
virtual ParseResult parse(Request &) const
int getState(void) const
ProcessResult process(Depot &, Request &)
const std::string getName(void) const
virtual ParseResult parse(Request &) const
int getState(void) const
ProcessResult process(Depot &, Request &)
const std::string getName(void) const
virtual ParseResult parse(Request &) const
int getState(void) const
ProcessResult process(Depot &, Request &)
const std::string getName(void) const
virtual ParseResult parse(Request &) const
int getState(void) const
ProcessResult process(Depot &, Request &)
const std::string getName(void) const
const std::string getName(void) const
virtual ParseResult parse(Request &) const
int getState(void) const
ProcessResult process(Depot &, Request &)
const std::string getName(void) const
virtual ParseResult parse(Request &) const
ParseResult expectFetchAtt(BincImapParserFetchAtt &f_in) const
ParseResult expectSectionText(BincImapParserFetchAtt &f_in) const
int getState(void) const
ParseResult expectHeaderList(BincImapParserFetchAtt &f_in) const
ParseResult expectOffset(BincImapParserFetchAtt &f_in) const
ProcessResult process(Depot &, Request &)
ParseResult expectSection(BincImapParserFetchAtt &f_in) const
const std::string getName(void) const
virtual ParseResult parse(Request &) const
Definition: operator-id.cc:56
int getState(void) const
Definition: operator-id.cc:38
ProcessResult process(Depot &, Request &)
Definition: operator-id.cc:46
const std::string getName(void) const
Definition: operator-id.cc:32
virtual ParseResult parse(Request &) const
int getState(void) const
ParseResult expectFetchAtt(BincImapParserFetchAtt &f_in) const
ProcessResult process(Depot &, Request &)
ParseResult expectSection(BincImapParserFetchAtt &f_in) const
ParseResult expectSectionText(BincImapParserFetchAtt &f_in) const
ParseResult expectOffset(BincImapParserFetchAtt &f_in) const
ParseResult expectHeaderList(BincImapParserFetchAtt &f_in) const
const std::string getName(void) const
virtual ParseResult parse(Request &) const
int getState(void) const
std::map< std::string, unsigned int > cache
Definition: operators.h:218
ProcessResult process(Depot &, Request &)
const std::string getName(void) const
virtual ParseResult parse(Request &) const
int getState(void) const
ProcessResult process(Depot &, Request &)
const std::string getName(void) const
virtual ParseResult parse(Request &) const
int getState(void) const
ProcessResult process(Depot &, Request &)
const std::string getName(void) const
virtual ParseResult parse(Request &) const
int getState(void) const
ProcessResult process(Depot &, Request &)
const std::string getName(void) const
The Message class provides an interface for IMAP messages.
Definition: message.h:31
virtual ParseResult parse(Request &) const
virtual ProcessResult process(Depot &, Request &)
const std::string getName(void) const
virtual ParseResult parse(Request &) const
int getState(void) const
virtual ProcessResult process(Depot &, Request &)
const std::string getName(void) const
ProcessResult process(Depot &, Request &)
virtual ParseResult parse(Request &) const =0
virtual const std::string getName(void) const =0
virtual ~Operator(void)
Definition: operators.h:30
virtual ProcessResult process(Depot &, Request &)=0
virtual int getState(void) const =0
virtual ParseResult parse(Request &) const
int getState(void) const
ProcessResult process(Depot &, Request &)
const std::string getName(void) const
bool match(Mailbox *, Message *, unsigned seqnr, unsigned int lastmessage, unsigned int lastuid) const
static bool compareNodes(const SearchNode &a, const SearchNode &b)
Definition: operators.h:363
static bool convertDate(const std::string &date, time_t &t, const std::string &delim="-")
static bool convertDateHeader(const std::string &d_in, time_t &t)
void init(const BincImapParserSearchKey &a)
virtual ParseResult parse(Request &) const
int getState(void) const
ProcessResult process(Depot &, Request &)
ParseResult expectSearchKey(BincImapParserSearchKey &s_in) const
const std::string getName(void) const
virtual ParseResult parse(Request &) const
int getState(void) const
ProcessResult process(Depot &, Request &)
const std::string getName(void) const
virtual ParseResult parse(Request &) const
int goStartTLS(void) const
ProcessResult process(Depot &, Request &)
const std::string getName(void) const
virtual ParseResult parse(Request &) const
int getState(void) const
ProcessResult process(Depot &, Request &)
const std::string getName(void) const
virtual ParseResult parse(Request &) const
int getState(void) const
ProcessResult process(Depot &, Request &)
const std::string getName(void) const
virtual ParseResult parse(Request &) const
ProcessResult process(Depot &, Request &)
const std::string getName(void) const
virtual ParseResult parse(Request &) const
ProcessResult process(Depot &, Request &)
const std::string getName(void) const
Declaration of the common items for parsing IMAP input.
Declaration of the Message class.
Definition: bincimapd.cc:9