Browse Source

refactor(ContactId): Add clone function to ChatId interface

So that History can load history messages without needing to know
what type of Chat the messages are from.
reviewable/pr6561/r47
Anthony Bilinski 3 years ago
parent
commit
cfe18f8340
No known key found for this signature in database
GPG Key ID: 2AA8E0DA1B31FB3C
  1. 1
      src/core/chatid.h
  2. 5
      src/core/groupid.cpp
  3. 1
      src/core/groupid.h
  4. 5
      src/core/toxpk.cpp
  5. 1
      src/core/toxpk.h

1
src/core/chatid.h

@ -41,6 +41,7 @@ public: @@ -41,6 +41,7 @@ public:
const uint8_t* getData() const;
bool isEmpty() const;
virtual int getSize() const = 0;
virtual std::unique_ptr<ChatId> clone() const = 0;
protected:
ChatId();

5
src/core/groupid.cpp

@ -67,3 +67,8 @@ int GroupId::getSize() const @@ -67,3 +67,8 @@ int GroupId::getSize() const
{
return size;
}
std::unique_ptr<ChatId> GroupId::clone() const
{
return std::unique_ptr<ChatId>(new GroupId(*this));
}

1
src/core/groupid.h

@ -31,4 +31,5 @@ public: @@ -31,4 +31,5 @@ public:
explicit GroupId(const QByteArray& rawId);
explicit GroupId(const uint8_t* rawId);
int getSize() const override;
std::unique_ptr<ChatId> clone() const override;
};

5
src/core/toxpk.cpp

@ -87,3 +87,8 @@ int ToxPk::getSize() const @@ -87,3 +87,8 @@ int ToxPk::getSize() const
{
return size;
}
std::unique_ptr<ChatId> ToxPk::clone() const
{
return std::unique_ptr<ChatId>(new ToxPk(*this));
}

1
src/core/toxpk.h

@ -33,4 +33,5 @@ public: @@ -33,4 +33,5 @@ public:
explicit ToxPk(const uint8_t* rawId);
explicit ToxPk(const QString& pk);
int getSize() const override;
std::unique_ptr<ChatId> clone() const override;
};

Loading…
Cancel
Save