diff --git a/CMakeLists.txt b/CMakeLists.txt index 288d80c..55ed2ee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required (VERSION 3.7) project (mastobotmon - VERSION 0.3.9 + VERSION 0.3.10 LANGUAGES CXX) include(GNUInstallDirs) diff --git a/README.md b/README.md index 6680100..b824076 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ * Tested OS: Linux * C++ compiler (tested: gcc 6.4, clang 5.0) * [cmake](https://cmake.org/) (tested: 3.9.6) - * [mastodon-cpp](https://github.com/tastytea/mastodon-cpp) (at least: 0.8.6) + * [mastodon-cpp](https://github.com/tastytea/mastodon-cpp) (at least: 0.10.1) * [jsoncpp](https://github.com/open-source-parsers/jsoncpp) (tested: 1.8.1) ## Get sourcecode diff --git a/src/mastobotmon.cpp b/src/mastobotmon.cpp index 7aa3ce2..17ee4c2 100644 --- a/src/mastobotmon.cpp +++ b/src/mastobotmon.cpp @@ -156,7 +156,8 @@ int main(int argc, char *argv[]) std::stoi(acc->get_header("X-RateLimit-Remaining")) < 2) { cerr << "ERROR: Reached limit of API calls.\n"; - cerr << "Counter will reset at " << acc->get_header("X-RateLimit-Reset") << '\n'; + cerr << "Counter will reset at " << acc->get_header("X-RateLimit-Reset") + << '\n'; return 2; } Easy::Account account_entity(answer); @@ -166,15 +167,15 @@ int main(int argc, char *argv[]) Account::parametermap parameters( { + { "id", { id } }, { "limit", { "1" } } }); - ret = acc->get(Mastodon::API::v1::accounts_id_statuses, id, parameters, answer); + ret = acc->get(Mastodon::API::v1::accounts_id_statuses, parameters, answer); if (ret == 0) { - account_entity.from_string(answer); - const string acct = account_entity.acct(); + const Easy::Status status(answer); const auto now = std::chrono::system_clock::now(); - const auto last = account_entity.created_at(); + const auto last = status.created_at(); auto elapsed = std::chrono::duration_cast(now - last); if (elapsed.count() > acc->get_minutes()) @@ -192,7 +193,7 @@ int main(int argc, char *argv[]) minutes -= 60; hours += 1; } - cout << "ALERT: " << acct << " is inactive since "; + cout << "ALERT: " << account_entity.acct() << " is inactive since "; if (days > 0) { cout << std::to_string(days) << " days, ";