mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-11-07 21:31:58 +01:00
added rtf support
This commit is contained in:
parent
36e08326d0
commit
a6ff431397
12
configure
vendored
12
configure
vendored
@ -3419,6 +3419,7 @@ pdftotext="no"
|
||||
catdoc="no"
|
||||
catppt="no"
|
||||
xls2csv="no"
|
||||
unrtf="no"
|
||||
|
||||
|
||||
have_static_build="no"
|
||||
@ -4304,11 +4305,22 @@ _ACEOF
|
||||
fi
|
||||
|
||||
|
||||
if test z`which unrtf 2>/dev/null` != "z"; then
|
||||
unrtf=`which unrtf`
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define HAVE_UNRTF "$unrtf"
|
||||
_ACEOF
|
||||
|
||||
fi
|
||||
|
||||
|
||||
echo
|
||||
echo "pdftotext: $pdftotext"
|
||||
echo "catdoc: $catdoc"
|
||||
echo "catppt: $catppt"
|
||||
echo "xls2csv: $xls2csv"
|
||||
echo "unrtf: $unrtf"
|
||||
|
||||
|
||||
id -u $RUNNING_USER 2>/dev/null 1>/dev/null
|
||||
|
@ -45,6 +45,7 @@ pdftotext="no"
|
||||
catdoc="no"
|
||||
catppt="no"
|
||||
xls2csv="no"
|
||||
unrtf="no"
|
||||
|
||||
|
||||
have_static_build="no"
|
||||
@ -320,11 +321,18 @@ if test z`which xls2csv 2>/dev/null` != "z"; then
|
||||
fi
|
||||
|
||||
|
||||
if test z`which unrtf 2>/dev/null` != "z"; then
|
||||
unrtf=`which unrtf`
|
||||
AC_DEFINE_UNQUOTED(HAVE_UNRTF, "$unrtf", [path to unrtf])
|
||||
fi
|
||||
|
||||
|
||||
echo
|
||||
echo "pdftotext: $pdftotext"
|
||||
echo "catdoc: $catdoc"
|
||||
echo "catppt: $catppt"
|
||||
echo "xls2csv: $xls2csv"
|
||||
echo "unrtf: $unrtf"
|
||||
|
||||
|
||||
id -u $RUNNING_USER 2>/dev/null 1>/dev/null
|
||||
|
@ -13,5 +13,6 @@
|
||||
#undef HAVE_CATDOC
|
||||
#undef HAVE_CATPPT
|
||||
#undef HAVE_XLS2CSV
|
||||
#undef HAVE_UNRTF
|
||||
#undef HAVE_ZIP
|
||||
|
||||
|
@ -190,6 +190,10 @@ void extract_attachment_content(struct session_data *sdata, struct _state *state
|
||||
if(strcmp(type, "xls") == 0) snprintf(cmd, sizeof(cmd)-1, "%s -d utf-8 %s", HAVE_XLS2CSV, filename);
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_UNRTF
|
||||
if(strcmp(type, "rtf") == 0) snprintf(cmd, sizeof(cmd)-1, "%s --text %s", HAVE_UNRTF, filename);
|
||||
#endif
|
||||
|
||||
if(strlen(cmd) > 12){
|
||||
read_content_with_popen(sdata, state, cmd);
|
||||
return;
|
||||
|
@ -226,7 +226,7 @@ int parse_line(char *buf, struct _state *state, struct session_data *sdata, int
|
||||
|
||||
|
||||
// this is a real attachment to dump
|
||||
if(state->base64 == 1 && strlen(state->filename) > 5 && strlen(state->type) > 3 && state->n_attachments < MAX_ATTACHMENTS-1){
|
||||
if(state->base64 == 1 && strlen(state->filename) > 4 && strlen(state->type) > 3 && state->n_attachments < MAX_ATTACHMENTS-1){
|
||||
state->n_attachments++;
|
||||
|
||||
snprintf(state->attachments[state->n_attachments].filename, TINYBUFSIZE-1, "%s", state->filename);
|
||||
|
@ -732,6 +732,7 @@ char *determine_attachment_type(char *filename, char *type){
|
||||
// tar.gz has the same type
|
||||
if(strncasecmp(p, "x-gzip", 3) == 0) return "compressed,";
|
||||
|
||||
if(strncasecmp(p, "rtf", 3) == 0) return "word,";
|
||||
if(strncasecmp(p, "doc", 3) == 0) return "word,";
|
||||
if(strncasecmp(p, "docx", 4) == 0) return "word,";
|
||||
if(strncasecmp(p, "xls", 3) == 0) return "excel,";
|
||||
@ -770,6 +771,7 @@ char *get_attachment_extractor_by_filename(char *filename){
|
||||
if(strcasecmp(p, ".xlsx") == 0) return "xlsx";
|
||||
if(strcasecmp(p, ".ppt") == 0) return "ppt";
|
||||
if(strcasecmp(p, ".pptx") == 0) return "pptx";
|
||||
if(strcasecmp(p, ".rtf") == 0) return "rtf";
|
||||
if(strcasecmp(p, ".txt") == 0) return "text";
|
||||
if(strcasecmp(p, ".csv") == 0) return "text";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user