mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-23 06:38:07 +00:00
Fix persistent proxy on removing (message-expires let the contact exists for messages) and subject UTF8 chat rooms
This commit is contained in:
parent
44b7c112b3
commit
ba9cdef3b8
5 changed files with 29 additions and 4 deletions
|
|
@ -516,7 +516,7 @@ QList<QString> ChatRoomModel::getComposers(){
|
|||
|
||||
void ChatRoomModel::setSubject(QString& subject){
|
||||
if(mChatRoom && getSubject() != subject){
|
||||
mChatRoom->setSubject(subject.toStdString()); // in UTF8
|
||||
mChatRoom->setSubject(subject.toUtf8().toStdString()); // in UTF8
|
||||
emit subjectChanged(subject);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -207,8 +207,8 @@ void AccountSettingsModel::removeProxyConfig (const shared_ptr<linphone::ProxyCo
|
|||
|
||||
CoreManager *coreManager = CoreManager::getInstance();
|
||||
std::shared_ptr<linphone::ProxyConfig> newProxy = nullptr;
|
||||
std::list<std::shared_ptr<linphone::ProxyConfig>> allProxies = coreManager->getCore()->getProxyConfigList();
|
||||
if( proxyConfig == coreManager->getCore()->getDefaultProxyConfig()){
|
||||
std::list<std::shared_ptr<linphone::ProxyConfig>> allProxies = coreManager->getCore()->getProxyConfigList();
|
||||
for(auto proxy : allProxies){
|
||||
if( proxy != proxyConfig ){
|
||||
newProxy = proxy;
|
||||
|
|
@ -217,8 +217,23 @@ void AccountSettingsModel::removeProxyConfig (const shared_ptr<linphone::ProxyCo
|
|||
}
|
||||
setDefaultProxyConfig(newProxy);
|
||||
}
|
||||
|
||||
coreManager->getCore()->removeProxyConfig(proxyConfig);// Remove first to avoid requesting password when deleting it
|
||||
// "message-expires" is used to keep contact for messages. Setting to 0 will remove the contact for messages too.
|
||||
// Check if a "message-expires" exists and set it to 0
|
||||
QStringList parameters = Utils::coreStringToAppString(proxyConfig->getContactParameters()).split(";");
|
||||
for(int i = 0 ; i < parameters.size() ; ++i){
|
||||
QStringList fields = parameters[i].split("=");
|
||||
if( fields.size() > 1 && fields[0].simplified() == "message-expires"){
|
||||
parameters[i] = Constants::DefaultContactParametersOnRemove;
|
||||
}
|
||||
}
|
||||
proxyConfig->edit();
|
||||
proxyConfig->setContactParameters(Utils::appStringToCoreString(parameters.join(";")));
|
||||
if (proxyConfig->done() == -1) {
|
||||
qWarning() << QStringLiteral("Unable to reset message-expiry property before removing proxy config: `%1`.")
|
||||
.arg(QString::fromStdString(proxyConfig->getIdentityAddress()->asString()));
|
||||
}else { // Wait for update
|
||||
mRemovingProxies.push_back(proxyConfig);
|
||||
}
|
||||
|
||||
emit accountSettingsUpdated();
|
||||
}
|
||||
|
|
@ -461,6 +476,11 @@ void AccountSettingsModel::handleRegistrationStateChanged (
|
|||
CoreManager::getInstance()->getCore()->removeAuthInfo(authInfo);
|
||||
});
|
||||
coreManager->getSettingsModel()->configureRlsUri();
|
||||
}else if(mRemovingProxies.contains(proxy)){
|
||||
mRemovingProxies.removeAll(proxy);
|
||||
QTimer::singleShot(100, [proxy](){// removeProxyConfig cannot be called from callback
|
||||
CoreManager::getInstance()->getCore()->removeProxyConfig(proxy);
|
||||
});
|
||||
}
|
||||
if(defaultProxyConfig == proxy)
|
||||
emit defaultRegistrationChanged();
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
#include <QString>
|
||||
#include <QVariantMap>
|
||||
#include <QVariantList>
|
||||
#include <QVector>
|
||||
|
||||
// =============================================================================
|
||||
|
||||
|
|
@ -117,6 +118,8 @@ private:
|
|||
const std::shared_ptr<linphone::ProxyConfig> &proxyConfig,
|
||||
linphone::RegistrationState state
|
||||
);
|
||||
|
||||
QVector<std::shared_ptr<linphone::ProxyConfig> > mRemovingProxies;
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(std::shared_ptr<linphone::ProxyConfig>);
|
||||
|
|
|
|||
|
|
@ -95,6 +95,7 @@ constexpr int Constants::RcVersionCurrent;
|
|||
// TODO: Remove hardcoded values. Use config directly.
|
||||
constexpr char Constants::LinphoneDomain[];
|
||||
constexpr char Constants::DefaultContactParameters[];
|
||||
constexpr char Constants::DefaultContactParametersOnRemove[];
|
||||
constexpr int Constants::DefaultExpires;
|
||||
constexpr char Constants::DownloadUrl[];
|
||||
constexpr char Constants::PasswordRecoveryUrl[];
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ public:
|
|||
static constexpr char DefaultXmlrpcUri[] = "https://subscribe.linphone.org:444/wizard.php";
|
||||
static constexpr char LinphoneDomain[] = "sip.linphone.org";
|
||||
static constexpr char DefaultContactParameters[] = "message-expires=604800";
|
||||
static constexpr char DefaultContactParametersOnRemove[] = "message-expires=0";
|
||||
static constexpr int DefaultExpires = 3600;
|
||||
static constexpr char DownloadUrl[] = "https://www.linphone.org/technical-corner/linphone";
|
||||
static constexpr char PasswordRecoveryUrl[] = "https://subscribe.linphone.org/login";
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue