mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-12 21:10:22 +03:00
Use xs_match() in some places for more clarity.
This commit is contained in:
parent
952da47c6d
commit
8ebfa10547
@ -9,6 +9,7 @@
|
|||||||
#include "xs_regex.h"
|
#include "xs_regex.h"
|
||||||
#include "xs_time.h"
|
#include "xs_time.h"
|
||||||
#include "xs_set.h"
|
#include "xs_set.h"
|
||||||
|
#include "xs_match.h"
|
||||||
|
|
||||||
#include "snac.h"
|
#include "snac.h"
|
||||||
|
|
||||||
@ -192,9 +193,7 @@ int timeline_request(snac *snac, char **id, xs_str **wrk, int level)
|
|||||||
type = "(null)";
|
type = "(null)";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(type, "Note") == 0 ||
|
if (xs_match(type, "Note|Page|Article")) {
|
||||||
strcmp(type, "Page") == 0 ||
|
|
||||||
strcmp(type, "Article") == 0) {
|
|
||||||
const char *actor = xs_dict_get(object, "attributedTo");
|
const char *actor = xs_dict_get(object, "attributedTo");
|
||||||
|
|
||||||
/* request (and drop) the actor for this entry */
|
/* request (and drop) the actor for this entry */
|
||||||
@ -441,7 +440,7 @@ int is_msg_for_me(snac *snac, const xs_dict *c_msg)
|
|||||||
{
|
{
|
||||||
const char *type = xs_dict_get(c_msg, "type");
|
const char *type = xs_dict_get(c_msg, "type");
|
||||||
|
|
||||||
if (strcmp(type, "Like") == 0 || strcmp(type, "Announce") == 0) {
|
if (xs_match(type, "Like|Announce")) {
|
||||||
const char *object = xs_dict_get(c_msg, "object");
|
const char *object = xs_dict_get(c_msg, "object");
|
||||||
|
|
||||||
if (xs_type(object) == XSTYPE_DICT)
|
if (xs_type(object) == XSTYPE_DICT)
|
||||||
@ -1648,16 +1647,14 @@ int process_input_message(snac *snac, xs_dict *msg, xs_dict *req)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (strcmp(type, "Update") == 0) { /** **/
|
if (strcmp(type, "Update") == 0) { /** **/
|
||||||
if (strcmp(utype, "Person") == 0 || strcmp(utype, "Service") == 0) { /** **/
|
if (xs_match(utype, "Person|Service")) { /** **/
|
||||||
actor_add(actor, xs_dict_get(msg, "object"));
|
actor_add(actor, xs_dict_get(msg, "object"));
|
||||||
timeline_touch(snac);
|
timeline_touch(snac);
|
||||||
|
|
||||||
snac_log(snac, xs_fmt("updated actor %s", actor));
|
snac_log(snac, xs_fmt("updated actor %s", actor));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (strcmp(utype, "Note") == 0 || /** **/
|
if (xs_match(utype, "Note|Page|Article")) { /** **/
|
||||||
strcmp(utype, "Page") == 0 || /** **/
|
|
||||||
strcmp(utype, "Article") == 0) { /** **/
|
|
||||||
const char *id = xs_dict_get(object, "id");
|
const char *id = xs_dict_get(object, "id");
|
||||||
|
|
||||||
object_add_ow(id, object);
|
object_add_ow(id, object);
|
||||||
|
Loading…
Reference in New Issue
Block a user