diff --git a/.drone.yml b/.drone.yml index af3fd0b..f59c66e 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,7 +1,7 @@ pipeline: download: image: plugins/download - source: https://schlomp.space/attachments/b3119713-4c05-4acc-9cb4-460b15e19279 + source: https://schlomp.space/attachments/dbc2b2b0-86c9-4aee-ac99-9cb9e91a82ed destination: mastodon-cpp.deb build: image: debian:buster-slim diff --git a/CMakeLists.txt b/CMakeLists.txt index a362105..a9e3150 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required (VERSION 3.7) project (expandurl-mastodon - VERSION 0.9.8 + VERSION 0.9.9 LANGUAGES CXX ) diff --git a/README.md b/README.md index 423e144..0a1b687 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ or to [@tastytea@soc.ialis.me](https://soc.ialis.me/@tastytea). * C++ compiler (tested: gcc 6.4 / 7.3) * [cmake](https://cmake.org/) (tested: 3.9) * [curlpp](http://www.curlpp.org/) (tested: 0.8 / 0.7) - * [mastodon-cpp](https://schlomp.space/tastytea/mastodon-cpp) (at least: 0.15.1) + * [mastodon-cpp](https://schlomp.space/tastytea/mastodon-cpp) (at least: 0.17) * [jsoncpp](https://github.com/open-source-parsers/jsoncpp) (tested: 1.8 / 1.7) * [libxdg-basedir](http://repo.or.cz/w/libxdg-basedir.git) (tested: 1.2) diff --git a/src/masto.cpp b/src/masto.cpp index 3f3e290..7291d29 100644 --- a/src/masto.cpp +++ b/src/masto.cpp @@ -230,42 +230,23 @@ Mastodon::Easy::Status Listener::get_status(const std::uint_fast64_t &id) 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(to_status.id()); - string strvisibility; + std::uint_fast16_t ret = 0; - switch (to_status.visibility()) + Easy::Status new_status; + if (to_status.visibility() == Easy::visibility_type::Public) { - case Easy::visibility_type::Private: - strvisibility = "private"; - break; - case Easy::visibility_type::Direct: - strvisibility = "direct"; - break; - default: - strvisibility = "unlisted"; - break; + new_status.visibility(Easy::visibility_type::Unlisted); } - - Easy::parametermap parameters = + else { - { "in_reply_to_id", { id } }, - { "visibility", { strvisibility } }, - { "status", { '@' + to_status.account().acct() + ' ' + message } } - }; - - if (to_status.sensitive()) - { - parameters.insert({ "sensitive", { "true" } }); + new_status.visibility(to_status.visibility()); } + new_status.in_reply_to_id(to_status.id()); + new_status.content('@' + to_status.account().acct() + ' ' + message); + new_status.sensitive(to_status.sensitive()); + new_status.spoiler_text(to_status.spoiler_text()); - if (!to_status.spoiler_text().empty()) - { - parameters.insert({ "spoiler_text", { to_status.spoiler_text() } }); - } - - ret = _masto->post(API::v1::statuses, parameters, answer); + _masto->send_toot(new_status, ret); if (ret == 0) {