Switch to unified view

a/src/internfile/mimehandler.cpp b/src/internfile/mimehandler.cpp
...
...
15
 *   You should have received a copy of the GNU General Public License
15
 *   You should have received a copy of the GNU General Public License
16
 *   along with this program; if not, write to the
16
 *   along with this program; if not, write to the
17
 *   Free Software Foundation, Inc.,
17
 *   Free Software Foundation, Inc.,
18
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19
 */
19
 */
20
#include "autoconfig.h"
20
21
22
#include <errno.h>
21
#include <iostream>
23
#include <iostream>
22
#include <string>
24
#include <string>
23
25
#include <vector>
24
using namespace std;
26
using namespace std;
25
27
26
#include "mimehandler.h"
28
#include "mimehandler.h"
27
#include "debuglog.h"
29
#include "debuglog.h"
28
#include "rclconfig.h"
30
#include "rclconfig.h"
29
#include "smallut.h"
31
#include "smallut.h"
32
#ifdef RCL_USE_XATTR
33
#include "pxattr.h"
34
#endif // RCL_USE_XATTR
30
35
31
#include "mh_exec.h"
36
#include "mh_exec.h"
32
#include "mh_html.h"
37
#include "mh_html.h"
33
#include "mh_mail.h"
38
#include "mh_mail.h"
34
#include "mh_mbox.h"
39
#include "mh_mbox.h"
35
#include "mh_text.h"
40
#include "mh_text.h"
36
#include "mh_unknown.h"
41
#include "mh_unknown.h"
42
43
// Common code for all docs that are a file (not subdocs). If extended
44
// attributes support is enabled, fetch the data.
45
bool RecollFilter::set_document_file(const string& path)
46
{
47
#ifdef RCL_USE_XATTR
48
    RclConfig* rclconfig = RclConfig::getMainConfig();
49
    if (rclconfig == 0) {
50
  LOGERR(("RecollFilter::set_document_file: no config\n"));
51
  return false;
52
    }
53
    vector<string> xnames;
54
    if (!pxattr::list(path, &xnames)) {
55
  LOGERR(("xattrToMeta: pxattr::list failed, errno %d\n", errno));
56
  return false;
57
    }
58
    const map<string, string>& xtof = rclconfig->getXattrToField();
59
    for (vector<string>::const_iterator it = xnames.begin();
60
   it != xnames.end(); it++) {
61
  map<string, string>::const_iterator mit;
62
  if ((mit = xtof.find(*it)) != xtof.end()) {
63
      string value;
64
      if (!pxattr::get(path, *it, &value, pxattr::PXATTR_NOFOLLOW)) {
65
      LOGERR(("xattrToMeta: pxattr::get failed for %s, errno %d\n", 
66
          (*it).c_str(), errno));
67
      continue;
68
      }
69
      // Encode should we ?
70
      m_fieldsFromAttrs[mit->second] = value;
71
  }
72
    }
73
#endif // RCL_USE_XATTR
74
    return true;
75
}
37
76
38
// Pool of already known and created handlers. There can be several instance
77
// Pool of already known and created handlers. There can be several instance
39
// for a given mime type (think email attachment in email message)
78
// for a given mime type (think email attachment in email message)
40
static multimap<string, Dijon::Filter*>  o_handlers;
79
static multimap<string, Dijon::Filter*>  o_handlers;
41
80