diff options
Diffstat (limited to 'activitypub.c')
| -rw-r--r-- | activitypub.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/activitypub.c b/activitypub.c index dcbb79f..48a999a 100644 --- a/activitypub.c +++ b/activitypub.c | |||
| @@ -3034,13 +3034,15 @@ void process_queue_item(xs_dict *q_item) | |||
| 3034 | if (strcmp(type, "webmention") == 0) { | 3034 | if (strcmp(type, "webmention") == 0) { |
| 3035 | const xs_dict *msg = xs_dict_get(q_item, "message"); | 3035 | const xs_dict *msg = xs_dict_get(q_item, "message"); |
| 3036 | const char *source = xs_dict_get(msg, "id"); | 3036 | const char *source = xs_dict_get(msg, "id"); |
| 3037 | const xs_list *atts = xs_dict_get(msg, "attachment"); | 3037 | const char *content = xs_dict_get(msg, "content"); |
| 3038 | const xs_dict *att; | ||
| 3039 | 3038 | ||
| 3040 | xs_list_foreach(atts, att) { | 3039 | if (xs_is_string(source) && xs_is_string(content)) { |
| 3041 | const char *target = xs_dict_get(att, "url"); | 3040 | xs *links = xs_regex_select(content, "\"https?[^\"]+"); |
| 3041 | const char *link; | ||
| 3042 | |||
| 3043 | xs_list_foreach(links, link) { | ||
| 3044 | xs *target = xs_strip_chars_i(xs_dup(link), "\""); | ||
| 3042 | 3045 | ||
| 3043 | if (xs_is_string(source) && xs_is_string(target)) { | ||
| 3044 | int r = xs_webmention_send(source, target, USER_AGENT); | 3046 | int r = xs_webmention_send(source, target, USER_AGENT); |
| 3045 | 3047 | ||
| 3046 | srv_debug(1, xs_fmt("webmention source=%s target=%s %d", source, target, r)); | 3048 | srv_debug(1, xs_fmt("webmention source=%s target=%s %d", source, target, r)); |