From 49685c39895af67d7ffcc50fdc02150b6ee44f72 Mon Sep 17 00:00:00 2001 From: ouwou <26526779+ouwou@users.noreply.github.com> Date: Tue, 5 Apr 2022 22:01:53 -0400 Subject: fix up a bunch of clang-tidy stuff mostly changing references, which i hope doesnt break stuff with models (TreeRow, iterators) since they gave me some strange problems in the past --- src/discord/websocket.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'src/discord/websocket.cpp') diff --git a/src/discord/websocket.cpp b/src/discord/websocket.cpp index c7e43e9..46a4b90 100644 --- a/src/discord/websocket.cpp +++ b/src/discord/websocket.cpp @@ -1,18 +1,18 @@ #include "websocket.hpp" -#include +#include -Websocket::Websocket() {} +Websocket::Websocket() = default; -void Websocket::StartConnection(std::string url) { +void Websocket::StartConnection(const std::string &url) { m_websocket.disableAutomaticReconnection(); m_websocket.setUrl(url); - m_websocket.setOnMessageCallback(std::bind(&Websocket::OnMessage, this, std::placeholders::_1)); + m_websocket.setOnMessageCallback([this](auto &&msg) { OnMessage(std::forward(msg)); }); m_websocket.setExtraHeaders(ix::WebSocketHttpHeaders { { "User-Agent", m_agent } }); // idk if this actually works m_websocket.start(); } void Websocket::SetUserAgent(std::string agent) { - m_agent = agent; + m_agent = std::move(agent); } bool Websocket::GetPrintMessages() const noexcept { @@ -31,11 +31,6 @@ void Websocket::Stop(uint16_t code) { m_websocket.stop(code); } -bool Websocket::IsOpen() const { - auto state = m_websocket.getReadyState(); - return state == ix::ReadyState::Open; -} - void Websocket::Send(const std::string &str) { if (m_print_messages) printf("sending %s\n", str.c_str()); -- cgit v1.2.3