summaryrefslogtreecommitdiff
path: root/activitypub.c
diff options
context:
space:
mode:
authordefault <nobody@localhost>2022-11-02 20:28:40 +0100
committerdefault <nobody@localhost>2022-11-02 20:28:40 +0100
commitdbe60be4f3818336e7e91c6153fcf846303eed04 (patch)
tree13f52fe3a0f8eecb9ee3ba984a76eabf829d8c17 /activitypub.c
parent38509f5e142511f494ed33625a25d87059c6e369 (diff)
Fixed bug when following by @user@host.
Diffstat (limited to 'activitypub.c')
-rw-r--r--activitypub.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/activitypub.c b/activitypub.c
index 164c6e6..be1cc5d 100644
--- a/activitypub.c
+++ b/activitypub.c
@@ -484,13 +484,22 @@ d_char *msg_delete(snac *snac, char *id)
}
-d_char *msg_follow(snac *snac, char *actor)
+d_char *msg_follow(snac *snac, char *url_or_uid)
/* creates a 'Follow' message */
{
- d_char *actor_o = NULL;
+ xs *actor_o = NULL;
+ xs *actor = NULL;
d_char *msg = NULL;
int status;
+ if (xs_startswith(url_or_uid, "https:/"))
+ actor = xs_dup(url_or_uid);
+ else
+ if (!valid_status(webfinger_request(url_or_uid, &actor, NULL))) {
+ snac_log(snac, xs_fmt("cannot resolve user %s to follow", url_or_uid));
+ return NULL;
+ }
+
/* request the actor */
status = actor_request(snac, actor, &actor_o);