diff --git a/src/xmpp/xmpp-im/xmpp_serverinfomanager.cpp b/src/xmpp/xmpp-im/xmpp_serverinfomanager.cpp index faef8c93..317b3be9 100644 --- a/src/xmpp/xmpp-im/xmpp_serverinfomanager.cpp +++ b/src/xmpp/xmpp-im/xmpp_serverinfomanager.cpp @@ -69,8 +69,6 @@ void ServerInfoManager::deinitialize() const QString &ServerInfoManager::multicastService() const { return _multicastService; } -bool ServerInfoManager::hasPEP() const { return _hasPEP; } - bool ServerInfoManager::canMessageCarbons() const { return _canMessageCarbons; } void ServerInfoManager::queryServicesList() @@ -294,10 +292,12 @@ void ServerInfoManager::account_disco_finished() // Identities DiscoItem::Identities is = jt->item().identities(); for (const DiscoItem::Identity &i : is) { - if (i.category == "pubsub" && i.type == "pep") + if (i.category == "pubsub" && i.type == "pep") { _hasPEP = true; + } } - _account_features = jt->item().features(); + _hasPersistentStorage = jt->item().hasPersistentStorage(); + _account_features = jt->item().features(); emit featuresChanged(); } diff --git a/src/xmpp/xmpp-im/xmpp_serverinfomanager.h b/src/xmpp/xmpp-im/xmpp_serverinfomanager.h index ccfa2a02..4ced0e78 100644 --- a/src/xmpp/xmpp-im/xmpp_serverinfomanager.h +++ b/src/xmpp/xmpp-im/xmpp_serverinfomanager.h @@ -79,7 +79,8 @@ class ServerInfoManager : public QObject { ServerInfoManager(XMPP::Client *client); const QString &multicastService() const; - bool hasPEP() const; + inline bool hasPEP() const { return _hasPEP; } + inline bool hasPersistentStorage() const { return _hasPersistentStorage; } inline const Features &server_features() const { return _server_features; } inline const Features &account_features() const { return _account_features; } bool canMessageCarbons() const; @@ -137,9 +138,10 @@ private slots: QMap _servicesInfo; // all the diso#info requests for services of this server jid=>(state,info) - bool _featuresRequested; - bool _hasPEP; - bool _canMessageCarbons; + bool _featuresRequested = false; + bool _hasPEP = false; + bool _hasPersistentStorage = false; + bool _canMessageCarbons = false; }; } // namespace XMPP diff --git a/src/xmpp/xmpp-im/xmpp_vcard4.cpp b/src/xmpp/xmpp-im/xmpp_vcard4.cpp index 120c39aa..0a2ea0f9 100644 --- a/src/xmpp/xmpp-im/xmpp_vcard4.cpp +++ b/src/xmpp/xmpp-im/xmpp_vcard4.cpp @@ -204,7 +204,7 @@ namespace { } template - static void fillContainer(QDomElement parent, const char *tagName, TaggedList &container) + static void fillContainer(QDomElement parent, const char *tagName, TaggedList> &container) { auto tn = QString::fromLatin1(tagName); for (auto e = parent.firstChildElement(tn); !e.isNull(); e = e.nextSiblingElement(tn)) { @@ -644,7 +644,7 @@ QDomElement VCard::toXmlElement(QDomDocument &document) const return {}; } - QDomElement vCardElement = document.createElement(QLatin1String("vcard")); + QDomElement vCardElement = document.createElementNS(VCARD_NAMESPACE, QLatin1String("vcard")); VCardHelper::serializeList(vCardElement, d->fullName, QLatin1String("fn")); if (!d->names.data.isEmpty()) { @@ -947,7 +947,7 @@ void VCard::fromVCardTemp(const XMPP::VCard &tempVCard) XMPP::VCard VCard::toVCardTemp() const { - XMPP::VCard tempVCard; + auto tempVCard = XMPP::VCard::makeEmpty(); // Full Name if (!d->fullName.isEmpty()) { @@ -1059,7 +1059,7 @@ XMPP::VCard VCard::toVCardTemp() const // Getters and setters implementation -PStrings VCard::fullName() const { return d->fullName; } +PStrings VCard::fullName() const { return d ? d->fullName : PStrings {}; } void VCard::setFullName(const PStrings &fullName) { @@ -1067,7 +1067,7 @@ void VCard::setFullName(const PStrings &fullName) d->fullName = fullName; } -const PNames &VCard::names() const { return d->names; } +PNames VCard::names() const { return d ? d->names : PNames {}; } void VCard::setNames(const PNames &names) { diff --git a/src/xmpp/xmpp-im/xmpp_vcard4.h b/src/xmpp/xmpp-im/xmpp_vcard4.h index b95c6670..9a5790ac 100644 --- a/src/xmpp/xmpp-im/xmpp_vcard4.h +++ b/src/xmpp/xmpp-im/xmpp_vcard4.h @@ -262,8 +262,8 @@ class VCard { PStrings fullName() const; void setFullName(const PStrings &fullName); - const PNames &names() const; - void setNames(const PNames &names); + PNames names() const; + void setNames(const PNames &names); PStringLists nickName() const; void setNickName(const PStringLists &nickname);