diff options
Diffstat (limited to 'activitypub.c')
| -rw-r--r-- | activitypub.c | 35 |
1 files changed, 21 insertions, 14 deletions
diff --git a/activitypub.c b/activitypub.c index aa679a0..3f4b313 100644 --- a/activitypub.c +++ b/activitypub.c | |||
| @@ -2183,25 +2183,32 @@ int process_input_message(snac *snac, const xs_dict *msg, const xs_dict *req) | |||
| 2183 | if (strcmp(type, "Undo") == 0) { /** **/ | 2183 | if (strcmp(type, "Undo") == 0) { /** **/ |
| 2184 | const char *id = xs_dict_get(object, "object"); | 2184 | const char *id = xs_dict_get(object, "object"); |
| 2185 | 2185 | ||
| 2186 | if (xs_type(object) != XSTYPE_DICT) | 2186 | if (xs_type(object) != XSTYPE_DICT) { |
| 2187 | snac_debug(snac, 1, xs_fmt("undo: overriding utype %s | %s | %s", | ||
| 2188 | utype, id, actor)); | ||
| 2187 | utype = "Follow"; | 2189 | utype = "Follow"; |
| 2190 | } | ||
| 2188 | 2191 | ||
| 2189 | if (strcmp(utype, "Follow") == 0) { /** **/ | 2192 | if (strcmp(utype, "Follow") == 0) { /** **/ |
| 2190 | if (id && strcmp(id, snac->actor) != 0) | 2193 | if (!id) { |
| 2194 | snac_log(snac, xs_fmt("no id (msg.object.object) when " | ||
| 2195 | "handling follow: %s", actor)); | ||
| 2196 | return 1; | ||
| 2197 | } | ||
| 2198 | if (strcmp(id, snac->actor) != 0) | ||
| 2191 | snac_debug(snac, 1, xs_fmt("Undo + Follow from %s not for us (%s)", actor, id)); | 2199 | snac_debug(snac, 1, xs_fmt("Undo + Follow from %s not for us (%s)", actor, id)); |
| 2192 | else { | 2200 | else |
| 2193 | if (valid_status(follower_del(snac, actor))) { | 2201 | if (valid_status(follower_del(snac, actor))) { |
| 2194 | snac_log(snac, xs_fmt("no longer following us %s", actor)); | 2202 | snac_log(snac, xs_fmt("no longer following us %s", actor)); |
| 2195 | do_notify = 1; | 2203 | do_notify = 1; |
| 2196 | } | ||
| 2197 | else | ||
| 2198 | if (pending_check(snac, actor)) { | ||
| 2199 | pending_del(snac, actor); | ||
| 2200 | snac_log(snac, xs_fmt("cancelled pending follow from %s", actor)); | ||
| 2201 | } | ||
| 2202 | else | ||
| 2203 | snac_log(snac, xs_fmt("error deleting follower %s", actor)); | ||
| 2204 | } | 2204 | } |
| 2205 | else | ||
| 2206 | if (pending_check(snac, actor)) { | ||
| 2207 | pending_del(snac, actor); | ||
| 2208 | snac_log(snac, xs_fmt("cancelled pending follow from %s", actor)); | ||
| 2209 | } | ||
| 2210 | else | ||
| 2211 | snac_log(snac, xs_fmt("error deleting follower %s", actor)); | ||
| 2205 | } | 2212 | } |
| 2206 | else | 2213 | else |
| 2207 | if (strcmp(utype, "Like") == 0 || strcmp(utype, "EmojiReact") == 0) { /** **/ | 2214 | if (strcmp(utype, "Like") == 0 || strcmp(utype, "EmojiReact") == 0) { /** **/ |