summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2018-08-06 16:29:54 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2018-08-06 16:29:54 -0400
commit6e624b931ca55a02e51f0ee65b379a567696ae06 (patch)
tree942a6e14d3fa57b6ffda3e0f490c31ffe42bfe02
parent9da997788ce89df755abc88896d0daec20bc2bdf (diff)
downloadtoldya-6e624b931ca55a02e51f0ee65b379a567696ae06.tar.gz
toldya-6e624b931ca55a02e51f0ee65b379a567696ae06.tar.bz2
toldya-6e624b931ca55a02e51f0ee65b379a567696ae06.zip
Ignore locked accounts when syncing followers
This bot basically just shouldn't follow locked accounts, there's no reason for it to.
-rw-r--r--toldya.cpp24
m---------vendor/libtwittercpp0
2 files changed, 15 insertions, 9 deletions
diff --git a/toldya.cpp b/toldya.cpp index 55f00a8..0910945 100644 --- a/toldya.cpp +++ b/toldya.cpp
@@ -102,13 +102,13 @@ int main(int argc, char** argv)
102 std::end(followers), 102 std::end(followers),
103 std::back_inserter(oldFriends)); 103 std::back_inserter(oldFriends));
104 104
105 std::list<twitter::user_id> newFollowers; 105 std::set<twitter::user_id> newFollowers;
106 std::set_difference( 106 std::set_difference(
107 std::begin(followers), 107 std::begin(followers),
108 std::end(followers), 108 std::end(followers),
109 std::begin(friends), 109 std::begin(friends),
110 std::end(friends), 110 std::end(friends),
111 std::back_inserter(newFollowers)); 111 std::inserter(newFollowers, std::begin(newFollowers)));
112 112
113 std::set<twitter::user_id> oldFriendsSet; 113 std::set<twitter::user_id> oldFriendsSet;
114 for (twitter::user_id f : oldFriends) 114 for (twitter::user_id f : oldFriends)
@@ -125,15 +125,21 @@ int main(int argc, char** argv)
125 } 125 }
126 } 126 }
127 127
128 for (twitter::user_id f : newFollowers) 128 std::list<twitter::user> newFollowerObjs =
129 client.hydrateUsers(std::move(newFollowers));
130
131 for (const twitter::user& f : newFollowerObjs)
129 { 132 {
130 try 133 if (!f.isProtected())
131 {
132 client.follow(f);
133 } catch (const twitter::twitter_error& error)
134 { 134 {
135 std::cout << "Twitter error while following: " << error.what() 135 try
136 << std::endl; 136 {
137 client.follow(f);
138 } catch (const twitter::twitter_error& error)
139 {
140 std::cout << "Twitter error while following: " << error.what()
141 << std::endl;
142 }
137 } 143 }
138 } 144 }
139 145
diff --git a/vendor/libtwittercpp b/vendor/libtwittercpp
Subproject 204181c5654cee745b6b1ba98675609e784f0ee Subproject 4963c3dd55b765a33a16a77af432f2bfa12b835