1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55
|
/* $Id: genericdecode.H,v 1.1 2003/05/27 14:09:08 mrsam Exp $
**
** Copyright 2002, Double Precision Inc.
**
** See COPYING for distribution information.
*/
#ifndef libmail_genericdecode_H
#define libmail_genericdecode_H
#include "libmail_config.h"
#include "mail.H"
#include "generic.H"
#include "autodecoder.H"
#include "base64.H"
#include "qp.H"
///////////////////////////////////////////////////////////////////////////
//
// A helper object for the generic readMessageContentDecoded method
// implementation. The mail::autodecoder() superclass handles the actual
// decoding task. The decoded() method forwards the decoded data to the
// original application callback object.
//
// This helper object also conveniently subclasses mail::callback::message,
// nicely forwarding the retrieved MIME content to mail::autodecoder.
// It is dynamically allocated, and after its success() or fail() method is
// invoked, the message is obediently passed along to the original
// callback function, and afterwards this object destroys itself.
class mail::generic::Decode : public mail::autodecoder,
public mail::callback::message {
mail::callback::message &originalCallback;
public:
Decode(mail::callback::message &callback, std::string transferEncoding);
~Decode();
private:
size_t messageNum;
void decoded(std::string buffer);
void messageTextCallback(size_t n, std::string text);
void reportProgress(size_t bytesCompleted,
size_t bytesEstimatedTotal,
size_t messagesCompleted,
size_t messagesEstimatedTotal);
void fail(std::string message);
void success(std::string message);
};
#endif
|