summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorDeepBlueV7.X <nicolas.werner@hotmail.de>2021-06-30 20:22:06 +0000
committerGitHub <noreply@github.com>2021-06-30 20:22:06 +0000
commit25461b20eb735316eaff5ce01b2a40812d025022 (patch)
tree7548d4ef8d4b1c4573a128aa4c429b3aba65ac57 /src
parentFix tags going missing if you join communities (diff)
parentInstall libevent dev dependency for appimage (diff)
downloadnheko-25461b20eb735316eaff5ce01b2a40812d025022.tar.xz
Merge pull request #626 from Nheko-Reborn/curl
Use coeurl for networking
Diffstat (limited to 'src')
-rw-r--r--src/ChatPage.cpp6
-rw-r--r--src/LoginPage.cpp13
-rw-r--r--src/Olm.h2
-rw-r--r--src/RegisterPage.cpp17
-rw-r--r--src/main.cpp39
-rw-r--r--src/timeline/InputBar.cpp2
-rw-r--r--src/ui/RoomSettings.cpp2
7 files changed, 53 insertions, 28 deletions
diff --git a/src/ChatPage.cpp b/src/ChatPage.cpp

index 0f16f205..6003eb85 100644 --- a/src/ChatPage.cpp +++ b/src/ChatPage.cpp
@@ -550,7 +550,7 @@ ChatPage::startInitialSync() nhlog::net()->error("initial sync error: {} {} {} {}", err->parse_error, status_code, - err->error_code.message(), + err->error_code, err_code); // non http related errors @@ -674,10 +674,10 @@ ChatPage::trySync() return; } - nhlog::net()->error("initial sync error: {} {} {} {}", + nhlog::net()->error("sync error: {} {} {} {}", err->parse_error, status_code, - err->error_code.message(), + err->error_code, err_code); emit tryDelayedSyncCb(); return; diff --git a/src/LoginPage.cpp b/src/LoginPage.cpp
index c914d66f..f53d81ba 100644 --- a/src/LoginPage.cpp +++ b/src/LoginPage.cpp
@@ -263,9 +263,7 @@ LoginPage::onMatrixIdEntered() http::client()->well_known([this](const mtx::responses::WellKnown &res, mtx::http::RequestErr err) { if (err) { - using namespace boost::beast::http; - - if (err->status_code == status::not_found) { + if (err->status_code == 404) { nhlog::net()->info("Autodiscovery: No .well-known."); checkHomeserverVersion(); return; @@ -282,8 +280,9 @@ LoginPage::onMatrixIdEntered() emit versionErrorCb(tr("Autodiscovery failed. Unknown error when " "requesting .well-known.")); nhlog::net()->error("Autodiscovery failed. Unknown error when " - "requesting .well-known. {}", - err->error_code.message()); + "requesting .well-known. {} {}", + err->status_code, + err->error_code); return; } @@ -301,9 +300,7 @@ LoginPage::checkHomeserverVersion() http::client()->versions( [this](const mtx::responses::Versions &, mtx::http::RequestErr err) { if (err) { - using namespace boost::beast::http; - - if (err->status_code == status::not_found) { + if (err->status_code == 404) { emit versionErrorCb(tr("The required endpoints were not found. " "Possibly not a Matrix server.")); return; diff --git a/src/Olm.h b/src/Olm.h
index d356cb55..8479f4f2 100644 --- a/src/Olm.h +++ b/src/Olm.h
@@ -4,8 +4,6 @@ #pragma once -#include <boost/optional.hpp> - #include <memory> #include <mtx/events.hpp> #include <mtx/events/encrypted.hpp> diff --git a/src/RegisterPage.cpp b/src/RegisterPage.cpp
index 36fd71a8..1588d07d 100644 --- a/src/RegisterPage.cpp +++ b/src/RegisterPage.cpp
@@ -289,7 +289,7 @@ RegisterPage::RegisterPage(QWidget *parent) } // The server requires registration flows. - if (err->status_code == boost::beast::http::status::unauthorized) { + if (err->status_code == 401) { if (err->matrix_error.unauthorized.flows.empty()) { nhlog::net()->warn( "failed to retrieve registration flows: ({}) " @@ -431,9 +431,7 @@ RegisterPage::onRegisterButtonClicked() [this, username, password](const mtx::responses::WellKnown &res, mtx::http::RequestErr err) { if (err) { - using namespace boost::beast::http; - - if (err->status_code == status::not_found) { + if (err->status_code == 404) { nhlog::net()->info("Autodiscovery: No .well-known."); checkVersionAndRegister(username, password); return; @@ -450,8 +448,9 @@ RegisterPage::onRegisterButtonClicked() emit versionErrorCb(tr("Autodiscovery failed. Unknown error when " "requesting .well-known.")); nhlog::net()->error("Autodiscovery failed. Unknown error when " - "requesting .well-known. {}", - err->error_code.message()); + "requesting .well-known. {} {}", + err->status_code, + err->error_code); return; } @@ -471,9 +470,7 @@ RegisterPage::checkVersionAndRegister(const std::string &username, const std::st http::client()->versions( [this, username, password](const mtx::responses::Versions &, mtx::http::RequestErr err) { if (err) { - using namespace boost::beast::http; - - if (err->status_code == status::not_found) { + if (err->status_code == 404) { emit versionErrorCb(tr("The required endpoints were not found. " "Possibly not a Matrix server.")); return; @@ -504,7 +501,7 @@ RegisterPage::checkVersionAndRegister(const std::string &username, const std::st } // The server requires registration flows. - if (err->status_code == boost::beast::http::status::unauthorized) { + if (err->status_code == 401) { if (err->matrix_error.unauthorized.flows.empty()) { nhlog::net()->warn( "failed to retrieve registration flows1: ({}) " diff --git a/src/main.cpp b/src/main.cpp
index fe1a9ee3..29e93d49 100644 --- a/src/main.cpp +++ b/src/main.cpp
@@ -40,15 +40,48 @@ QQmlDebuggingEnabler enabler; #endif -#if defined(Q_OS_LINUX) -#include <boost/stacktrace.hpp> +#if HAVE_BACKTRACE_SYMBOLS_FD #include <csignal> +#include <execinfo.h> +#include <fcntl.h> +#include <unistd.h> void stacktraceHandler(int signum) { std::signal(signum, SIG_DFL); - boost::stacktrace::safe_dump_to("./nheko-backtrace.dump"); + + // boost::stacktrace::safe_dump_to("./nheko-backtrace.dump"); + + // see + // https://stackoverflow.com/questions/77005/how-to-automatically-generate-a-stacktrace-when-my-program-crashes/77336#77336 + void *array[50]; + size_t size; + + // get void*'s for all entries on the stack + size = backtrace(array, 50); + + // print out all the frames to stderr + fprintf(stderr, "Error: signal %d:\n", signum); + backtrace_symbols_fd(array, size, STDERR_FILENO); + + int file = ::open("/tmp/nheko-crash.dump", + O_CREAT | O_WRONLY | O_TRUNC +#if defined(S_IWUSR) && defined(S_IRUSR) + , + S_IWUSR | S_IRUSR +#elif defined(S_IWRITE) && defined(S_IREAD) + , + S_IWRITE | S_IREAD +#endif + ); + if (file != -1) { + constexpr char header[] = "Error: signal\n"; + [[maybe_unused]] auto ret = write(file, header, std::size(header) - 1); + backtrace_symbols_fd(array, size, file); + close(file); + } + std::raise(SIGABRT); } diff --git a/src/timeline/InputBar.cpp b/src/timeline/InputBar.cpp
index c309daab..b0747a7c 100644 --- a/src/timeline/InputBar.cpp +++ b/src/timeline/InputBar.cpp
@@ -296,7 +296,7 @@ InputBar::message(QString msg, MarkdownOverride useMarkdown, bool rainbowify) firstLine = false; body = QString("> <%1> %2\n").arg(related.quoted_user).arg(line); } else { - body = QString("%1\n> %2\n").arg(body).arg(line); + body += QString("> %1\n").arg(line); } } diff --git a/src/ui/RoomSettings.cpp b/src/ui/RoomSettings.cpp
index 0bc8759e..f78ef09b 100644 --- a/src/ui/RoomSettings.cpp +++ b/src/ui/RoomSettings.cpp
@@ -181,7 +181,7 @@ RoomSettings::RoomSettings(QString roomid, QObject *parent) roomid_.toStdString(), [this](const mtx::pushrules::PushRule &rule, mtx::http::RequestErr &err) { if (err) { - if (err->status_code == boost::beast::http::status::not_found) + if (err->status_code == 404) http::client()->get_pushrules( "global", "room",