Logging of the messages, customizable replies, assigning groups

This commit is contained in:
Blue 2025-03-15 22:34:50 +02:00
parent f03f392cee
commit 7f57cd3bf6
Signed by: blue
GPG key ID: 9B203B252A63EE38
21 changed files with 288 additions and 62 deletions

View file

@ -13,7 +13,7 @@ Connection::~Connection() noexcept {
deinitialize();
}
void Connection::initiialize() {
void Connection::initialize() {
if (state != initial)
return;
@ -65,9 +65,16 @@ void Connection::send(const std::string& jid, const std::string& body) {
}
void Connection::handleMessage(const gloox::Message& message, gloox::MessageSession* session) {
if (message.subtype() != gloox::Message::Chat)
return;
std::string body = message.body();
if (body.empty())
return;
std::string jid = message.from().bare();
core->logger.log(Logger::debug, "received message \"" + message.body() + "\" from " + jid, {"Connection"});
core->router.routeMessage(jid, message.body());
core->logger.log(Logger::debug, "received message \"" + body + "\" from " + jid, {"Connection"});
core->router.routeMessage(jid, body);
}
void Connection::onConnect() {

View file

@ -28,7 +28,7 @@ public:
Connection(const std::shared_ptr<Core>& core);
~Connection() noexcept;
void initiialize();
void initialize();
void deinitialize();
void connect();
void send(const std::string& jid, const std::string& body);