From 35813412a845edfdcc513300e25324145f53d9a3 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Mon, 6 Aug 2018 16:24:05 -0400 Subject: Ignore locked accounts when syncing followers refs #1 --- snitch.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'snitch.cpp') diff --git a/snitch.cpp b/snitch.cpp index 1d21449..65afff3 100644 --- a/snitch.cpp +++ b/snitch.cpp @@ -68,22 +68,28 @@ int main(int argc, char** argv) std::end(followers), std::back_inserter(oldFriends)); - std::list newFollowers; + std::set newFollowers; std::set_difference( std::begin(followers), std::end(followers), std::begin(friends), std::end(friends), - std::back_inserter(newFollowers)); + std::inserter(newFollowers, std::begin(newFollowers))); for (twitter::user_id f : oldFriends) { client.unfollow(f); } - for (twitter::user_id f : newFollowers) + std::list newFollowerObjs = + client.hydrateUsers(std::move(newFollowers)); + + for (twitter::user f : newFollowerObjs) { - client.follow(f); + if (!f.isProtected()) + { + client.follow(f); + } } } catch (const twitter::twitter_error& error) { -- cgit 1.4.1