This commit is contained in:
parent
f3b22e8206
commit
4d35ee1d66
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user