mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-12-27 01:33:36 +00:00
Unified post-like object type match.
This commit is contained in:
parent
3954361785
commit
e1ce85debd
5 changed files with 8 additions and 6 deletions
|
@ -355,7 +355,7 @@ int timeline_request(snac *snac, char **id, xs_str **wrk, int level)
|
||||||
type = "(null)";
|
type = "(null)";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xs_match(type, "Note|Page|Article|Video")) {
|
if (xs_match(type, POSTLIKE_OBJECT_TYPE)) {
|
||||||
const char *actor = get_atto(object);
|
const char *actor = get_atto(object);
|
||||||
|
|
||||||
if (content_check("filter_reject.txt", object))
|
if (content_check("filter_reject.txt", object))
|
||||||
|
|
2
data.c
2
data.c
|
@ -2577,7 +2577,7 @@ xs_list *content_search(snac *user, const char *regex,
|
||||||
if (!valid_status(timeline_get_by_md5(user, md5, &post)))
|
if (!valid_status(timeline_get_by_md5(user, md5, &post)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!xs_match(xs_dict_get_def(post, "type", "-"), "Note|Question|Page|Article|Video"))
|
if (!xs_match(xs_dict_get_def(post, "type", "-"), POSTLIKE_OBJECT_TYPE))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
char *content = xs_dict_get(post, "content");
|
char *content = xs_dict_get(post, "content");
|
||||||
|
|
4
html.c
4
html.c
|
@ -256,7 +256,7 @@ xs_html *html_msg_icon(snac *user, char *actor_id, 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 (xs_match(type, "Note|Question|Page|Article|Video"))
|
if (xs_match(type, POSTLIKE_OBJECT_TYPE))
|
||||||
url = xs_dict_get(msg, "id");
|
url = xs_dict_get(msg, "id");
|
||||||
|
|
||||||
priv = !is_msg_public(msg);
|
priv = !is_msg_public(msg);
|
||||||
|
@ -1405,7 +1405,7 @@ xs_html *html_entry(snac *user, xs_dict *msg, int read_only,
|
||||||
html_msg_icon(read_only ? NULL : user, xs_dict_get(msg, "actor"), msg)));
|
html_msg_icon(read_only ? NULL : user, xs_dict_get(msg, "actor"), msg)));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (!xs_match(type, "Note|Question|Page|Article|Video")) {
|
if (!xs_match(type, POSTLIKE_OBJECT_TYPE)) {
|
||||||
/* skip oddities */
|
/* skip oddities */
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1504,7 +1504,7 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
|
||||||
/* discard non-Notes */
|
/* discard non-Notes */
|
||||||
const char *id = xs_dict_get(msg, "id");
|
const char *id = xs_dict_get(msg, "id");
|
||||||
const char *type = xs_dict_get(msg, "type");
|
const char *type = xs_dict_get(msg, "type");
|
||||||
if (!xs_match(type, "Note|Question|Page|Article|Video"))
|
if (!xs_match(type, POSTLIKE_OBJECT_TYPE))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const char *from = NULL;
|
const char *from = NULL;
|
||||||
|
@ -1681,7 +1681,7 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
|
||||||
/* discard non-Notes */
|
/* discard non-Notes */
|
||||||
const char *id = xs_dict_get(msg, "id");
|
const char *id = xs_dict_get(msg, "id");
|
||||||
const char *type = xs_dict_get(msg, "type");
|
const char *type = xs_dict_get(msg, "type");
|
||||||
if (!xs_match(type, "Note|Question|Page|Article|Video"))
|
if (!xs_match(type, POSTLIKE_OBJECT_TYPE))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const char *from = NULL;
|
const char *from = NULL;
|
||||||
|
|
2
snac.h
2
snac.h
|
@ -29,6 +29,8 @@ extern int dbglevel;
|
||||||
|
|
||||||
#define L(s) (s)
|
#define L(s) (s)
|
||||||
|
|
||||||
|
#define POSTLIKE_OBJECT_TYPE "Note|Question|Page|Article|Video"
|
||||||
|
|
||||||
int mkdirx(const char *pathname);
|
int mkdirx(const char *pathname);
|
||||||
|
|
||||||
int valid_status(int status);
|
int valid_status(int status);
|
||||||
|
|
Loading…
Reference in a new issue