diff options
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 | { |
