Record each posted guid.
continuous-integration/drone/push Build is failing Details

This commit is contained in:
tastytea 2020-01-01 12:43:42 +01:00
parent f3b22e8206
commit 4d35ee1d66
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
2 changed files with 10 additions and 3 deletions

View File

@ -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

View File

@ -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