From dbebbd934f34c0a9ecde805752d7924a59869478 Mon Sep 17 00:00:00 2001 From: tastytea Date: Sat, 12 May 2018 04:17:34 +0200 Subject: [PATCH] mild refactoring --- CMakeLists.txt | 2 +- src/expandurl-mastodon.hpp | 2 +- src/masto.cpp | 18 +++++++++--------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1978f1d..6e76b85 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required (VERSION 3.7) project (expandurl-mastodon - VERSION 0.1.2 + VERSION 0.1.3 LANGUAGES CXX ) diff --git a/src/expandurl-mastodon.hpp b/src/expandurl-mastodon.hpp index 30dfbf4..3a1c96d 100644 --- a/src/expandurl-mastodon.hpp +++ b/src/expandurl-mastodon.hpp @@ -75,7 +75,7 @@ public: std::vector get_new_messages(); Easy::Status get_status(const std::uint_fast64_t &id); - const bool send_reply(const Easy::Status &status, const string &message); + const bool send_reply(const Easy::Status &to_status, const string &message); const std::uint_fast64_t get_parent_id(Easy::Notification ¬if); private: diff --git a/src/masto.cpp b/src/masto.cpp index a5cc51a..e5bbe21 100644 --- a/src/masto.cpp +++ b/src/masto.cpp @@ -96,7 +96,7 @@ Mastodon::Easy::Status Listener::get_status(const std::uint_fast64_t &id) std::uint_fast16_t ret; string answer; - ret = _masto->get(Easy::v1::statuses_id, {{ "id", { std::to_string(id) }}}, + ret = _masto->get(API::v1::statuses_id, {{ "id", { std::to_string(id) }}}, answer); if (ret == 0) { @@ -109,15 +109,15 @@ Mastodon::Easy::Status Listener::get_status(const std::uint_fast64_t &id) } } -const bool Listener::send_reply(const Easy::Status &status, +const bool Listener::send_reply(const Easy::Status &to_status, const string &message) { std::uint_fast16_t ret; string answer; - const string id = std::to_string(status.id()); + const string id = std::to_string(to_status.id()); string strvisibility; - switch (status.visibility()) + switch (to_status.visibility()) { case Easy::visibility_type::Private: strvisibility = "private"; @@ -134,20 +134,20 @@ const bool Listener::send_reply(const Easy::Status &status, { { "in_reply_to_id", { id } }, { "visibility", { strvisibility } }, - { "status", { '@' + status.account().acct() + ' ' + message } } + { "status", { '@' + to_status.account().acct() + ' ' + message } } }; - if (status.sensitive()) + if (to_status.sensitive()) { parameters.insert({ "sensitive", { "true" } }); } - if (!status.spoiler_text().empty()) + if (!to_status.spoiler_text().empty()) { - parameters.insert({ "spoiler_text", { status.spoiler_text() } }); + parameters.insert({ "spoiler_text", { to_status.spoiler_text() } }); } - ret = _masto->post(Easy::v1::statuses, parameters, answer); + ret = _masto->post(API::v1::statuses, parameters, answer); if (ret == 0) {