diff --git a/src/common/rclconfig.cpp b/src/common/rclconfig.cpp index 9211053b..e78939f6 100644 --- a/src/common/rclconfig.cpp +++ b/src/common/rclconfig.cpp @@ -1,5 +1,5 @@ #ifndef lint -static char rcsid[] = "@(#$Id: rclconfig.cpp,v 1.36 2006-12-14 13:53:42 dockes Exp $ (C) 2004 J.F.Dockes"; +static char rcsid[] = "@(#$Id: rclconfig.cpp,v 1.37 2006-12-16 15:30:02 dockes Exp $ (C) 2004 J.F.Dockes"; #endif /* * This program is free software; you can redistribute it and/or modify @@ -230,6 +230,20 @@ string RclConfig::getMimeTypeFromSuffix(const string &suff) return mtype; } +string RclConfig::getSuffixFromMimeType(const string &mt) +{ + string suffix; + listsfs = mimemap->getNames(""); + string mt1; + for (list::const_iterator it = sfs.begin(); + it != sfs.end(); it++) { + if (mimemap->get(*it, mt1, "")) + if (!stringicmp(mt, mt1)) + return *it; + } + return ""; +} + string RclConfig::getMimeHandlerDef(const std::string &mtype) { string hs; diff --git a/src/common/rclconfig.h b/src/common/rclconfig.h index 3e51831c..85acad73 100644 --- a/src/common/rclconfig.h +++ b/src/common/rclconfig.h @@ -16,7 +16,7 @@ */ #ifndef _RCLCONFIG_H_INCLUDED_ #define _RCLCONFIG_H_INCLUDED_ -/* @(#$Id: rclconfig.h,v 1.27 2006-12-14 13:53:42 dockes Exp $ (C) 2004 J.F.Dockes */ +/* @(#$Id: rclconfig.h,v 1.28 2006-12-16 15:30:02 dockes Exp $ (C) 2004 J.F.Dockes */ #include #include @@ -102,6 +102,9 @@ class RclConfig { /** Use mimemap to compute mimetype */ string getMimeTypeFromSuffix(const string &suffix); + /** Get appropriate suffix for mime type. This is inefficient */ + string getSuffixFromMimeType(const string &mt); + /** Get input filter from mimeconf for mimetype */ string getMimeHandlerDef(const string &mimetype);