summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--activitypub.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/activitypub.c b/activitypub.c
index 7a8d4fa..9a49ba9 100644
--- a/activitypub.c
+++ b/activitypub.c
@@ -2667,7 +2667,7 @@ int process_queue(void)
2667/** account migration **/ 2667/** account migration **/
2668 2668
2669int migrate_account(snac *user) 2669int migrate_account(snac *user)
2670/* migrates this account to a new one (stored in the 'aka' user field) */ 2670/* migrates this account to a new one (stored in the 'alias' user field) */
2671{ 2671{
2672 const char *new_account = xs_dict_get(user->config, "alias"); 2672 const char *new_account = xs_dict_get(user->config, "alias");
2673 2673
@@ -2676,6 +2676,26 @@ int migrate_account(snac *user)
2676 return 1; 2676 return 1;
2677 } 2677 }
2678 2678
2679 xs *new_actor = NULL;
2680 int status;
2681
2682 if (!valid_status(status = actor_request(user, new_account, &new_actor))) {
2683 snac_log(user, xs_fmt("Cannot migrate: error requesting actor %s %d", new_account, status));
2684 return 1;
2685 }
2686
2687 const char *loaka = xs_dict_get(new_actor, "alsoKnownAs");
2688
2689 if (xs_type(loaka) != XSTYPE_LIST) {
2690 snac_log(user, xs_fmt("Cannot migrate: destination account doesn't have any aliases"));
2691 return 1;
2692 }
2693
2694 if (xs_list_in(loaka, user->actor) == -1) {
2695 snac_log(user, xs_fmt("Cannot migrate: destination account doesn't have this one as an alias"));
2696 return 1;
2697 }
2698
2679 return 0; 2699 return 0;
2680} 2700}
2681 2701