From fccc9a590fc9aba984471e89e46f88322d3649fc Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Sat, 8 Jan 2011 19:22:09 +0100 Subject: [PATCH] mimehandler: accept additional parameter from config after internal for using different mime type --- src/internfile/mimehandler.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/internfile/mimehandler.cpp b/src/internfile/mimehandler.cpp index ce47442b..eea2113c 100644 --- a/src/internfile/mimehandler.cpp +++ b/src/internfile/mimehandler.cpp @@ -188,12 +188,24 @@ Dijon::Filter *getMimeHandler(const string &mtype, RclConfig *cfg, // string and instanciate handler object string::size_type b1 = hs.find_first_of(" \t"); string handlertype = hs.substr(0, b1); + string cmdstr; + if (b1 != string::npos) { + cmdstr = hs.substr(b1); + trimstring(cmdstr); + } if (!stringlowercmp("internal", handlertype)) { + // If there is a parameter after "internal" it's the mime + // type to use. This is so that we can have bogus mime + // types like text/x-purple-html-log (for ie: specific + // icon) and still use the html filter on them. This is + // partly redundant with the localfields/rclaptg, but + // better and the latter will probably go away at some + // point in the future + if (!cmdstr.empty()) + return mhFactory(cmdstr); return mhFactory(mtype); } else if (!stringlowercmp("dll", handlertype)) { } else { - string cmdstr = hs.substr(b1); - trimstring(cmdstr); if (cmdstr.empty()) { LOGERR(("getMimeHandler: bad line for %s: %s\n", mtype.c_str(), hs.c_str()));