mild refactoring

这个提交包含在:
tastytea 2018-05-12 04:17:34 +02:00
父节点 5ebaf7678c
当前提交 dbebbd934f
签署人:: tastytea
GPG 密钥 ID: 59346E0EA35C67E5
共有 3 个文件被更改,包括 11 次插入11 次删除

查看文件

@ -1,6 +1,6 @@
cmake_minimum_required (VERSION 3.7)
project (expandurl-mastodon
VERSION 0.1.2
VERSION 0.1.3
LANGUAGES CXX
)

查看文件

@ -75,7 +75,7 @@ public:
std::vector<Easy::Notification> 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 &notif);
private:

查看文件

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