mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-12 21:10:22 +03:00
Used xs_match() in some places.
This commit is contained in:
parent
f31eb8d9f2
commit
749dbef349
2
Makefile
2
Makefile
@ -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 \
|
|||||||
xs_time.h snac.h
|
xs_time.h snac.h
|
||||||
format.o: format.c xs.h xs_regex.h xs_mime.h snac.h
|
format.o: format.c xs.h xs_regex.h xs_mime.h snac.h
|
||||||
html.o: html.c xs.h xs_io.h xs_json.h xs_regex.h xs_set.h xs_openssl.h \
|
html.o: html.c xs.h xs_io.h xs_json.h xs_regex.h xs_set.h xs_openssl.h \
|
||||||
xs_time.h xs_mime.h snac.h
|
xs_time.h xs_mime.h xs_match.h snac.h
|
||||||
http.o: http.c xs.h xs_io.h xs_openssl.h xs_curl.h xs_time.h xs_json.h \
|
http.o: http.c xs.h xs_io.h xs_openssl.h xs_curl.h xs_time.h xs_json.h \
|
||||||
snac.h
|
snac.h
|
||||||
httpd.o: httpd.c xs.h xs_io.h xs_json.h xs_socket.h xs_httpd.h xs_mime.h \
|
httpd.o: httpd.c xs.h xs_io.h xs_json.h xs_socket.h xs_httpd.h xs_mime.h \
|
||||||
|
7
html.c
7
html.c
@ -9,6 +9,7 @@
|
|||||||
#include "xs_openssl.h"
|
#include "xs_openssl.h"
|
||||||
#include "xs_time.h"
|
#include "xs_time.h"
|
||||||
#include "xs_mime.h"
|
#include "xs_mime.h"
|
||||||
|
#include "xs_match.h"
|
||||||
|
|
||||||
#include "snac.h"
|
#include "snac.h"
|
||||||
|
|
||||||
@ -203,8 +204,7 @@ xs_str *html_msg_icon(xs_str *os, const xs_dict *msg)
|
|||||||
int priv = 0;
|
int priv = 0;
|
||||||
const char *type = xs_dict_get(msg, "type");
|
const char *type = xs_dict_get(msg, "type");
|
||||||
|
|
||||||
if (strcmp(type, "Note") == 0 || strcmp(type, "Question") == 0 ||
|
if (xs_match(type, "Note|Question|Page|Article"))
|
||||||
strcmp(type, "Page") == 0 || strcmp(type, "Article") == 0)
|
|
||||||
url = xs_dict_get(msg, "id");
|
url = xs_dict_get(msg, "id");
|
||||||
|
|
||||||
priv = !is_msg_public(msg);
|
priv = !is_msg_public(msg);
|
||||||
@ -1387,8 +1387,7 @@ xs_str *html_entry(snac *user, xs_str *os, const xs_dict *msg, int local,
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* infer MIME type from non-specific attachments */
|
/* infer MIME type from non-specific attachments */
|
||||||
if (xs_list_len(attach) < 2 &&
|
if (xs_list_len(attach) < 2 && xs_match(t, "Link|Document")) {
|
||||||
(strcmp(t, "Link") == 0 || strcmp(t, "Document") == 0)) {
|
|
||||||
const char *mt = xs_mime_by_ext(url);
|
const char *mt = xs_mime_by_ext(url);
|
||||||
|
|
||||||
if (xs_startswith(mt, "image/") ||
|
if (xs_startswith(mt, "image/") ||
|
||||||
|
Loading…
Reference in New Issue
Block a user