/* * Copyright (c) 2010-2024 Belledonne Communications SARL. * * This file is part of linphone-desktop * (see https://www.linphone.org). * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef TOOL_MODEL_H_ #define TOOL_MODEL_H_ #include "core/call/CallCore.hpp" #include "tool/AbstractObject.hpp" #include #include #include class ToolModel : public QObject, public AbstractObject { Q_OBJECT public: ToolModel(QObject *parent = nullptr); ~ToolModel(); static std::shared_ptr interpretUrl(const QString &address); static std::shared_ptr getCallByRemoteAddress(const QString &remoteAddress); static std::shared_ptr makeLinphoneNumber(const QString &label, const QString &number); static std::shared_ptr findAudioDevice(const QString &id, linphone::AudioDevice::Capabilities capability); static std::shared_ptr findAccount(const std::shared_ptr &address); static std::shared_ptr findAccount(const QString &address); static bool isMe(const QString &address); static bool isLocal(const QString &address); static bool isMe(const std::shared_ptr &address); static bool isLocal(const std::shared_ptr &conference, const std::shared_ptr &device); static QString getDisplayName(const std::shared_ptr &address); static QString getDisplayName(QString address); static QString encodeTextToQmlRichFormat(const QString &text, const QVariantMap &options, std::shared_ptr chatRoom); static std::shared_ptr findFriendByAddress(const QString &address); static std::shared_ptr findFriendByAddress(const std::shared_ptr &linphoneAddr); static bool createCall(const QString &sipAddress, const QVariantMap &options = {}, const QString &prepareTransfertAddress = "", const QHash &headers = {}, linphone::MediaEncryption = linphone::MediaEncryption::None, QString *errorMessage = nullptr); static std::shared_ptr createConference(QString subject, QString *message = nullptr); static bool createGroupCall(QString subject, const std::list &participantAddresses, QString *message = nullptr); static std::shared_ptr getFriendList(const std::string &listName); static std::shared_ptr getAppFriendList(); static std::shared_ptr getLdapFriendList(); static bool friendIsInFriendList(const std::shared_ptr &friendList, const std::shared_ptr &f); static QString getMessageFromContent(std::list> contents); static QString getMessageFromMessage(std::shared_ptr message); static void loadDownloadedCodecs(); static void updateCodecs(); static QVariantMap createVariant(const std::shared_ptr &device); static QVariantMap createVariant(linphone::Conference::Layout layout); static QString getOsProduct(); static QString computeUserAgent(const std::shared_ptr &config); static std::shared_ptr getChatRoomParams(std::shared_ptr call, std::shared_ptr remoteAddress = nullptr); static std::shared_ptr lookupCurrentCallChat(std::shared_ptr callModel); static std::shared_ptr createCurrentCallChat(std::shared_ptr callModel); static bool isEndToEndEncryptedChatAvailable(); static std::shared_ptr lookupChatForAddress(std::shared_ptr remoteAddress); static std::shared_ptr createChatForAddress(std::shared_ptr remoteAddress); static std::shared_ptr createGroupChatRoom(QString subject, std::list> participantsAddresses); static LinphoneEnums::Presence corePresenceModelToAppPresence(std::shared_ptr presenceModel); static std::shared_ptr appPresenceToCorePresenceModel(LinphoneEnums::Presence presence, QString presenceNote); static std::string configAccountSection(const std::shared_ptr &account); private: DECLARE_ABSTRACT_OBJECT }; #endif