diff --git a/cmake/mastodon-cppConfig.cmake.in b/cmake/mastodon-cppConfig.cmake.in index c3cffe3..7d572b4 100644 --- a/cmake/mastodon-cppConfig.cmake.in +++ b/cmake/mastodon-cppConfig.cmake.in @@ -1,8 +1,7 @@ include(CMakeFindDependencyMacro) include(GNUInstallDirs) -find_depencency(jsoncpp REQUIRED CONFIG) -find_dependency(PkgConfig REQUIRED) -pkg_check_modules(curlpp REQUIRED IMPORTED_TARGET curlpp) +find_depencency(jsoncpp CONFIG REQUIRED) +find_package(Poco COMPONENTS Foundation Net NetSSL CONFIG REQUIRED) include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake") diff --git a/pkg-config/mastodon-cpp.pc.in b/pkg-config/mastodon-cpp.pc.in index 40f0ccd..9daa607 100644 --- a/pkg-config/mastodon-cpp.pc.in +++ b/pkg-config/mastodon-cpp.pc.in @@ -7,5 +7,6 @@ Name: ${name} Description: @PROJECT_DESCRIPTION@ Version: @PROJECT_VERSION@ Cflags: -I${includedir} -Libs: -L${libdir} -l${name} -lpthread -Requires: jsoncpp curlpp +Libs: -L${libdir} -l${name} -lpthread -lPocoNet +Requires: jsoncpp +Libs.private: -lPocoFoundation -lPocoNetSSL diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f602aff..a9af23e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,9 +1,7 @@ include(GNUInstallDirs) -find_package(PkgConfig REQUIRED) -pkg_check_modules(curlpp REQUIRED IMPORTED_TARGET curlpp) if(WITH_EASY) - find_package(jsoncpp REQUIRED CONFIG) + find_package(jsoncpp CONFIG REQUIRED) endif() # Some distributions do not contain Poco*Config.cmake recipes. find_package(Poco COMPONENTS Foundation Net NetSSL CONFIG) @@ -33,10 +31,7 @@ target_include_directories(${PROJECT_NAME} if(WITH_EASY) target_link_libraries(${PROJECT_NAME} - PUBLIC pthread PkgConfig::curlpp jsoncpp_lib) -else() - target_link_libraries(${PROJECT_NAME} - PUBLIC pthread PkgConfig::curlpp) + PUBLIC pthread jsoncpp_lib) endif() # If no Poco*Config.cmake recipes are found, look for headers in standard dirs. diff --git a/src/http.cpp b/src/http.cpp index 6388781..f6a150f 100644 --- a/src/http.cpp +++ b/src/http.cpp @@ -18,9 +18,6 @@ #include // std::bind #include #include -#include -#include -#include #include #include #include @@ -35,7 +32,6 @@ #include using namespace Mastodon; -namespace curlopts = curlpp::options; using std::cerr; using std::istream; using std::make_unique; @@ -54,8 +50,6 @@ API::http::http(const API &api, const string &instance, , _access_token(access_token) , _cancel_stream(false) { - curlpp::initialize(); - Poco::Net::initializeSSL(); // FIXME: rewrite set_proxy() that it calls set_proxy() here. @@ -98,8 +92,6 @@ API::http::http(const API &api, const string &instance, API::http::~http() { - curlpp::terminate(); - Poco::Net::uninitializeSSL(); } diff --git a/src/mastodon-cpp.cpp b/src/mastodon-cpp.cpp index 0d66b86..cca5d95 100644 --- a/src/mastodon-cpp.cpp +++ b/src/mastodon-cpp.cpp @@ -21,6 +21,7 @@ #include #include #include +#include #include "version.hpp" #include "debug.hpp" #include "mastodon-cpp.hpp" @@ -333,11 +334,16 @@ const parameters API::delete_params(const parameters ¶ms, const string Mastodon::urlencode(const std::string &str) { - return curlpp::escape(str); + string out; + Poco::URI::encode(str, "", out); + return out; } + const string Mastodon::urldecode(const std::string &str) { - return curlpp::unescape(str); + string out; + Poco::URI::decode(str, out); + return out; } const string Mastodon::unescape_html(const string &html) diff --git a/src/mastodon-cpp.hpp b/src/mastodon-cpp.hpp index 9ef785c..7f30d43 100644 --- a/src/mastodon-cpp.hpp +++ b/src/mastodon-cpp.hpp @@ -25,8 +25,6 @@ #include #include #include -#include -#include #include #include "return_types.hpp" @@ -686,13 +684,12 @@ namespace Mastodon }; /*! - * @brief Percent-encodes a string. This is done automatically, unless - * you make a custom request. + * @brief Percent-encodes a string. * - * Calls curlpp::escape(str). * - * The only time you should use this, is if you use - * get(const string &call, string &answer). + * This is done automatically where necessary. The only time you + * should use this, is if you use get(const string &call, string + * &answer). * * See RFC 3986 section 2.1 for more info. * @@ -707,8 +704,6 @@ namespace Mastodon /*! * @brief Decodes a percent-encoded string. * - * Calls curlpp::unescape(str). - * * See RFC 3986 section 2.1 for more info. * * @param str The string to decode.