aboutsummaryrefslogtreecommitdiff
path: root/activitypub.c
diff options
context:
space:
mode:
authorshtrophic <christoph@liebender.dev>2024-11-19 21:40:18 +0100
committershtrophic <christoph@liebender.dev>2024-11-19 21:40:18 +0100
commit67431130162b1027cc3894f947be309b2daa3cd3 (patch)
tree847930f363f0d6f13e688342dab8623de78db651 /activitypub.c
parent972783fcb2d7855847f0ea0832da2abc71aa6b30 (diff)
parent3a9118524831d1f3a9168034c1655e515f162020 (diff)
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'activitypub.c')
-rw-r--r--activitypub.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/activitypub.c b/activitypub.c
index 0b2fc6a..473675d 100644
--- a/activitypub.c
+++ b/activitypub.c
@@ -183,6 +183,18 @@ const char *get_atto(const xs_dict *msg)
}
+const char *get_in_reply_to(const xs_dict *msg)
+/* gets the inReplyTo id */
+{
+ const xs_val *in_reply_to = xs_dict_get(msg, "inReplyTo");
+
+ if (xs_type(in_reply_to) == XSTYPE_DICT)
+ in_reply_to = xs_dict_get(in_reply_to, "id");
+
+ return in_reply_to;
+}
+
+
xs_list *get_attachments(const xs_dict *msg)
/* unify the garbage fire that are the attachments */
{
@@ -373,7 +385,7 @@ int timeline_request(snac *snac, const char **id, xs_str **wrk, int level)
}
/* does it have an ancestor? */
- const char *in_reply_to = xs_dict_get(object, "inReplyTo");
+ const char *in_reply_to = get_in_reply_to(object);
/* store */
timeline_add(snac, nid, object);
@@ -671,7 +683,7 @@ int is_msg_for_me(snac *snac, const xs_dict *c_msg)
return 3;
/* is this message a reply to another? */
- const char *irt = xs_dict_get(msg, "inReplyTo");
+ const char *irt = get_in_reply_to(msg);
if (!xs_is_null(irt)) {
xs *r_msg = NULL;
@@ -724,7 +736,7 @@ xs_str *process_tags(snac *snac, const char *content, xs_list **tag)
/* use this same server */
def_srv = xs_dup(xs_dict_get(srv_config, "host"));
- split = xs_regex_split(content, "(@[A-Za-z0-9_]+(@[A-Za-z0-9\\.-]+)?|&#[0-9]+;|#[^[:punct:][:space:]]+)");
+ split = xs_regex_split(content, "(@[A-Za-z0-9_]+(@[A-Za-z0-9\\.-]+)?|&#[0-9]+;|#(_|[^[:punct:][:space:]])+)");
p = split;
while (xs_list_iter(&p, &v)) {
@@ -1957,7 +1969,7 @@ int process_input_message(snac *snac, const xs_dict *msg, const xs_dict *req)
if (xs_match(utype, "Note|Article")) { /** **/
const char *id = xs_dict_get(object, "id");
- const char *in_reply_to = xs_dict_get(object, "inReplyTo");
+ const char *in_reply_to = get_in_reply_to(object);
const char *atto = get_atto(object);
xs *wrk = NULL;