indent files
This commit is contained in:
@ -126,32 +126,36 @@ namespace
|
||||
std::string filter;
|
||||
std::string position("$");
|
||||
|
||||
_conn.subscribe(
|
||||
channel, filter, position, [this](const Json::Value& msg, const std::string& /*position*/) {
|
||||
spdlog::info("receive {}", msg.toStyledString());
|
||||
_conn.subscribe(channel,
|
||||
filter,
|
||||
position,
|
||||
[this](const Json::Value& msg, const std::string& /*position*/) {
|
||||
spdlog::info("receive {}", msg.toStyledString());
|
||||
|
||||
if (!msg.isObject()) return;
|
||||
if (!msg.isMember("user")) return;
|
||||
if (!msg.isMember("text")) return;
|
||||
if (!msg.isMember("session")) return;
|
||||
if (!msg.isObject()) return;
|
||||
if (!msg.isMember("user")) return;
|
||||
if (!msg.isMember("text")) return;
|
||||
if (!msg.isMember("session")) return;
|
||||
|
||||
std::string msg_user = msg["user"].asString();
|
||||
std::string msg_text = msg["text"].asString();
|
||||
std::string msg_session = msg["session"].asString();
|
||||
std::string msg_user = msg["user"].asString();
|
||||
std::string msg_text = msg["text"].asString();
|
||||
std::string msg_session = msg["session"].asString();
|
||||
|
||||
// We are not interested in messages
|
||||
// from a different session.
|
||||
if (msg_session != _session) return;
|
||||
// We are not interested in messages
|
||||
// from a different session.
|
||||
if (msg_session != _session) return;
|
||||
|
||||
// We are not interested in our own messages
|
||||
if (msg_user == _user) return;
|
||||
// We are not interested in our own messages
|
||||
if (msg_user == _user) return;
|
||||
|
||||
_receivedQueue.push(msg);
|
||||
_receivedQueue.push(msg);
|
||||
|
||||
std::stringstream ss;
|
||||
ss << std::endl << msg_user << " > " << msg_text << std::endl << _user << " > ";
|
||||
log(ss.str());
|
||||
});
|
||||
std::stringstream ss;
|
||||
ss << std::endl
|
||||
<< msg_user << " > " << msg_text << std::endl
|
||||
<< _user << " > ";
|
||||
log(ss.str());
|
||||
});
|
||||
}
|
||||
|
||||
void CobraChat::sendMessage(const std::string& text)
|
||||
|
@ -77,18 +77,20 @@ namespace
|
||||
std::string filter;
|
||||
std::string position("$");
|
||||
|
||||
conn.subscribe(
|
||||
channel, filter, position, [](const Json::Value& msg, const std::string& /*position*/) {
|
||||
log(msg.toStyledString());
|
||||
conn.subscribe(channel,
|
||||
filter,
|
||||
position,
|
||||
[](const Json::Value& msg, const std::string& /*position*/) {
|
||||
log(msg.toStyledString());
|
||||
|
||||
std::string id = msg["id"].asString();
|
||||
{
|
||||
std::lock_guard<std::mutex> guard(gProtectIds);
|
||||
gIds.insert(id);
|
||||
}
|
||||
std::string id = msg["id"].asString();
|
||||
{
|
||||
std::lock_guard<std::mutex> guard(gProtectIds);
|
||||
gIds.insert(id);
|
||||
}
|
||||
|
||||
gMessageCount++;
|
||||
});
|
||||
gMessageCount++;
|
||||
});
|
||||
}
|
||||
else if (eventType == ix::CobraConnection_EventType_Subscribed)
|
||||
{
|
||||
|
@ -150,10 +150,7 @@ TEST_CASE("Cobra_to_sentry_bot", "[cobra_bots]")
|
||||
// -> https://github.com/openssl/openssl/issues/7967
|
||||
// https://xxxxx:yyyyyy@sentry.io/1234567
|
||||
std::stringstream oss;
|
||||
oss << getHttpScheme()
|
||||
<< "xxxxxxx:yyyyyyy@localhost:"
|
||||
<< sentryPort
|
||||
<< "/1234567";
|
||||
oss << getHttpScheme() << "xxxxxxx:yyyyyyy@localhost:" << sentryPort << "/1234567";
|
||||
std::string dsn = oss.str();
|
||||
|
||||
SocketTLSOptions tlsOptionsClient = makeClientTLSOptions();
|
||||
|
@ -148,7 +148,7 @@ namespace ix
|
||||
auto vec = load(path);
|
||||
return std::string(vec.begin(), vec.end());
|
||||
}
|
||||
|
||||
|
||||
SocketTLSOptions makeClientTLSOptions()
|
||||
{
|
||||
SocketTLSOptions tlsOptionsClient;
|
||||
@ -237,9 +237,7 @@ namespace ix
|
||||
std::string makeCobraEndpoint(int port, bool preferTLS)
|
||||
{
|
||||
std::stringstream ss;
|
||||
ss << getWsScheme(preferTLS)
|
||||
<< "localhost:"
|
||||
<< port;
|
||||
ss << getWsScheme(preferTLS) << "localhost:" << port;
|
||||
std::string endpoint = ss.str();
|
||||
|
||||
return endpoint;
|
||||
|
@ -9,8 +9,8 @@
|
||||
#include "IXGetFreePort.h"
|
||||
#include <iostream>
|
||||
#include <ixsnake/IXAppConfig.h>
|
||||
#include <ixwebsocket/IXWebSocketServer.h>
|
||||
#include <ixwebsocket/IXSocketTLSOptions.h>
|
||||
#include <ixwebsocket/IXWebSocketServer.h>
|
||||
#include <mutex>
|
||||
#include <spdlog/spdlog.h>
|
||||
#include <sstream>
|
||||
|
Reference in New Issue
Block a user