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 |
|
{ |
253 |
– |
session->select('\"' + account.getMailbox() + '\"'); |
254 |
– |
|
261 |
|
stringstream search; |
262 |
|
search << session->search(string("ALL HEADER X-Mailer \"WinXPFAQPoll 1.0 ") |
263 |
|
+ "(Perl)\" SUBJECT \"Windows XP FAQ | Poll Ballot\" FROM \"Windows XP" |
264 |
|
+ " FAQ | Poll\""); |
265 |
|
|
266 |
|
search.ignore(9); |
267 |
< |
search.peek(); |
267 |
> |
|
268 |
> |
while (!isdigit(search.peek()) && search.good()) |
269 |
> |
{ |
270 |
> |
search.get(); |
271 |
> |
} |
272 |
|
|
273 |
|
while (search.good()) |
274 |
|
{ |
279 |
|
messages.push(message); |
280 |
|
|
281 |
|
search.get(); |
282 |
< |
search.peek(); |
282 |
> |
|
283 |
> |
while (!isdigit(search.peek()) && search.good()) |
284 |
> |
{ |
285 |
> |
search.get(); |
286 |
> |
} |
287 |
|
} |
288 |
|
|
289 |
|
if (!messages.empty()) |
317 |
|
number << message; |
318 |
|
|
319 |
|
stringstream buffer; |
320 |
+ |
string junk; |
321 |
|
|
322 |
|
buffer << session->fetch(number.str() + " BODY.PEEK[2]"); |
323 |
|
|
324 |
+ |
if (session->successful() && buffer.str() == "* " + number.str() + " FETCH" |
325 |
+ |
+ " (BODY[2] \"\")\n") |
326 |
+ |
{ |
327 |
+ |
do |
328 |
+ |
{ |
329 |
+ |
getline(buffer, junk); |
330 |
+ |
} |
331 |
+ |
while (buffer.good()); |
332 |
+ |
|
333 |
+ |
buffer.clear(); |
334 |
+ |
|
335 |
+ |
buffer << session->fetch(number.str() + " BODY.PEEK[TEXT]"); |
336 |
+ |
|
337 |
+ |
for (unsigned index = 0; index < 25; index++) |
338 |
+ |
{ |
339 |
+ |
getline(buffer, junk); |
340 |
+ |
} |
341 |
+ |
} |
342 |
+ |
|
343 |
|
if (session->successful() && session->fetch(number.str() + " FLAGS").find( |
344 |
|
"\\Deleted") == string::npos) |
345 |
|
{ |
346 |
< |
buffer.ignore(string::npos, '\n'); |
346 |
> |
getline(buffer, junk); |
347 |
|
|
348 |
|
bool approved = session->fetch(number.str() + " FLAGS").find("\\Flagge" |
349 |
|
+ string("d")) != string::npos; |
534 |
|
|
535 |
|
void Poller::approvals() |
536 |
|
{ |
503 |
– |
unsigned index; |
504 |
– |
|
537 |
|
session->check(); |
538 |
|
|
539 |
+ |
unsigned index; |
540 |
+ |
|
541 |
|
for (index = find.approve.size(); index > 0; index--) |
542 |
|
{ |
543 |
|
cout << "Checking find: " << index << "..." << flush; |