diff options
| author | 2024-10-19 21:01:20 +0200 | |
|---|---|---|
| committer | 2024-10-19 21:01:20 +0200 | |
| commit | 56d5de2e414da65d32bc5dba21a8face1f2469ba (patch) | |
| tree | 80dcf7cb4111ec3d4426113f6e37fc545b0cc48d /utils.c | |
| parent | Some work in CSV importing. (diff) | |
| download | penes-snac2-56d5de2e414da65d32bc5dba21a8face1f2469ba.tar.gz penes-snac2-56d5de2e414da65d32bc5dba21a8face1f2469ba.tar.xz penes-snac2-56d5de2e414da65d32bc5dba21a8face1f2469ba.zip | |
Also import following_accounts.csv.
Diffstat (limited to 'utils.c')
| -rw-r--r-- | utils.c | 29 |
1 files changed, 28 insertions, 1 deletions
| @@ -745,6 +745,10 @@ void import_csv(snac *user) | |||
| 745 | limit(user, actor); | 745 | limit(user, actor); |
| 746 | snac_log(user, xs_fmt("Limiting boosts from actor %s", actor)); | 746 | snac_log(user, xs_fmt("Limiting boosts from actor %s", actor)); |
| 747 | } | 747 | } |
| 748 | else { | ||
| 749 | unlimit(user, actor); | ||
| 750 | snac_log(user, xs_fmt("Unlimiting boosts from actor %s", actor)); | ||
| 751 | } | ||
| 748 | } | 752 | } |
| 749 | } | 753 | } |
| 750 | } | 754 | } |
| @@ -778,6 +782,30 @@ void import_csv(snac *user) | |||
| 778 | xs *l = xs_strip_i(xs_readline(f)); | 782 | xs *l = xs_strip_i(xs_readline(f)); |
| 779 | 783 | ||
| 780 | if (*l) { | 784 | if (*l) { |
| 785 | xs *post = NULL; | ||
| 786 | |||
| 787 | if (!object_get(l, &post)) { | ||
| 788 | if (!valid_status(activitypub_request(user, l, &post))) { | ||
| 789 | snac_log(user, xs_fmt("Error getting object %s for bookmarking", l)); | ||
| 790 | continue; | ||
| 791 | } | ||
| 792 | } | ||
| 793 | |||
| 794 | if (post == NULL) | ||
| 795 | continue; | ||
| 796 | |||
| 797 | /* request the actor that created the post */ | ||
| 798 | const char *actor = get_atto(post); | ||
| 799 | |||
| 800 | if (xs_type(actor) == XSTYPE_STRING) | ||
| 801 | actor_request(user, actor, NULL); | ||
| 802 | |||
| 803 | object_add_ow(l, post); | ||
| 804 | timeline_add(user, l, post); | ||
| 805 | |||
| 806 | bookmark(user, l); | ||
| 807 | |||
| 808 | snac_log(user, xs_fmt("Bookmarked %s", l)); | ||
| 781 | } | 809 | } |
| 782 | } | 810 | } |
| 783 | 811 | ||
| @@ -785,5 +813,4 @@ void import_csv(snac *user) | |||
| 785 | } | 813 | } |
| 786 | else | 814 | else |
| 787 | snac_log(user, xs_fmt("Cannot open file %s", fn)); | 815 | snac_log(user, xs_fmt("Cannot open file %s", fn)); |
| 788 | |||
| 789 | } | 816 | } |