diff options
| author | Sam Varshavchik | 2013-08-19 16:39:41 -0400 | 
|---|---|---|
| committer | Sam Varshavchik | 2013-08-25 14:43:51 -0400 | 
| commit | 9c45d9ad13fdf439d44d7443ae75da15ea0223ed (patch) | |
| tree | 7a81a04cb51efb078ee350859a64be2ebc6b8813 /libmail/genericdecode.H | |
| parent | a9520698b770168d1f33d6301463bb70a19655ec (diff) | |
| download | courier-libs-9c45d9ad13fdf439d44d7443ae75da15ea0223ed.tar.bz2 | |
Initial checkin
Imported from subversion report, converted to git. Updated all paths in
scripts and makefiles, reflecting the new directory hierarchy.
Diffstat (limited to 'libmail/genericdecode.H')
| -rw-r--r-- | libmail/genericdecode.H | 54 | 
1 files changed, 54 insertions, 0 deletions
| diff --git a/libmail/genericdecode.H b/libmail/genericdecode.H new file mode 100644 index 0000000..0ead3f4 --- /dev/null +++ b/libmail/genericdecode.H @@ -0,0 +1,54 @@ +/* +** 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 | 
