|
a/src/utils/idfile.cpp |
|
b/src/utils/idfile.cpp |
|
... |
|
... |
55 |
static const int mailhsl[] = {6, 10, 12, 4, 6, 9, 8, 13};
|
55 |
static const int mailhsl[] = {6, 10, 12, 4, 6, 9, 8, 13};
|
56 |
static const int nmh = sizeof(mailhs) / sizeof(char *);
|
56 |
static const int nmh = sizeof(mailhs) / sizeof(char *);
|
57 |
|
57 |
|
58 |
const int wantnhead = 3;
|
58 |
const int wantnhead = 3;
|
59 |
|
59 |
|
60 |
string idFile(const char *fn)
|
60 |
// fn is for message printing
|
|
|
61 |
static string idFileInternal(istream& input, const char *fn)
|
61 |
{
|
62 |
{
|
62 |
static int treat_mbox_as_rfc822;
|
63 |
static int treat_mbox_as_rfc822;
|
63 |
if (treat_mbox_as_rfc822 == 0) {
|
64 |
if (treat_mbox_as_rfc822 == 0) {
|
64 |
treat_mbox_as_rfc822 = getenv("RECOLL_TREAT_MBOX_AS_RFC822") ? 1 : -1;
|
65 |
treat_mbox_as_rfc822 = getenv("RECOLL_TREAT_MBOX_AS_RFC822") ? 1 : -1;
|
65 |
}
|
66 |
}
|
66 |
|
|
|
67 |
ifstream input;
|
|
|
68 |
input.open(fn, ios::in);
|
|
|
69 |
if (!input.is_open()) {
|
|
|
70 |
LOGERR(("idFile: could not open [%s]\n", fn));
|
|
|
71 |
return string();
|
|
|
72 |
}
|
|
|
73 |
|
67 |
|
74 |
bool line1HasFrom = false;
|
68 |
bool line1HasFrom = false;
|
75 |
bool gotnonempty = false;
|
69 |
bool gotnonempty = false;
|
76 |
int lookslikemail = 0;
|
70 |
int lookslikemail = 0;
|
77 |
|
71 |
|
|
... |
|
... |
160 |
return line1HasFrom ? string("text/x-mail") : string("message/rfc822");
|
154 |
return line1HasFrom ? string("text/x-mail") : string("message/rfc822");
|
161 |
|
155 |
|
162 |
return string();
|
156 |
return string();
|
163 |
}
|
157 |
}
|
164 |
|
158 |
|
|
|
159 |
string idFile(const char *fn)
|
|
|
160 |
{
|
|
|
161 |
ifstream input;
|
|
|
162 |
input.open(fn, ios::in);
|
|
|
163 |
if (!input.is_open()) {
|
|
|
164 |
LOGERR(("idFile: could not open [%s]\n", fn));
|
|
|
165 |
return string();
|
|
|
166 |
}
|
|
|
167 |
return idFileInternal(input, fn);
|
|
|
168 |
}
|
|
|
169 |
|
|
|
170 |
string idFileMem(const string& data)
|
|
|
171 |
{
|
|
|
172 |
stringstream s(data, stringstream::in);
|
|
|
173 |
return idFileInternal(s, "");
|
|
|
174 |
}
|
165 |
|
175 |
|
166 |
#else
|
176 |
#else
|
167 |
|
177 |
|
168 |
#include <string>
|
178 |
#include <string>
|
169 |
#include <iostream>
|
179 |
#include <iostream>
|