diff --git a/src/mastoapi.cpp b/src/mastoapi.cpp index fd11959..f7ae1ed 100644 --- a/src/mastoapi.cpp +++ b/src/mastoapi.cpp @@ -27,7 +27,7 @@ namespace mastorss using std::string; using std::string_view; -MastoAPI::MastoAPI(const ProfileData &data) +MastoAPI::MastoAPI(ProfileData &data) : _profile{data} , _masto{_profile.instance, _profile.access_token} { @@ -116,5 +116,11 @@ void MastoAPI::post_item(const Item &item) throw MastodonException{ret.error_code}; } BOOST_LOG_TRIVIAL(debug) << "Posted status with GUID: " << item.guid; + + _profile.guids.push_back(item.guid); + if (_profile.guids.size() > _max_guids) + { + _profile.guids.pop_front(); + } } } // namespace mastorss diff --git a/src/mastoapi.hpp b/src/mastoapi.hpp index 6b9a041..d0cde7a 100644 --- a/src/mastoapi.hpp +++ b/src/mastoapi.hpp @@ -27,13 +27,14 @@ namespace mastorss class MastoAPI { public: - explicit MastoAPI(const ProfileData &data); + explicit MastoAPI(ProfileData &data); void post_item(const Item &item); private: - const ProfileData &_profile; + ProfileData &_profile; Mastodon::API _masto; + constexpr static size_t _max_guids{100}; }; } // namespace mastorss