|
a/src/utils/idfile.cpp |
|
b/src/utils/idfile.cpp |
1 |
#ifndef lint
|
1 |
#ifndef lint
|
2 |
static char rcsid[] = "@(#$Id: idfile.cpp,v 1.8 2008-05-21 07:21:37 dockes Exp $ (C) 2005 J.F.Dockes";
|
2 |
static char rcsid[] = "@(#$Id: idfile.cpp,v 1.9 2008-07-01 11:51:51 dockes Exp $ (C) 2005 J.F.Dockes";
|
3 |
#endif
|
3 |
#endif
|
4 |
/*
|
4 |
/*
|
5 |
* This program is free software; you can redistribute it and/or modify
|
5 |
* This program is free software; you can redistribute it and/or modify
|
6 |
* it under the terms of the GNU General Public License as published by
|
6 |
* it under the terms of the GNU General Public License as published by
|
7 |
* the Free Software Foundation; either version 2 of the License, or
|
7 |
* the Free Software Foundation; either version 2 of the License, or
|
|
... |
|
... |
66 |
|
66 |
|
67 |
ifstream input;
|
67 |
ifstream input;
|
68 |
input.open(fn, ios::in);
|
68 |
input.open(fn, ios::in);
|
69 |
if (!input.is_open()) {
|
69 |
if (!input.is_open()) {
|
70 |
LOGERR(("idFile: could not open [%s]\n", fn));
|
70 |
LOGERR(("idFile: could not open [%s]\n", fn));
|
71 |
return string("");
|
71 |
return string();
|
72 |
}
|
72 |
}
|
73 |
|
73 |
|
74 |
bool line1HasFrom = false;
|
74 |
bool line1HasFrom = false;
|
75 |
bool gotnonempty = false;
|
75 |
bool gotnonempty = false;
|
76 |
int lookslikemail = 0;
|
76 |
int lookslikemail = 0;
|
|
... |
|
... |
86 |
cline[LL] = 0;
|
86 |
cline[LL] = 0;
|
87 |
input.getline(cline, LL-1);
|
87 |
input.getline(cline, LL-1);
|
88 |
if (input.fail()) {
|
88 |
if (input.fail()) {
|
89 |
if (input.bad()) {
|
89 |
if (input.bad()) {
|
90 |
LOGERR(("idfile: error while reading [%s]\n", fn));
|
90 |
LOGERR(("idfile: error while reading [%s]\n", fn));
|
91 |
return string("");
|
91 |
return string();
|
92 |
}
|
92 |
}
|
93 |
// Must be eof ?
|
93 |
// Must be eof ?
|
94 |
break;
|
94 |
break;
|
95 |
}
|
95 |
}
|
96 |
|
96 |
|
|
... |
|
... |
119 |
}
|
119 |
}
|
120 |
|
120 |
|
121 |
// emacs vm can insert VERY long header lines.
|
121 |
// emacs vm can insert VERY long header lines.
|
122 |
if (ll > 800) {
|
122 |
if (ll > 800) {
|
123 |
LOGDEB2(("idFile: Line too long\n"));
|
123 |
LOGDEB2(("idFile: Line too long\n"));
|
124 |
return string("");
|
124 |
return string();
|
125 |
}
|
125 |
}
|
126 |
|
126 |
|
127 |
// Check for mbox 'From ' line
|
127 |
// Check for mbox 'From ' line
|
128 |
if (lnum == 1 && !strncmp("From ", cline, 5)) {
|
128 |
if (lnum == 1 && !strncmp("From ", cline, 5)) {
|
129 |
if (treat_mbox_as_rfc822 == -1)
|
129 |
if (treat_mbox_as_rfc822 == -1)
|
|
... |
|
... |
157 |
lookslikemail++;
|
157 |
lookslikemail++;
|
158 |
|
158 |
|
159 |
if (lookslikemail >= wantnhead)
|
159 |
if (lookslikemail >= wantnhead)
|
160 |
return line1HasFrom ? string("text/x-mail") : string("message/rfc822");
|
160 |
return line1HasFrom ? string("text/x-mail") : string("message/rfc822");
|
161 |
|
161 |
|
162 |
return string("");
|
162 |
return string();
|
163 |
}
|
163 |
}
|
164 |
|
164 |
|
165 |
|
165 |
|
166 |
#else
|
166 |
#else
|
167 |
|
167 |
|