diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-08-06 16:24:05 -0400 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-08-06 16:24:05 -0400 |
commit | 35813412a845edfdcc513300e25324145f53d9a3 (patch) | |
tree | d56ee7296e157af6075d58e38fbba88525d80e7b /snitch.cpp | |
parent | 4f57eb0e3a2163a32bf84475e3c575c851599760 (diff) | |
download | snitch-35813412a845edfdcc513300e25324145f53d9a3.tar.gz snitch-35813412a845edfdcc513300e25324145f53d9a3.tar.bz2 snitch-35813412a845edfdcc513300e25324145f53d9a3.zip |
Ignore locked accounts when syncing followers
refs #1
Diffstat (limited to 'snitch.cpp')
-rw-r--r-- | snitch.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
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) | |||
68 | std::end(followers), | 68 | std::end(followers), |
69 | std::back_inserter(oldFriends)); | 69 | std::back_inserter(oldFriends)); |
70 | 70 | ||
71 | std::list<twitter::user_id> newFollowers; | 71 | std::set<twitter::user_id> newFollowers; |
72 | std::set_difference( | 72 | std::set_difference( |
73 | std::begin(followers), | 73 | std::begin(followers), |
74 | std::end(followers), | 74 | std::end(followers), |
75 | std::begin(friends), | 75 | std::begin(friends), |
76 | std::end(friends), | 76 | std::end(friends), |
77 | std::back_inserter(newFollowers)); | 77 | std::inserter(newFollowers, std::begin(newFollowers))); |
78 | 78 | ||
79 | for (twitter::user_id f : oldFriends) | 79 | for (twitter::user_id f : oldFriends) |
80 | { | 80 | { |
81 | client.unfollow(f); | 81 | client.unfollow(f); |
82 | } | 82 | } |
83 | 83 | ||
84 | for (twitter::user_id f : newFollowers) | 84 | std::list<twitter::user> newFollowerObjs = |
85 | client.hydrateUsers(std::move(newFollowers)); | ||
86 | |||
87 | for (twitter::user f : newFollowerObjs) | ||
85 | { | 88 | { |
86 | client.follow(f); | 89 | if (!f.isProtected()) |
90 | { | ||
91 | client.follow(f); | ||
92 | } | ||
87 | } | 93 | } |
88 | } catch (const twitter::twitter_error& error) | 94 | } catch (const twitter::twitter_error& error) |
89 | { | 95 | { |