Rewrote send_reply(), upped mastodon-cpp dependency to version 0.17.0
Some checks failed
the build failed
Some checks failed
the build failed
This commit is contained in:
parent
0b218fd472
commit
c4b4522dc7
|
@ -1,7 +1,7 @@
|
||||||
pipeline:
|
pipeline:
|
||||||
download:
|
download:
|
||||||
image: plugins/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
|
destination: mastodon-cpp.deb
|
||||||
build:
|
build:
|
||||||
image: debian:buster-slim
|
image: debian:buster-slim
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
cmake_minimum_required (VERSION 3.7)
|
cmake_minimum_required (VERSION 3.7)
|
||||||
project (expandurl-mastodon
|
project (expandurl-mastodon
|
||||||
VERSION 0.9.8
|
VERSION 0.9.9
|
||||||
LANGUAGES CXX
|
LANGUAGES CXX
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ or to [@tastytea@soc.ialis.me](https://soc.ialis.me/@tastytea).
|
||||||
* C++ compiler (tested: gcc 6.4 / 7.3)
|
* C++ compiler (tested: gcc 6.4 / 7.3)
|
||||||
* [cmake](https://cmake.org/) (tested: 3.9)
|
* [cmake](https://cmake.org/) (tested: 3.9)
|
||||||
* [curlpp](http://www.curlpp.org/) (tested: 0.8 / 0.7)
|
* [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)
|
* [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)
|
* [libxdg-basedir](http://repo.or.cz/w/libxdg-basedir.git) (tested: 1.2)
|
||||||
|
|
||||||
|
|
|
@ -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 bool Listener::send_reply(const Easy::Status &to_status,
|
||||||
const string &message)
|
const string &message)
|
||||||
{
|
{
|
||||||
std::uint_fast16_t ret;
|
std::uint_fast16_t ret = 0;
|
||||||
string answer;
|
|
||||||
const string id = std::to_string(to_status.id());
|
|
||||||
string strvisibility;
|
|
||||||
|
|
||||||
switch (to_status.visibility())
|
Easy::Status new_status;
|
||||||
|
if (to_status.visibility() == Easy::visibility_type::Public)
|
||||||
{
|
{
|
||||||
case Easy::visibility_type::Private:
|
new_status.visibility(Easy::visibility_type::Unlisted);
|
||||||
strvisibility = "private";
|
|
||||||
break;
|
|
||||||
case Easy::visibility_type::Direct:
|
|
||||||
strvisibility = "direct";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
strvisibility = "unlisted";
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
Easy::parametermap parameters =
|
|
||||||
{
|
{
|
||||||
{ "in_reply_to_id", { id } },
|
new_status.visibility(to_status.visibility());
|
||||||
{ "visibility", { strvisibility } },
|
|
||||||
{ "status", { '@' + to_status.account().acct() + ' ' + message } }
|
|
||||||
};
|
|
||||||
|
|
||||||
if (to_status.sensitive())
|
|
||||||
{
|
|
||||||
parameters.insert({ "sensitive", { "true" } });
|
|
||||||
}
|
}
|
||||||
|
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())
|
_masto->send_toot(new_status, ret);
|
||||||
{
|
|
||||||
parameters.insert({ "spoiler_text", { to_status.spoiler_text() } });
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = _masto->post(API::v1::statuses, parameters, answer);
|
|
||||||
|
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user