From 6dbddb6df254360111b5b456f7d67db9be5c0ca7 Mon Sep 17 00:00:00 2001 From: tastytea Date: Sun, 27 May 2018 12:28:20 +0200 Subject: [PATCH] Fix premature "Connected to..." message --- CMakeLists.txt | 2 +- src/masto.cpp | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4e6593f..bde7f26 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required (VERSION 3.7) project (expandurl-mastodon - VERSION 0.7.3 + VERSION 0.7.4 LANGUAGES CXX ) diff --git a/src/masto.cpp b/src/masto.cpp index f083659..de00fd4 100644 --- a/src/masto.cpp +++ b/src/masto.cpp @@ -115,9 +115,9 @@ const bool Listener::write_config() const void Listener::start() { + static std::uint_fast16_t ret = 0; _thread = std::thread([=] { - std::uint_fast16_t ret = 0; _running = true; Easy masto(_instance, _access_token); masto.set_useragent(static_cast("expandurl-mastodon/") + @@ -137,7 +137,11 @@ const void Listener::start() { std::this_thread::sleep_for(std::chrono::milliseconds(100)); } - syslog(LOG_NOTICE, "Connected to %s", _instance.c_str()); + + if (ret == 0) + { + syslog(LOG_NOTICE, "Connected to %s", _instance.c_str()); + } } const void Listener::stop()