diff --git a/CMakeLists.txt b/CMakeLists.txt index ecbe745..f3c215b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required (VERSION 3.6) project (mastodon-cpp - VERSION 0.19.0 + VERSION 0.20.0 LANGUAGES CXX ) diff --git a/src/easy/entities/instance.cpp b/src/easy/entities/instance.cpp index e847682..a8b1ad1 100644 --- a/src/easy/entities/instance.cpp +++ b/src/easy/entities/instance.cpp @@ -93,3 +93,16 @@ const string Instance::streaming_api() const { return get_string("urls.streaming_api"); } + +const uint_fast64_t Instance::max_toot_chars() const +{ + const uint_fast64_t max_chars = get_uint64("max_toot_chars"); + if (was_set()) + { + return max_chars; + } + else + { + return 500; + } +} diff --git a/src/easy/entities/instance.hpp b/src/easy/entities/instance.hpp index 5c0cb5c..131b155 100644 --- a/src/easy/entities/instance.hpp +++ b/src/easy/entities/instance.hpp @@ -20,6 +20,8 @@ #include #include +using std::uint_fast64_t; + // If we are compiling mastodon-cpp, use another include path #ifdef MASTODON_CPP #include "mastodon-cpp.hpp" @@ -118,6 +120,16 @@ namespace Mastodon * @since before 0.11.0 */ const string streaming_api() const; + + /*! + * @brief Returns the maximum chars a post can have + * + * This parameter is not supported by upstream Mastodon. If it + * is not found, 500 is returned. + * + * @since 0.20.0 + */ + const uint_fast64_t max_toot_chars() const; }; }