about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2016-06-01 20:40:06 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2016-06-01 20:40:06 -0400
commitc132dc01c600349ffe5c8ec8622b5393451b3db8 (patch)
tree87081300b8f387833daf6e5a728eaec5390c945f
parent5ce05b81520d06a78165c5c5039007c9f29d4b23 (diff)
downloadrawr-ebooks-c132dc01c600349ffe5c8ec8622b5393451b3db8.tar.gz
rawr-ebooks-c132dc01c600349ffe5c8ec8622b5393451b3db8.tar.bz2
rawr-ebooks-c132dc01c600349ffe5c8ec8622b5393451b3db8.zip
Updated libtwitter++ (error handling with bad responses)
-rw-r--r--ebooks.cpp12
m---------vendor/libtwittercpp0
2 files changed, 10 insertions, 2 deletions
diff --git a/ebooks.cpp b/ebooks.cpp index c183923..dd9c7bd 100644 --- a/ebooks.cpp +++ b/ebooks.cpp
@@ -77,10 +77,18 @@ int main(int argc, char** args)
77 77
78 std::mutex stats_mutex; 78 std::mutex stats_mutex;
79 79
80 twitter::user me;
81 auto resp = client.getUser(me);
82 if (resp != twitter::response::ok)
83 {
84 std::cout << "Could not get current Twitter user" << std::endl;
85 return -1;
86 }
87
80 client.setUserStreamNotifyCallback([&] (twitter::notification n) { 88 client.setUserStreamNotifyCallback([&] (twitter::notification n) {
81 if (n.getType() == twitter::notification::type::tweet) 89 if (n.getType() == twitter::notification::type::tweet)
82 { 90 {
83 if ((!n.getTweet().isRetweet()) && (n.getTweet().getAuthor() != client.getUser())) 91 if ((!n.getTweet().isRetweet()) && (n.getTweet().getAuthor() != me))
84 { 92 {
85 std::string original = n.getTweet().getText(); 93 std::string original = n.getTweet().getText();
86 std::string canonical; 94 std::string canonical;
@@ -122,7 +130,7 @@ int main(int argc, char** args)
122 doc.resize(140); 130 doc.resize(140);
123 131
124 twitter::tweet tw; 132 twitter::tweet tw;
125 twitter::response resp = client.updateStatus(doc, tw); 133 resp = client.updateStatus(doc, tw);
126 if (resp != twitter::response::ok) 134 if (resp != twitter::response::ok)
127 { 135 {
128 std::cout << "Twitter error while tweeting: " << resp << std::endl; 136 std::cout << "Twitter error while tweeting: " << resp << std::endl;
diff --git a/vendor/libtwittercpp b/vendor/libtwittercpp
Subproject cec9786bc11c897a00cf7ab8baafb142a709ba2 Subproject 442f1ee071152be04c4184473ddfee5040795b7