File indexing completed on 2024-12-01 10:39:43

0001 /*
0002    SPDX-FileCopyrightText: 2022-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "libruqolacore_export.h"
0010 #include <QDebug>
0011 #include <QString>
0012 
0013 class LIBRUQOLACORE_EXPORT ParseMessageUrlUtils
0014 {
0015     Q_GADGET
0016 public:
0017     enum class ChannelType {
0018         Unknown = 0,
0019         Direct = 1,
0020         Channel = 2,
0021         Group = 3,
0022     };
0023     Q_ENUM(ChannelType)
0024     enum class RoomIdType {
0025         Unknown = 0,
0026         RoomId = 1,
0027         RoomName = 2,
0028     };
0029     Q_ENUM(RoomIdType)
0030 
0031     ParseMessageUrlUtils();
0032     ~ParseMessageUrlUtils();
0033 
0034     [[nodiscard]] bool parseUrl(const QString &messageUrl);
0035 
0036     [[nodiscard]] const QString &messageId() const;
0037     void setMessageId(const QString &newMessageId);
0038 
0039     [[nodiscard]] const QString &roomId() const;
0040     void setRoomId(const QString &newRoomId);
0041 
0042     [[nodiscard]] const QString &serverHost() const;
0043     void setServerHost(const QString &newServerPath);
0044 
0045     [[nodiscard]] const QString &path() const;
0046     void setPath(const QString &newPath);
0047 
0048     [[nodiscard]] RoomIdType roomIdType() const;
0049     void setRoomIdType(RoomIdType newRoomIdType);
0050 
0051     [[nodiscard]] ChannelType channelType() const;
0052     void setChannelType(ChannelType newChannelType);
0053 
0054 private:
0055     QString mMessageId;
0056     QString mRoomId;
0057     QString mServerHost;
0058     QString mPath;
0059     RoomIdType mRoomIdType = RoomIdType::Unknown;
0060     ChannelType mChannelType = ChannelType::Unknown;
0061 };
0062 
0063 LIBRUQOLACORE_EXPORT QDebug operator<<(QDebug d, const ParseMessageUrlUtils &t);