diff options
| author | 2023-09-21 21:25:45 +0200 | |
|---|---|---|
| committer | 2023-09-21 21:25:45 +0200 | |
| commit | 749dbef349c53ff9bf13f705e674c72ac76e20ca (patch) | |
| tree | 2b466013e4d6913143afcb61237afe863e07a143 | |
| parent | Updated dependencies. (diff) | |
| download | penes-snac2-749dbef349c53ff9bf13f705e674c72ac76e20ca.tar.gz penes-snac2-749dbef349c53ff9bf13f705e674c72ac76e20ca.tar.xz penes-snac2-749dbef349c53ff9bf13f705e674c72ac76e20ca.zip | |
Used xs_match() in some places.
| -rw-r--r-- | Makefile | 2 | ||||
| -rw-r--r-- | html.c | 7 |
2 files changed, 4 insertions, 5 deletions
| @@ -39,7 +39,7 @@ data.o: data.c xs.h xs_io.h xs_json.h xs_openssl.h xs_glob.h xs_set.h \ | |||
| 39 | xs_time.h snac.h | 39 | xs_time.h snac.h |
| 40 | format.o: format.c xs.h xs_regex.h xs_mime.h snac.h | 40 | format.o: format.c xs.h xs_regex.h xs_mime.h snac.h |
| 41 | html.o: html.c xs.h xs_io.h xs_json.h xs_regex.h xs_set.h xs_openssl.h \ | 41 | html.o: html.c xs.h xs_io.h xs_json.h xs_regex.h xs_set.h xs_openssl.h \ |
| 42 | xs_time.h xs_mime.h snac.h | 42 | xs_time.h xs_mime.h xs_match.h snac.h |
| 43 | http.o: http.c xs.h xs_io.h xs_openssl.h xs_curl.h xs_time.h xs_json.h \ | 43 | http.o: http.c xs.h xs_io.h xs_openssl.h xs_curl.h xs_time.h xs_json.h \ |
| 44 | snac.h | 44 | snac.h |
| 45 | httpd.o: httpd.c xs.h xs_io.h xs_json.h xs_socket.h xs_httpd.h xs_mime.h \ | 45 | httpd.o: httpd.c xs.h xs_io.h xs_json.h xs_socket.h xs_httpd.h xs_mime.h \ |
| @@ -9,6 +9,7 @@ | |||
| 9 | #include "xs_openssl.h" | 9 | #include "xs_openssl.h" |
| 10 | #include "xs_time.h" | 10 | #include "xs_time.h" |
| 11 | #include "xs_mime.h" | 11 | #include "xs_mime.h" |
| 12 | #include "xs_match.h" | ||
| 12 | 13 | ||
| 13 | #include "snac.h" | 14 | #include "snac.h" |
| 14 | 15 | ||
| @@ -203,8 +204,7 @@ xs_str *html_msg_icon(xs_str *os, const xs_dict *msg) | |||
| 203 | int priv = 0; | 204 | int priv = 0; |
| 204 | const char *type = xs_dict_get(msg, "type"); | 205 | const char *type = xs_dict_get(msg, "type"); |
| 205 | 206 | ||
| 206 | if (strcmp(type, "Note") == 0 || strcmp(type, "Question") == 0 || | 207 | if (xs_match(type, "Note|Question|Page|Article")) |
| 207 | strcmp(type, "Page") == 0 || strcmp(type, "Article") == 0) | ||
| 208 | url = xs_dict_get(msg, "id"); | 208 | url = xs_dict_get(msg, "id"); |
| 209 | 209 | ||
| 210 | priv = !is_msg_public(msg); | 210 | priv = !is_msg_public(msg); |
| @@ -1387,8 +1387,7 @@ xs_str *html_entry(snac *user, xs_str *os, const xs_dict *msg, int local, | |||
| 1387 | continue; | 1387 | continue; |
| 1388 | 1388 | ||
| 1389 | /* infer MIME type from non-specific attachments */ | 1389 | /* infer MIME type from non-specific attachments */ |
| 1390 | if (xs_list_len(attach) < 2 && | 1390 | if (xs_list_len(attach) < 2 && xs_match(t, "Link|Document")) { |
| 1391 | (strcmp(t, "Link") == 0 || strcmp(t, "Document") == 0)) { | ||
| 1392 | const char *mt = xs_mime_by_ext(url); | 1391 | const char *mt = xs_mime_by_ext(url); |
| 1393 | 1392 | ||
| 1394 | if (xs_startswith(mt, "image/") || | 1393 | if (xs_startswith(mt, "image/") || |