summaryrefslogtreecommitdiff
path: root/activitypub.c
diff options
context:
space:
mode:
Diffstat (limited to 'activitypub.c')
-rw-r--r--activitypub.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/activitypub.c b/activitypub.c
index c43b0f4..32d0697 100644
--- a/activitypub.c
+++ b/activitypub.c
@@ -9,6 +9,7 @@
9#include "xs_regex.h" 9#include "xs_regex.h"
10#include "xs_time.h" 10#include "xs_time.h"
11#include "xs_set.h" 11#include "xs_set.h"
12#include "xs_match.h"
12 13
13#include "snac.h" 14#include "snac.h"
14 15
@@ -192,9 +193,7 @@ int timeline_request(snac *snac, char **id, xs_str **wrk, int level)
192 type = "(null)"; 193 type = "(null)";
193 } 194 }
194 195
195 if (strcmp(type, "Note") == 0 || 196 if (xs_match(type, "Note|Page|Article")) {
196 strcmp(type, "Page") == 0 ||
197 strcmp(type, "Article") == 0) {
198 const char *actor = xs_dict_get(object, "attributedTo"); 197 const char *actor = xs_dict_get(object, "attributedTo");
199 198
200 /* request (and drop) the actor for this entry */ 199 /* request (and drop) the actor for this entry */
@@ -441,7 +440,7 @@ int is_msg_for_me(snac *snac, const xs_dict *c_msg)
441{ 440{
442 const char *type = xs_dict_get(c_msg, "type"); 441 const char *type = xs_dict_get(c_msg, "type");
443 442
444 if (strcmp(type, "Like") == 0 || strcmp(type, "Announce") == 0) { 443 if (xs_match(type, "Like|Announce")) {
445 const char *object = xs_dict_get(c_msg, "object"); 444 const char *object = xs_dict_get(c_msg, "object");
446 445
447 if (xs_type(object) == XSTYPE_DICT) 446 if (xs_type(object) == XSTYPE_DICT)
@@ -1648,16 +1647,14 @@ int process_input_message(snac *snac, xs_dict *msg, xs_dict *req)
1648 } 1647 }
1649 else 1648 else
1650 if (strcmp(type, "Update") == 0) { /** **/ 1649 if (strcmp(type, "Update") == 0) { /** **/
1651 if (strcmp(utype, "Person") == 0 || strcmp(utype, "Service") == 0) { /** **/ 1650 if (xs_match(utype, "Person|Service")) { /** **/
1652 actor_add(actor, xs_dict_get(msg, "object")); 1651 actor_add(actor, xs_dict_get(msg, "object"));
1653 timeline_touch(snac); 1652 timeline_touch(snac);
1654 1653
1655 snac_log(snac, xs_fmt("updated actor %s", actor)); 1654 snac_log(snac, xs_fmt("updated actor %s", actor));
1656 } 1655 }
1657 else 1656 else
1658 if (strcmp(utype, "Note") == 0 || /** **/ 1657 if (xs_match(utype, "Note|Page|Article")) { /** **/
1659 strcmp(utype, "Page") == 0 || /** **/
1660 strcmp(utype, "Article") == 0) { /** **/
1661 const char *id = xs_dict_get(object, "id"); 1658 const char *id = xs_dict_get(object, "id");
1662 1659
1663 object_add_ow(id, object); 1660 object_add_ow(id, object);