|
a/src/internfile/mh_text.cpp |
|
b/src/internfile/mh_text.cpp |
|
... |
|
... |
27 |
#include "mh_text.h"
|
27 |
#include "mh_text.h"
|
28 |
#include "csguess.h"
|
28 |
#include "csguess.h"
|
29 |
#include "debuglog.h"
|
29 |
#include "debuglog.h"
|
30 |
#include "readfile.h"
|
30 |
#include "readfile.h"
|
31 |
#include "transcode.h"
|
31 |
#include "transcode.h"
|
|
|
32 |
#include "md5.h"
|
32 |
|
33 |
|
33 |
// Process a plain text file
|
34 |
// Process a plain text file
|
34 |
bool MimeHandlerText::set_document_file(const string &fn)
|
35 |
bool MimeHandlerText::set_document_file(const string &fn)
|
35 |
{
|
36 |
{
|
36 |
string otext;
|
37 |
string otext;
|
|
|
38 |
string reason;
|
37 |
if (!file_to_string(fn, otext))
|
39 |
if (!file_to_string(fn, otext, &reason)) {
|
|
|
40 |
LOGERR(("MimeHandlerText: can't read file: %s\n", reason.c_str()));
|
38 |
return false;
|
41 |
return false;
|
|
|
42 |
}
|
39 |
return set_document_string(otext);
|
43 |
return set_document_string(otext);
|
40 |
}
|
44 |
}
|
41 |
|
45 |
|
42 |
bool MimeHandlerText::set_document_string(const string& otext)
|
46 |
bool MimeHandlerText::set_document_string(const string& otext)
|
43 |
{
|
47 |
{
|
44 |
m_text = otext;
|
48 |
m_text = otext;
|
|
|
49 |
string md5, xmd5;
|
|
|
50 |
MD5String(m_text, md5);
|
|
|
51 |
m_metaData["md5"] = MD5HexPrint(md5, xmd5);
|
45 |
m_havedoc = true;
|
52 |
m_havedoc = true;
|
46 |
return true;
|
53 |
return true;
|
47 |
}
|
54 |
}
|
48 |
|
55 |
|
49 |
bool MimeHandlerText::next_document()
|
56 |
bool MimeHandlerText::next_document()
|