|
a/src/internfile/mimehandler.cpp |
|
b/src/internfile/mimehandler.cpp |
|
... |
|
... |
29 |
#include "debuglog.h"
|
29 |
#include "debuglog.h"
|
30 |
#include "rclconfig.h"
|
30 |
#include "rclconfig.h"
|
31 |
#include "smallut.h"
|
31 |
#include "smallut.h"
|
32 |
|
32 |
|
33 |
#include "mh_exec.h"
|
33 |
#include "mh_exec.h"
|
|
|
34 |
#include "mh_execm.h"
|
34 |
#include "mh_html.h"
|
35 |
#include "mh_html.h"
|
35 |
#include "mh_mail.h"
|
36 |
#include "mh_mail.h"
|
36 |
#include "mh_mbox.h"
|
37 |
#include "mh_mbox.h"
|
37 |
#include "mh_text.h"
|
38 |
#include "mh_text.h"
|
38 |
#include "mh_unknown.h"
|
39 |
#include "mh_unknown.h"
|
|
... |
|
... |
66 |
* A filter def can look like.
|
67 |
* A filter def can look like.
|
67 |
* exec someprog -v -t " h i j";charset= xx; mimetype=yy
|
68 |
* exec someprog -v -t " h i j";charset= xx; mimetype=yy
|
68 |
* We don't support ';' inside a quoted string for now. Can't see a use
|
69 |
* We don't support ';' inside a quoted string for now. Can't see a use
|
69 |
* for it
|
70 |
* for it
|
70 |
*/
|
71 |
*/
|
71 |
MimeHandlerExec *mhExecFactory(RclConfig *cfg, const string& mtype, string& hs)
|
72 |
MimeHandlerExec *mhExecFactory(RclConfig *cfg, const string& mtype, string& hs,
|
|
|
73 |
bool multiple)
|
72 |
{
|
74 |
{
|
73 |
list<string>semicolist;
|
75 |
list<string>semicolist;
|
74 |
stringToTokens(hs, semicolist, ";");
|
76 |
stringToTokens(hs, semicolist, ";");
|
75 |
if (hs.size() < 1) {
|
77 |
if (hs.size() < 1) {
|
76 |
LOGERR(("mhExecFactory: bad filter def: [%s]\n", hs.c_str()));
|
78 |
LOGERR(("mhExecFactory: bad filter def: [%s]\n", hs.c_str()));
|
|
... |
|
... |
84 |
LOGERR(("mhExecFactory: bad config line for [%s]: [%s]\n",
|
86 |
LOGERR(("mhExecFactory: bad config line for [%s]: [%s]\n",
|
85 |
mtype.c_str(), hs.c_str()));
|
87 |
mtype.c_str(), hs.c_str()));
|
86 |
return 0;
|
88 |
return 0;
|
87 |
}
|
89 |
}
|
88 |
|
90 |
|
|
|
91 |
MimeHandlerExec *h = multiple ?
|
|
|
92 |
new MimeHandlerExecMultiple(mtype.c_str()) :
|
89 |
MimeHandlerExec *h = new MimeHandlerExec(mtype.c_str());
|
93 |
new MimeHandlerExec(mtype.c_str());
|
90 |
|
94 |
|
91 |
list<string>::iterator it;
|
95 |
list<string>::iterator it;
|
92 |
|
96 |
|
93 |
// toks size is at least 2, this has been checked by caller.
|
97 |
// toks size is at least 2, this has been checked by caller.
|
94 |
it = toks.begin();
|
98 |
it = toks.begin();
|
|
... |
|
... |
179 |
if (toks.size() < 2) {
|
183 |
if (toks.size() < 2) {
|
180 |
LOGERR(("getMimeHandler: bad line for %s: %s\n",
|
184 |
LOGERR(("getMimeHandler: bad line for %s: %s\n",
|
181 |
mtype.c_str(), hs.c_str()));
|
185 |
mtype.c_str(), hs.c_str()));
|
182 |
return 0;
|
186 |
return 0;
|
183 |
}
|
187 |
}
|
|
|
188 |
return mhExecFactory(cfg, mtype, hs, false);
|
|
|
189 |
} else if (!stringlowercmp("execm", *it)) {
|
|
|
190 |
if (toks.size() < 2) {
|
|
|
191 |
LOGERR(("getMimeHandler: bad line for %s: %s\n",
|
|
|
192 |
mtype.c_str(), hs.c_str()));
|
|
|
193 |
return 0;
|
|
|
194 |
}
|
184 |
return mhExecFactory(cfg, mtype, hs);
|
195 |
return mhExecFactory(cfg, mtype, hs, true);
|
185 |
}
|
196 |
}
|
186 |
}
|
197 |
}
|
187 |
|
198 |
|
188 |
// We are supposed to get here if there was no specific error, but
|
199 |
// We are supposed to get here if there was no specific error, but
|
189 |
// there is no identified mime type, or no handler
|
200 |
// there is no identified mime type, or no handler
|