Updated to mastodon-cpp 0.30.0
the build failed Details

This commit is contained in:
tastytea 2019-01-27 04:51:03 +01:00
parent cade0f8a4a
commit 0f471e860f
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
6 changed files with 18 additions and 16 deletions

View File

@ -2,7 +2,7 @@ pipeline:
download:
image: plugins/download
pull: true
source: https://schlomp.space/attachments/761761c0-b16b-491e-a6ae-18dca23e82dd
source: https://schlomp.space/attachments/5ab8f994-669a-47f8-8ac7-ed5902ad0339
destination: mastodon-cpp.deb
# gcc5:
# image: gcc:5

View File

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

View File

@ -25,7 +25,7 @@ or to [@tastytea@soc.ialis.me](https://soc.ialis.me/@tastytea).
* C++ compiler (tested: gcc 6/7/8)
* [cmake](https://cmake.org/) (tested: 3.9 / 3.11)
* [curlpp](http://www.curlpp.org/) (tested: 0.8 / 0.7)
* [mastodon-cpp](https://schlomp.space/tastytea/mastodon-cpp) (at least: 0.18)
* [mastodon-cpp](https://schlomp.space/tastytea/mastodon-cpp) (at least: 0.30)
* [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)

View File

@ -90,9 +90,9 @@ public:
const std::vector<Easy::Notification> get_new_messages();
const std::vector<Easy::Notification> catchup();
Easy::Status get_status(const std::uint_fast64_t &id);
Easy::Status get_status(const string &id);
const bool send_reply(const Easy::Status &to_status, const string &message);
const std::uint_fast64_t get_parent_id(const Easy::Notification &notif);
const string get_parent_id(const Easy::Notification &notif);
const bool stillrunning() const;

View File

@ -57,7 +57,8 @@ int main(int argc, char *argv[])
if (!configfile.read())
{
syslog(LOG_WARNING, "Could not open %s.", configfile.get_filepath().c_str());
syslog(LOG_WARNING, "Could not open %s.",
configfile.get_filepath().c_str());
}
init_replacements();
@ -89,11 +90,11 @@ int main(int argc, char *argv[])
for (Easy::Notification &notif : new_messages)
{
syslog(LOG_DEBUG, "new message");
const std::uint_fast64_t id = listener.get_parent_id(notif);
syslog(LOG_DEBUG, "in_reply_to_id: %lu", id);
const string id = listener.get_parent_id(notif);
syslog(LOG_DEBUG, "in_reply_to_id: %s", id.c_str());
Easy::Status status;
if (id > 0)
if (!id.empty())
{
status = listener.get_status(id);
if (status.valid())
@ -107,7 +108,8 @@ int main(int argc, char *argv[])
{
if (!listener.send_reply(notif.status(), message))
{
syslog(LOG_ERR, "could not send reply to %lu", id);
syslog(LOG_ERR, "could not send reply to %s",
id.c_str());
}
}
else

View File

@ -209,12 +209,12 @@ const std::vector<Easy::Notification> Listener::catchup()
return v;
}
Mastodon::Easy::Status Listener::get_status(const std::uint_fast64_t &id)
Mastodon::Easy::Status Listener::get_status(const string &id)
{
std::uint_fast16_t ret;
string answer;
ret = _masto->get(API::v1::statuses_id, {{ "id", { std::to_string(id) }}},
ret = _masto->get(API::v1::statuses_id, {{ "id", { id }}},
answer);
if (ret == 0)
{
@ -260,7 +260,7 @@ const bool Listener::send_reply(const Easy::Status &to_status,
}
}
const std::uint_fast64_t Listener::get_parent_id(const Easy::Notification &notif)
const string Listener::get_parent_id(const Easy::Notification &notif)
{
string answer;
std::uint_fast16_t ret;
@ -279,7 +279,7 @@ const std::uint_fast64_t Listener::get_parent_id(const Easy::Notification &notif
}
ret = _masto->get(API::v1::statuses_id,
{{ "id", { std::to_string(notif.status().id()) }}},
{{ "id", { notif.status().id() }}},
answer);
if (ret > 0)
@ -290,11 +290,11 @@ const std::uint_fast64_t Listener::get_parent_id(const Easy::Notification &notif
}
else
{
_config["last_id"] = std::to_string(notif.id());
_config["last_id"] = notif.id();
const Easy::Status s(answer);
// If parent is found, return ID; else retry
if (s.in_reply_to_id() != 0)
if (!s.in_reply_to_id().empty())
{
return s.in_reply_to_id();
}