Browse Source

mild refactoring

tags/0.1.3
tastytea 2 years ago
parent
commit
dbebbd934f
Signed by: tastytea GPG Key ID: 59346E0EA35C67E5
3 changed files with 11 additions and 11 deletions
  1. +1
    -1
      CMakeLists.txt
  2. +1
    -1
      src/expandurl-mastodon.hpp
  3. +9
    -9
      src/masto.cpp

+ 1
- 1
CMakeLists.txt View File

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



+ 1
- 1
src/expandurl-mastodon.hpp View File

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


+ 9
- 9
src/masto.cpp View File

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


Loading…
Cancel
Save