about summary refs log tree commit diff stats
path: root/src/notification.h
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2018-08-05 11:14:39 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2018-08-05 11:14:39 -0400
commit38203b745ae1903ba0804ed5532b78d255bea635 (patch)
tree52f57ce85e65361c534c461abc82fb1ed9768d49 /src/notification.h
parent7c44fd17bb6be54a2ea4b60761e91053ca988977 (diff)
downloadlibtwittercpp-38203b745ae1903ba0804ed5532b78d255bea635.tar.gz
libtwittercpp-38203b745ae1903ba0804ed5532b78d255bea635.tar.bz2
libtwittercpp-38203b745ae1903ba0804ed5532b78d255bea635.zip
Added timeline polling
Because the streaming API will sunset on August 16th, it is essential to implement timeline polling so that the library can still be used to access tweets. This commit breaks the current API even for clients still using the streaming API because the OAuth connection data was pulled from twitter::client into twitter::auth. Other than that, almost everything works the same, and if a client wants to update their libtwitter++ within the next week and a half, they are free to.
Diffstat (limited to 'src/notification.h')
-rw-r--r--src/notification.h58
1 files changed, 29 insertions, 29 deletions
diff --git a/src/notification.h b/src/notification.h index a6dd6f4..ad649c3 100644 --- a/src/notification.h +++ b/src/notification.h
@@ -10,9 +10,9 @@
10#include "direct_message.h" 10#include "direct_message.h"
11 11
12namespace twitter { 12namespace twitter {
13 13
14 class client; 14 class client;
15 15
16 enum class disconnect_code 16 enum class disconnect_code
17 { 17 {
18 shutdown, 18 shutdown,
@@ -27,13 +27,13 @@ namespace twitter {
27 load, 27 load,
28 unknown 28 unknown
29 }; 29 };
30 30
31 class notification { 31 class notification {
32 public: 32 public:
33 enum class type { 33 enum class type {
34 // Tweet object 34 // Tweet object
35 tweet, 35 tweet,
36 36
37 // User object 37 // User object
38 update_user, 38 update_user,
39 block, 39 block,
@@ -41,19 +41,19 @@ namespace twitter {
41 follow, 41 follow,
42 followed, 42 followed,
43 unfollow, 43 unfollow,
44 44
45 // User and tweet 45 // User and tweet
46 favorite, 46 favorite,
47 favorited, 47 favorited,
48 unfavorite, 48 unfavorite,
49 unfavorited, 49 unfavorited,
50 quoted, 50 quoted,
51 51
52 // List 52 // List
53 list_created, 53 list_created,
54 list_destroyed, 54 list_destroyed,
55 list_updated, 55 list_updated,
56 56
57 // User and list 57 // User and list
58 list_add, 58 list_add,
59 list_added, 59 list_added,
@@ -63,16 +63,16 @@ namespace twitter {
63 list_subscribed, 63 list_subscribed,
64 list_unsubscribe, 64 list_unsubscribe,
65 list_unsubscribed, 65 list_unsubscribed,
66 66
67 // Warning 67 // Warning
68 stall, 68 stall,
69 follow_limit, 69 follow_limit,
70 unknown_warning, 70 unknown_warning,
71 71
72 // User ID and tweet ID 72 // User ID and tweet ID
73 deletion, 73 deletion,
74 scrub_location, 74 scrub_location,
75 75
76 // Special 76 // Special
77 limit, 77 limit,
78 withhold_status, 78 withhold_status,
@@ -80,78 +80,78 @@ namespace twitter {
80 disconnect, 80 disconnect,
81 friends, 81 friends,
82 direct, 82 direct,
83 83
84 // Nothing 84 // Nothing
85 unknown, 85 unknown,
86 invalid 86 invalid
87 }; 87 };
88 88
89 type getType() const; 89 type getType() const;
90 90
91 notification() {} 91 notification() {}
92 notification(const client& tclient, std::string data); 92 notification(const user& currentUser, std::string data);
93 93
94 notification(const notification& other); 94 notification(const notification& other);
95 notification(notification&& other); 95 notification(notification&& other);
96 notification& operator=(notification other); 96 notification& operator=(notification other);
97 ~notification(); 97 ~notification();
98 98
99 friend void swap(notification& first, notification& second); 99 friend void swap(notification& first, notification& second);
100 100
101 const tweet& getTweet() const; 101 const tweet& getTweet() const;
102 tweet& getTweet() 102 tweet& getTweet()
103 { 103 {
104 return const_cast<tweet&>(static_cast<const notification&>(*this).getTweet()); 104 return const_cast<tweet&>(static_cast<const notification&>(*this).getTweet());
105 } 105 }
106 106
107 const user& getUser() const; 107 const user& getUser() const;
108 user& getUser() 108 user& getUser()
109 { 109 {
110 return const_cast<user&>(static_cast<const notification&>(*this).getUser()); 110 return const_cast<user&>(static_cast<const notification&>(*this).getUser());
111 } 111 }
112 112
113 const list& getList() const; 113 const list& getList() const;
114 list& getList() 114 list& getList()
115 { 115 {
116 return const_cast<list&>(static_cast<const notification&>(*this).getList()); 116 return const_cast<list&>(static_cast<const notification&>(*this).getList());
117 } 117 }
118 118
119 tweet_id getTweetID() const; 119 tweet_id getTweetID() const;
120 void setTweetID(tweet_id _arg); 120 void setTweetID(tweet_id _arg);
121 121
122 user_id getUserID() const; 122 user_id getUserID() const;
123 void setUserID(user_id _arg); 123 void setUserID(user_id _arg);
124 124
125 const std::vector<std::string>& getCountries() const; 125 const std::vector<std::string>& getCountries() const;
126 std::vector<std::string>& getCountries() 126 std::vector<std::string>& getCountries()
127 { 127 {
128 return const_cast<std::vector<std::string>&>(static_cast<const notification&>(*this).getCountries()); 128 return const_cast<std::vector<std::string>&>(static_cast<const notification&>(*this).getCountries());
129 } 129 }
130 130
131 disconnect_code getDisconnectCode() const; 131 disconnect_code getDisconnectCode() const;
132 void setDisconnectCode(disconnect_code _arg); 132 void setDisconnectCode(disconnect_code _arg);
133 133
134 const std::set<user_id>& getFriends() const; 134 const std::set<user_id>& getFriends() const;
135 std::set<user_id>& getFriends() 135 std::set<user_id>& getFriends()
136 { 136 {
137 return const_cast<std::set<user_id>&>(static_cast<const notification&>(*this).getFriends()); 137 return const_cast<std::set<user_id>&>(static_cast<const notification&>(*this).getFriends());
138 } 138 }
139 139
140 const direct_message& getDirectMessage() const; 140 const direct_message& getDirectMessage() const;
141 direct_message& getDirectMessage() 141 direct_message& getDirectMessage()
142 { 142 {
143 return const_cast<direct_message&>(static_cast<const notification&>(*this).getDirectMessage()); 143 return const_cast<direct_message&>(static_cast<const notification&>(*this).getDirectMessage());
144 } 144 }
145 145
146 int getLimit() const; 146 int getLimit() const;
147 void setLimit(int _arg); 147 void setLimit(int _arg);
148 148
149 const std::string& getWarning() const; 149 const std::string& getWarning() const;
150 std::string& getWarning() 150 std::string& getWarning()
151 { 151 {
152 return const_cast<std::string&>(static_cast<const notification&>(*this).getWarning()); 152 return const_cast<std::string&>(static_cast<const notification&>(*this).getWarning());
153 } 153 }
154 154
155 private: 155 private:
156 union { 156 union {
157 tweet _tweet; 157 tweet _tweet;
@@ -186,7 +186,7 @@ namespace twitter {
186 }; 186 };
187 type _type = type::invalid; 187 type _type = type::invalid;
188 }; 188 };
189 189
190}; 190};
191 191
192#endif /* end of include guard: NOTIFICATION_H_69AEF4CC */ 192#endif /* end of include guard: NOTIFICATION_H_69AEF4CC */