bugfix: name of inactive account was not printed

This commit is contained in:
tastytea 2018-04-22 13:12:20 +02:00
parent f1b94d3d84
commit 869902b4bd
Signed by: tastytea
GPG Key ID: 59346E0EA35C67E5
3 changed files with 9 additions and 8 deletions

View File

@ -1,6 +1,6 @@
cmake_minimum_required (VERSION 3.7)
project (mastobotmon
VERSION 0.3.9
VERSION 0.3.10
LANGUAGES CXX)
include(GNUInstallDirs)

View File

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

View File

@ -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<std::chrono::minutes>(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, ";