diff options
Diffstat (limited to 'father.cpp')
| -rw-r--r-- | father.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
| diff --git a/father.cpp b/father.cpp index 4ff4a3c..d95f506 100644 --- a/father.cpp +++ b/father.cpp | |||
| @@ -80,22 +80,28 @@ int main(int argc, char** argv) | |||
| 80 | std::end(followers), | 80 | std::end(followers), |
| 81 | std::back_inserter(oldFriends)); | 81 | std::back_inserter(oldFriends)); |
| 82 | 82 | ||
| 83 | std::list<twitter::user_id> newFollowers; | 83 | std::set<twitter::user_id> newFollowers; |
| 84 | std::set_difference( | 84 | std::set_difference( |
| 85 | std::begin(followers), | 85 | std::begin(followers), |
| 86 | std::end(followers), | 86 | std::end(followers), |
| 87 | std::begin(friends), | 87 | std::begin(friends), |
| 88 | std::end(friends), | 88 | std::end(friends), |
| 89 | std::back_inserter(newFollowers)); | 89 | std::inserter(newFollowers, std::begin(newFollowers))); |
| 90 | 90 | ||
| 91 | for (twitter::user_id f : oldFriends) | 91 | for (twitter::user_id f : oldFriends) |
| 92 | { | 92 | { |
| 93 | client.unfollow(f); | 93 | client.unfollow(f); |
| 94 | } | 94 | } |
| 95 | 95 | ||
| 96 | for (twitter::user_id f : newFollowers) | 96 | std::list<twitter::user> newFollowerObjs = |
| 97 | client.hydrateUsers(std::move(newFollowers)); | ||
| 98 | |||
| 99 | for (twitter::user f : newFollowerObjs) | ||
| 97 | { | 100 | { |
| 98 | client.follow(f); | 101 | if (!f.isProtected()) |
| 102 | { | ||
| 103 | client.follow(f); | ||
| 104 | } | ||
| 99 | } | 105 | } |
| 100 | } catch (const twitter::twitter_error& error) | 106 | } catch (const twitter::twitter_error& error) |
| 101 | { | 107 | { |
