diff --git a/src/elogd.c b/src/elogd.c index 477617b3..6237f67f 100755 --- a/src/elogd.c +++ b/src/elogd.c @@ -275,54 +275,54 @@ struct { } filetype[] = { { - ".AI", "application/postscript"}, { - ".ASC", "text/plain"}, { - ".BZ2", "application/x-bzip2"}, { - ".CFG", "text/plain"}, { + ".AI", "application/postscript"}, { + ".ASC", "text/plain"}, { + ".BZ2", "application/x-bzip2"}, { + ".CFG", "text/plain"}, { ".CHRT", "application/x-kchart"}, { ".CONF", "text/plain"}, { - ".CSH", "application/x-csh"}, { - ".CSS", "text/css"}, { - ".DOC", "application/msword"}, { - ".DVI", "application/x-dvi"}, { - ".EPS", "application/postscript"}, { - ".GIF", "image/gif"}, { - ".GZ", "application/x-gzip"}, { - ".HTM", "text/html"}, { + ".CSH", "application/x-csh"}, { + ".CSS", "text/css"}, { + ".DOC", "application/msword"}, { + ".DVI", "application/x-dvi"}, { + ".EPS", "application/postscript"}, { + ".GIF", "image/gif"}, { + ".GZ", "application/x-gzip"}, { + ".HTM", "text/html"}, { ".HTML", "text/html"}, { - ".ICO", "image/x-icon"}, { + ".ICO", "image/x-icon"}, { ".JPEG", "image/jpeg"}, { - ".JPG", "image/jpeg"}, { - ".JS", "application/x-javascript"}, { - ".KPR", "application/x-kpresenter"}, { - ".KSP", "application/x-kspread"}, { - ".KWD", "application/x-kword"}, { - ".MP3", "audio/mpeg"}, { - ".OGG", "application/x-ogg"}, { - ".PDF", "application/pdf"}, { - ".PNG", "image/png"}, { - ".PS", "application/postscript"}, { - ".RAM", "audio/x-pn-realaudio"}, { - ".RM", "audio/x-pn-realaudio"}, { - ".RM", "audio/x-pn-realaudio"}, { - ".RM", "audio/x-pn-realaudio"}, { - ".RPM", "application/x-rpm"}, { - ".RTF", "application/rtf"}, { - ".SH", "application/x-sh"}, { - ".TAR", "application/x-tar"}, { - ".TCL", "application/x-tcl"}, { - ".TEX", "application/x-tex"}, { - ".TGZ", "application/x-gzip"}, { - ".TIF", "image/tiff"}, { + ".JPG", "image/jpeg"}, { + ".JS", "application/x-javascript"}, { + ".KPR", "application/x-kpresenter"}, { + ".KSP", "application/x-kspread"}, { + ".KWD", "application/x-kword"}, { + ".MP3", "audio/mpeg"}, { + ".OGG", "application/x-ogg"}, { + ".PDF", "application/pdf"}, { + ".PNG", "image/png"}, { + ".PS", "application/postscript"}, { + ".RAM", "audio/x-pn-realaudio"}, { + ".RM", "audio/x-pn-realaudio"}, { + ".RM", "audio/x-pn-realaudio"}, { + ".RM", "audio/x-pn-realaudio"}, { + ".RPM", "application/x-rpm"}, { + ".RTF", "application/rtf"}, { + ".SH", "application/x-sh"}, { + ".TAR", "application/x-tar"}, { + ".TCL", "application/x-tcl"}, { + ".TEX", "application/x-tex"}, { + ".TGZ", "application/x-gzip"}, { + ".TIF", "image/tiff"}, { ".TIFF", "image/tiff"}, { - ".TXT", "text/plain"}, { - ".WAV", "audio/x-wav"}, { - ".XLS", "application/x-msexcel"}, { - ".XML", "text/xml"}, { - ".XSL", "text/xml"}, { - ".ZIP", "application/x-zip-compressed"}, { + ".TXT", "text/plain"}, { + ".WAV", "audio/x-wav"}, { + ".XLS", "application/x-msexcel"}, { + ".XML", "text/xml"}, { + ".XSL", "text/xml"}, { + ".ZIP", "application/x-zip-compressed"}, { - /* Open XML file types */ + /* Open XML file types */ ".DOCM", "application/vnd.ms-word.document.macroEnabled.12"}, { ".DOCX", "application/vnd.openxmlformats-officedocument.wordprocessingml.document"}, { ".DOTM", "application/vnd.ms-word.template.macroEnabled.12"}, { @@ -334,7 +334,7 @@ struct { ".XLSB", "application/vnd.ms-excel.sheet.binary.macroEnabled.12"}, { ".XLSM", "application/vnd.ms-excel.sheet.macroEnabled.12"}, { ".XLSX", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}, { - ".XPS", "application/vnd.ms-xpsdocument"}, { + ".XPS", "application/vnd.ms-xpsdocument"}, { "", ""},}; @@ -421,7 +421,7 @@ char *loc(char *orig); void strencode(char *text); void strencode_nouml(char *text); int scan_attributes(char *logbook); -int is_inline_attachment(char *encoding, int message_id, char *text, int i, char *att); +int is_inline_attachment(LOGBOOK *lbs, char *encoding, int message_id, char *text, int i, char *att); int setgroup(char *str); int setuser(char *str); int setegroup(char *str); @@ -3455,6 +3455,19 @@ void check_config() /*-------------------------------------------------------------------*/ +void retrieve_domain(LOGBOOK * lbs, char *ret, int size) +{ + char smtp_host[80]; + + strlcpy(ret, "tmp.org", size); + if (getcfg("global", "SMTP host", smtp_host, sizeof(smtp_host))) { + if (strchr(smtp_host, '.')) + strlcpy(ret, strchr(smtp_host, '.')+1, size); + } +} + +/*-------------------------------------------------------------------*/ + void retrieve_email_from(LOGBOOK * lbs, char *ret, char *ret_name, char attrib[MAX_N_ATTR][NAME_LENGTH]) { char email_from[256], email_from_name[256], str[256], *p, login_name[256]; @@ -5425,7 +5438,7 @@ int is_html(char *s) /*------------------------------------------------------------------*/ -int html_allowed(LOGBOOK *lbs) +int html_allowed(LOGBOOK * lbs) { char str[80]; @@ -5607,7 +5620,7 @@ void insert_breaks(char *str, int n, int size) void replace_inline_img(LOGBOOK * lbs, char *str) { - char *p, *pn, *pa, old[256], link[256], base_url[256]; + char *p, *pn, *pa, old[256], link[256], base_url[256], domain[256]; int index; p = str; @@ -5622,7 +5635,8 @@ void replace_inline_img(LOGBOOK * lbs, char *str) pn++; if (*pn == '>') pn++; - sprintf(p, "", index); + retrieve_domain(lbs, domain, sizeof(domain)); + sprintf(p, "", index, domain); memmove(p + strlen(p), pn, strlen(pn) + 1); /* now change href to absolute link */ @@ -5913,136 +5927,97 @@ typedef struct { PATTERN_LIST pattern_list[] = { /* smileys */ - { - ":))", "\"Happy\""}, { - ":-))", - "\"Happy\""}, - { - ":)", "\"Smile\""}, { - ":-)", - "\"Smile\""}, - { - ":(", "\"Frown\""}, { - ":-(", - "\"Frown\""}, - { - ";)", "\"Wink\""}, { - ";-)", - "\"Wink\""}, - { - ":d", "\"Big"}, { - "?-)", - "\"Confused\""}, - { - ";(", "\"Crying\""}, { - ";-(", - "\"Crying\""}, - { - ":]", "\"Pleased\""}, { - ":-]", - "\"Pleased\""}, - { - ":o", "\"Yawn\""}, { - ":-o", - "\"Yawn\""}, - { - "8-)", "\"Cool\""}, { - "8o", - "\"Astonished\""}, - { - "x-(", "\"Mad\""}, { - ":p", - "\"Tongue\""}, - { - ":-p", "\"Tongue\""}, + {":))", "\"Happy\""}, + {":-))", "\"Happy\""}, + {":)", "\"Smile\""}, + {":-)", "\"Smile\""}, + {":(", "\"Frown\""}, + {":-(", "\"Frown\""}, + {";)", "\"Wink\""}, + {";-)", "\"Wink\""}, + {":d", "\"Big"}, + {"?-)", "\"Confused\""}, + {";(", "\"Crying\""}, + {";-(", "\"Crying\""}, + {":]", "\"Pleased\""}, + {":-]", "\"Pleased\""}, + {":o", "\"Yawn\""}, + {":-o", "\"Yawn\""}, + {"8-)", "\"Cool\""}, + {"8o", "\"Astonished\""}, + {"x-(", "\"Mad\""}, + {":p", "\"Tongue\""}, + {":-p", "\"Tongue\""}, + /* formatting */ - { - "[b]", ""}, { - "[/b]", ""}, { - "[u]", ""}, { - "[/u]", ""}, { - "[i]", ""}, { - "[/i]", ""}, { - "[center]", - "
"}, - { - "[/center]", "
"}, { - "[color=", ""}, { - "[/color]", ""}, { - "[size=", - ""}, - { - "[/size]", ""}, { - "[font=", ""}, { - "[/font]", ""}, { - "\r\n[code]", "
"}, {
-                                                                                                               "[code]",
-                                                                                                               "
"},
-   {
-    "[/code]\r\n", "
"}, { - "[/code]", "
"}, { - "\r\n[code1]", "
"}, {
-                                                                                "[code1]", "
"}, {
-                                                                                                      "[/code1]\r\n",
-                                                                                                      "
"}, - { - "[/code1]", "
"}, + {"[b]", ""}, + {"[/b]", ""}, + {"[u]", ""}, + {"[/u]", ""}, + {"[i]", ""}, + {"[/i]", ""}, + {"[center]", "
"}, + {"[/center]", "
"}, + {"[color=", ""}, + {"[/color]", ""}, + {"[size=", ""}, + {"[/size]", ""}, + {"[font=", ""}, + {"[/font]", ""}, + {"\r\n[code]", "
"}, 
+   {"[code]", "
"},
+   {"[/code]\r\n", "
"}, + {"[/code]", "
"}, + {"\r\n[code1]", "
"}, 
+   {"[code1]", "
"}, 
+   {"[/code1]\r\n","
"}, + {"[/code1]", "
"}, + /* lists */ - { - "[list]\r", "