diff options
author | ouwou <26526779+ouwou@users.noreply.github.com> | 2021-11-25 02:57:11 -0500 |
---|---|---|
committer | ouwou <26526779+ouwou@users.noreply.github.com> | 2021-11-25 02:57:11 -0500 |
commit | 8c72d4c18d9c27ce1b5cd20f0cb98e5638c8becf (patch) | |
tree | 244f645e36250e103c54462091855aa78e8e3c20 | |
parent | 0da913cd4a76aae1ca41abe5b1a51874c974d3aa (diff) | |
download | abaddon-portaudio-8c72d4c18d9c27ce1b5cd20f0cb98e5638c8becf.tar.gz abaddon-portaudio-8c72d4c18d9c27ce1b5cd20f0cb98e5638c8becf.zip |
dont print identify message to console
mainly since i feel its only a matter of time before someone copy pastes it somewhere and itd be my fault
also typedef -> using
-rw-r--r-- | src/discord/discord.cpp | 3 | ||||
-rw-r--r-- | src/discord/websocket.cpp | 11 | ||||
-rw-r--r-- | src/discord/websocket.hpp | 11 |
3 files changed, 21 insertions, 4 deletions
diff --git a/src/discord/discord.cpp b/src/discord/discord.cpp index 801282c..83db97b 100644 --- a/src/discord/discord.cpp +++ b/src/discord/discord.cpp @@ -2012,7 +2012,10 @@ void DiscordClient::SendIdentify() { msg.ClientState.HighestLastMessageID = "0"; msg.ClientState.ReadStateVersion = 0; msg.ClientState.UserGuildSettingsVersion = -1; + const bool b = m_websocket.GetPrintMessages(); + m_websocket.SetPrintMessages(false); m_websocket.Send(msg); + m_websocket.SetPrintMessages(b); } void DiscordClient::SendResume() { diff --git a/src/discord/websocket.cpp b/src/discord/websocket.cpp index ff50cd3..c7e43e9 100644 --- a/src/discord/websocket.cpp +++ b/src/discord/websocket.cpp @@ -15,6 +15,14 @@ void Websocket::SetUserAgent(std::string agent) { m_agent = agent; } +bool Websocket::GetPrintMessages() const noexcept { + return m_print_messages; +} + +void Websocket::SetPrintMessages(bool show) noexcept { + m_print_messages = show; +} + void Websocket::Stop() { Stop(ix::WebSocketCloseConstants::kNormalClosureCode); } @@ -29,7 +37,8 @@ bool Websocket::IsOpen() const { } void Websocket::Send(const std::string &str) { - printf("sending %s\n", str.c_str()); + if (m_print_messages) + printf("sending %s\n", str.c_str()); m_websocket.sendText(str); } diff --git a/src/discord/websocket.hpp b/src/discord/websocket.hpp index e6a6489..26cd5d4 100644 --- a/src/discord/websocket.hpp +++ b/src/discord/websocket.hpp @@ -13,6 +13,9 @@ public: void SetUserAgent(std::string agent); + bool GetPrintMessages() const noexcept; + void SetPrintMessages(bool show) noexcept; + void Send(const std::string &str); void Send(const nlohmann::json &j); void Stop(); @@ -26,9 +29,9 @@ private: std::string m_agent; public: - typedef sigc::signal<void> type_signal_open; - typedef sigc::signal<void, uint16_t> type_signal_close; - typedef sigc::signal<void, std::string> type_signal_message; + using type_signal_open = sigc::signal<void>; + using type_signal_close = sigc::signal<void, uint16_t>; + using type_signal_message = sigc::signal<void, std::string>; type_signal_open signal_open(); type_signal_close signal_close(); @@ -38,4 +41,6 @@ private: type_signal_open m_signal_open; type_signal_close m_signal_close; type_signal_message m_signal_message; + + bool m_print_messages = true; }; |