From 530c24bf2bf672845d4d4f7c17f69ce213b7cf1d Mon Sep 17 00:00:00 2001 From: Keshav Bhatt Date: Wed, 31 Aug 2022 21:48:46 +0530 Subject: feat: systemtray notification counter other changes include: - no client side check on new chat numbers, whatsapp web doing check --- src/utils.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/utils.cpp') diff --git a/src/utils.cpp b/src/utils.cpp index b231882..da8d2a2 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -175,7 +175,7 @@ QString utils::DecodeXML(const QString &decodeMe) { return temp; } -QString utils::htmlToPlainText(QString str) { +QString utils::htmlToPlainText(const QString &str) { QString out; QTextDocument text; text.setHtml(str); @@ -264,7 +264,7 @@ QString utils::GetEnvironmentVar(const QString &variable_name) { #endif } -void utils::desktopOpenUrl(const QString str) { +void utils::desktopOpenUrl(const QString &str) { QProcess *xdg_open = new QProcess(0); xdg_open->start("xdg-open", QStringList() << str); if (xdg_open->waitForStarted(1000) == false) { @@ -284,3 +284,10 @@ void utils::desktopOpenUrl(const QString str) { xdg_open->deleteLater(); }); } + +bool utils::isPhoneNumber(const QString &phoneNumber) { + const QString phone = "^\\+(((\\d{2}))\\s?)?((\\d{2})|(\\((\\d{2})\\))\\s?)?(" + "\\d{3,15})(\\-(\\d{3,15}))?$"; + static QRegularExpression reg(phone); + return reg.match(phoneNumber).hasMatch(); +} -- cgit v1.2.3