27 |
|
} |
28 |
|
} |
29 |
|
|
30 |
< |
void Poller::poll(bool nodelete, const string& file) |
30 |
> |
void Poller::poll(bool nodelete, const string& file, bool approve) |
31 |
|
{ |
32 |
|
this->nodelete = nodelete; |
33 |
|
this->file = file; |
34 |
|
|
35 |
|
load(); |
36 |
|
|
37 |
< |
ballots(); |
38 |
< |
approvals(); |
37 |
> |
session->select('\"' + account.getMailbox() + '\"'); |
38 |
> |
|
39 |
> |
if (!approve) |
40 |
> |
{ |
41 |
> |
ballots(); |
42 |
> |
} |
43 |
> |
else |
44 |
> |
{ |
45 |
> |
approvals(); |
46 |
> |
} |
47 |
|
|
48 |
|
save(); |
49 |
|
} |
116 |
|
fin.get(); |
117 |
|
} |
118 |
|
|
119 |
< |
fin.peek(); |
119 |
> |
if (fin.peek() == EOF) fin.get(); |
120 |
|
|
121 |
|
switch (type) |
122 |
|
{ |
258 |
|
|
259 |
|
void Poller::ballots() |
260 |
|
{ |
261 |
< |
session->select('\"' + account.getMailbox() + '\"'); |
261 |
> |
istringstream search(session->search(string("ALL HEADER X-Mailer \"WinXPFA") |
262 |
> |
+ "QPoll 1.0 (Perl)\" SUBJECT \"Windows XP FAQ | Poll Ballot\" FROM \"W" |
263 |
> |
+ "indows XP FAQ | Poll\"")); |
264 |
|
|
265 |
< |
stringstream search; |
266 |
< |
search << session->search(string("ALL HEADER X-Mailer \"WinXPFAQPoll 1.0 ") |
267 |
< |
+ "(Perl)\" SUBJECT \"Windows XP FAQ | Poll Ballot\" FROM \"Windows XP" |
258 |
< |
+ " FAQ | Poll\""); |
265 |
> |
while (search.good()) |
266 |
> |
{ |
267 |
> |
char next = search.peek(); |
268 |
|
|
269 |
< |
search.ignore(9); |
270 |
< |
search.peek(); |
269 |
> |
if (isdigit(next)) break; |
270 |
> |
|
271 |
> |
search.get(); |
272 |
> |
} |
273 |
|
|
274 |
|
while (search.good()) |
275 |
|
{ |
280 |
|
messages.push(message); |
281 |
|
|
282 |
|
search.get(); |
283 |
< |
search.peek(); |
283 |
> |
|
284 |
> |
while (!isdigit(search.peek()) && search.good()) |
285 |
> |
{ |
286 |
> |
search.get(); |
287 |
> |
} |
288 |
|
} |
289 |
|
|
290 |
|
if (!messages.empty()) |
317 |
|
ostringstream number; |
318 |
|
number << message; |
319 |
|
|
320 |
< |
stringstream buffer; |
320 |
> |
string junk; |
321 |
> |
istringstream buffer(session->fetch(number.str() + " BODY.PEEK[2]")); |
322 |
|
|
323 |
< |
buffer << session->fetch(number.str() + " BODY.PEEK[2]"); |
323 |
> |
if (session->successful() && buffer.str() == "* " + number.str() + " FETCH" |
324 |
> |
+ " (BODY[2] \"\")\n") |
325 |
> |
{ |
326 |
> |
buffer.str(session->fetch(number.str() + " BODY.PEEK[TEXT]")); |
327 |
> |
|
328 |
> |
for (unsigned index = 0; index < 25; index++) |
329 |
> |
{ |
330 |
> |
getline(buffer, junk); |
331 |
> |
} |
332 |
> |
} |
333 |
|
|
334 |
|
if (session->successful() && session->fetch(number.str() + " FLAGS").find( |
335 |
|
"\\Deleted") == string::npos) |
336 |
|
{ |
337 |
< |
buffer.ignore(string::npos, '\n'); |
337 |
> |
getline(buffer, junk); |
338 |
|
|
339 |
|
bool approved = session->fetch(number.str() + " FLAGS").find("\\Flagge" |
340 |
|
+ string("d")) != string::npos; |
525 |
|
|
526 |
|
void Poller::approvals() |
527 |
|
{ |
503 |
– |
unsigned index; |
504 |
– |
|
528 |
|
session->check(); |
529 |
|
|
530 |
+ |
unsigned index; |
531 |
+ |
|
532 |
|
for (index = find.approve.size(); index > 0; index--) |
533 |
|
{ |
534 |
|
cout << "Checking find: " << index << "..." << flush; |
646 |
|
{ |
647 |
|
short answer = -1; |
648 |
|
|
649 |
< |
stringstream search; |
650 |
< |
search << session->search(string("ALL HEADER X-Mailer \"WinXPFAQPoll 1.0") |
651 |
< |
+ "\" SUBJECT \"Windows XP FAQ | Poll Submit\" FROM \"Windows XP FAQ |" |
652 |
< |
+ " Poll\" HEADER X-WinXPFAQPoll-Submit-Type \"" + type + "\" HEADER X" |
653 |
< |
+ "-WinXPFAQPoll-Submit-Text \"" + text + '\"'); |
649 |
> |
istringstream search(session->search(string("ALL HEADER X-Mailer \"WinXPF") |
650 |
> |
+ "AQPoll 1.0\" SUBJECT \"Windows XP FAQ | Poll Submit\" FROM \"Window" |
651 |
> |
+ "s XP FAQ | Poll\" HEADER X-WinXPFAQPoll-Submit-Type \"" + type |
652 |
> |
+ "\" HEADER X-WinXPFAQPoll-Submit-Text \"" + text + '\"')); |
653 |
> |
|
654 |
> |
while (search.good()) |
655 |
> |
{ |
656 |
> |
char next = search.peek(); |
657 |
|
|
658 |
< |
search.ignore(9); |
659 |
< |
search.peek(); |
658 |
> |
if (isdigit(next)) break; |
659 |
> |
|
660 |
> |
search.get(); |
661 |
> |
} |
662 |
|
|
663 |
|
if (search.good()) |
664 |
|
{ |