From a3c9f83ab19adae079fdd85e891abc23f16f71a4 Mon Sep 17 00:00:00 2001 From: Boris Pek Date: Thu, 20 Jun 2024 16:20:08 +0300 Subject: [PATCH] Current version of Psi+ is 1.5.1988 It is based on: * psi: 8efb20f3 * plugins: 7a65467 * psimedia: 478567e * resources: e32ef4b --- src/vcardfactory.cpp | 19 +++++-------------- version | 2 +- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/vcardfactory.cpp b/src/vcardfactory.cpp index bb342c80..0214bb89 100644 --- a/src/vcardfactory.cpp +++ b/src/vcardfactory.cpp @@ -156,20 +156,11 @@ void VCardFactory::saveVCard(const Jid &j, const VCard4::VCard &vcard, Flags fla if (!v.exists()) p.mkdir("vcard"); - QFile file(ApplicationInfo::vCardDir() + '/' + JIDUtil::encode(j.bare()).toLower() + ".xml"); + auto filename = ApplicationInfo::vCardDir() + '/' + JIDUtil::encode(j.bare()).toLower() + ".xml"; if (vcard) { - file.open(QIODevice::WriteOnly); - QTextStream out(&file); -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) - out.setEncoding(QStringConverter::Utf8); -#else - out.setCodec("UTF-8"); -#endif - QDomDocument doc; - doc.appendChild(vcard.toXmlElement(doc)); - out << doc.toString(4); - } else if (file.exists()) { - file.remove(); + vcard.save(filename); + } else { + QFile::remove(filename); } Jid jid = j; @@ -211,11 +202,11 @@ VCard4::VCard VCardFactory::vcard(const Jid &j, Flags flags) // REVIEW we can cache which files were really missed. or maybe set a flag for the contact return {}; } - QDomDocument doc; VCard4::VCard v4 = VCard4::VCard::fromDevice(&file); if (!v4) { file.seek(0); + QDomDocument doc; if (doc.setContent(&file, false)) { VCard vcard = VCard::fromXml(doc.documentElement()); if (!vcard.isNull()) { diff --git a/version b/version index d81863e6..1953bf8e 100644 --- a/version +++ b/version @@ -1 +1 @@ -1.5.1987 (2024-06-20, 257a7e84) +1.5.1988 (2024-06-20, 8efb20f3)