Fix log in conference.

Fix removing auth info on bad login.
Fix crash on login.
This commit is contained in:
Julien Wadel 2025-01-31 15:01:34 +01:00
parent a870dca8fb
commit 4defd26bb6
4 changed files with 16 additions and 6 deletions

View file

@ -248,7 +248,7 @@ ParticipantGui *ConferenceCore::getMeGui() const {
void ConferenceCore::setActiveSpeakerDevice(const QSharedPointer<ParticipantDeviceCore> &device) { void ConferenceCore::setActiveSpeakerDevice(const QSharedPointer<ParticipantDeviceCore> &device) {
if (mActiveSpeakerDevice != device) { if (mActiveSpeakerDevice != device) {
mActiveSpeakerDevice = device; mActiveSpeakerDevice = device;
log().arg("Changing active speaker device to ").arg(device ? device->getAddress() : "None"); qDebug() << log().arg("Changing active speaker device to %1").arg(device ? device->getAddress() : "None");
emit activeSpeakerDeviceChanged(); emit activeSpeakerDeviceChanged();
} }
} }
@ -256,7 +256,7 @@ void ConferenceCore::setActiveSpeakerDevice(const QSharedPointer<ParticipantDevi
void ConferenceCore::setActiveSpeaker(const QSharedPointer<ParticipantCore> &participant) { void ConferenceCore::setActiveSpeaker(const QSharedPointer<ParticipantCore> &participant) {
if (mActiveSpeaker != participant) { if (mActiveSpeaker != participant) {
mActiveSpeaker = participant; mActiveSpeaker = participant;
log().arg("Changing active speaker to ").arg(participant ? participant->getSipAddress() : "None"); qDebug() << log().arg("Changing active speaker to %1").arg(participant ? participant->getSipAddress() : "None");
emit activeSpeakerChanged(); emit activeSpeakerChanged();
} }
} }

View file

@ -129,9 +129,13 @@ bool AccountManager::login(QString username,
if (mAccountModel && account == mAccountModel->getAccount()) { if (mAccountModel && account == mAccountModel->getAccount()) {
if (state == linphone::RegistrationState::Failed) { if (state == linphone::RegistrationState::Failed) {
connect( connect(
mAccountModel.get(), &AccountModel::removed, this, mAccountModel.get(), &AccountModel::removedFromCore, this,
[this]() { [this]() {
emit mAccountModel->removeListener(); auto authInfo = mAccountModel->getMonitor()->findAuthInfo();
if (authInfo) {
qDebug() << log().arg("Removing auth info after failing to connect on login");
CoreModel::getInstance()->getCore()->removeAuthInfo(authInfo);
}
mAccountModel = nullptr; mAccountModel = nullptr;
}, },
Qt::SingleShotConnection); Qt::SingleShotConnection);

View file

@ -46,6 +46,10 @@ AccountModel::AccountModel(const std::shared_ptr<linphone::Account> &account, QO
emit unreadNotificationsChanged(0 /*mMonitor->getUnreadChatMessageCount()*/, emit unreadNotificationsChanged(0 /*mMonitor->getUnreadChatMessageCount()*/,
mMonitor->getMissedCallsCount()); // TODO mMonitor->getMissedCallsCount()); // TODO
}); });
connect(CoreModel::getInstance().get(), &CoreModel::accountRemoved, this,
[this](const std::shared_ptr<linphone::Core> &core, const std::shared_ptr<linphone::Account> &account) {
if (account == mMonitor) emit removedFromCore();
});
} }
AccountModel::~AccountModel() { AccountModel::~AccountModel() {
@ -117,10 +121,11 @@ void AccountModel::setDefault() {
void AccountModel::removeAccount() { void AccountModel::removeAccount() {
auto core = CoreModel::getInstance()->getCore(); auto core = CoreModel::getInstance()->getCore();
auto params = mMonitor ? mMonitor->getParams() : nullptr;
qDebug() << log() qDebug() << log()
.arg("Removing account [%1]") .arg("Removing account [%1]")
.arg(mMonitor ? Utils::coreStringToAppString(mMonitor->getContactAddress()->asString()) : "Null"); .arg(params ? Utils::coreStringToAppString(params->getIdentityAddress()->asString()) : "Null");
core->removeAccount(mMonitor); if (mMonitor) core->removeAccount(mMonitor);
} }
std::shared_ptr<linphone::Account> AccountModel::getAccount() const { std::shared_ptr<linphone::Account> AccountModel::getAccount() const {

View file

@ -109,6 +109,7 @@ signals:
void audioVideoConferenceFactoryAddressChanged(QString value); void audioVideoConferenceFactoryAddressChanged(QString value);
void limeServerUrlChanged(QString value); void limeServerUrlChanged(QString value);
void removed(); void removed();
void removedFromCore();
void voicemailCountChanged(int count); void voicemailCountChanged(int count);
void showMwiChanged(bool show); void showMwiChanged(bool show);
void voicemailAddressChanged(QString value); void voicemailAddressChanged(QString value);