Added Instance::max_toot_chars()

This commit is contained in:
tastytea 2018-12-04 09:42:26 +01:00
parent 1875284670
commit 1f5e356b2a
Signed by: tastytea
GPG Key ID: CFC39497F1B26E07
3 changed files with 26 additions and 1 deletions

View File

@ -1,6 +1,6 @@
cmake_minimum_required (VERSION 3.6) cmake_minimum_required (VERSION 3.6)
project (mastodon-cpp project (mastodon-cpp
VERSION 0.19.0 VERSION 0.20.0
LANGUAGES CXX LANGUAGES CXX
) )

View File

@ -93,3 +93,16 @@ const string Instance::streaming_api() const
{ {
return get_string("urls.streaming_api"); 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;
}
}

View File

@ -20,6 +20,8 @@
#include <string> #include <string>
#include <vector> #include <vector>
using std::uint_fast64_t;
// If we are compiling mastodon-cpp, use another include path // If we are compiling mastodon-cpp, use another include path
#ifdef MASTODON_CPP #ifdef MASTODON_CPP
#include "mastodon-cpp.hpp" #include "mastodon-cpp.hpp"
@ -118,6 +120,16 @@ namespace Mastodon
* @since before 0.11.0 * @since before 0.11.0
*/ */
const string streaming_api() const; 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;
}; };
} }