Store the SessionManager inside of XmppClient

This commit is contained in:
phosit 2026-03-27 19:31:53 +01:00
parent b1b31b0929
commit 783525dd73
No known key found for this signature in database
GPG key ID: C9430B600671C268
2 changed files with 5 additions and 7 deletions

View file

@ -129,6 +129,7 @@ XmppClient::XmppClient(const ScriptInterface* scriptInterface, const std::string
m_client{CreateClient(regOpt, sUsername, m_server, sPassword)},
m_mucRoom(nullptr),
m_registration(nullptr),
m_sessionManager{&m_client, this},
m_regOpt(regOpt),
m_username(sUsername),
m_password(sPassword),
@ -137,7 +138,6 @@ XmppClient::XmppClient(const ScriptInterface* scriptInterface, const std::string
m_xpartamuppId{g_ConfigDB.Get("lobby.xpartamupp", std::string{}) + "@" + m_server + "/CC"},
m_echelonId{g_ConfigDB.Get("lobby.echelon", std::string{}) + "@" + m_server + "/CC"},
m_initialLoadComplete(false),
m_sessionManager(nullptr),
m_certStatus(gloox::CertStatus::CertOk),
m_PlayerMapUpdate(false),
m_connectionDataJid(),
@ -197,10 +197,9 @@ XmppClient::XmppClient(const ScriptInterface* scriptInterface, const std::string
m_mucRoom->setRequestHistory(historyRequestSize, gloox::MUCRoom::HistoryMaxStanzas);
}
m_sessionManager = new gloox::Jingle::SessionManager(&m_client, this);
// Register plugins to allow gloox parse them in incoming sessions
m_sessionManager->registerPlugin(new gloox::Jingle::Content());
m_sessionManager->registerPlugin(new gloox::Jingle::ICEUDP());
m_sessionManager.registerPlugin(new gloox::Jingle::Content());
m_sessionManager.registerPlugin(new gloox::Jingle::ICEUDP());
}
/**
@ -213,7 +212,6 @@ XmppClient::~XmppClient()
DbgXMPP("XmppClient destroyed");
delete m_registration;
delete m_mucRoom;
delete m_sessionManager;
// Workaround for memory leak in gloox 1.0/1.0.1
m_client.removePresenceExtension(gloox::ExtCaps);
@ -1306,7 +1304,7 @@ void XmppClient::SendStunEndpointToHost(const std::string& ip, u16 port, const s
DbgXMPP("SendStunEndpointToHost " << hostJIDStr);
gloox::JID hostJID(hostJIDStr);
gloox::Jingle::Session* session = m_sessionManager->createSession(hostJID, this);
gloox::Jingle::Session* session = m_sessionManager.createSession(hostJID, this);
gloox::Jingle::ICEUDP::CandidateList candidateList;

View file

@ -49,7 +49,7 @@ private:
gloox::Client m_client;
gloox::MUCRoom* m_mucRoom;
gloox::Registration* m_registration;
gloox::Jingle::SessionManager* m_sessionManager;
gloox::Jingle::SessionManager m_sessionManager;
// Account infos
std::string m_username;