2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

forwarded getState fixed, pinned message service msg dependency request and text update done

This commit is contained in:
John Preston
2016-03-05 23:12:55 +02:00
parent 2bfb1e0f1f
commit 1c722a425d
14 changed files with 299 additions and 119 deletions

View File

@@ -115,7 +115,6 @@ struct FakeDialogRow {
enum HistoryMediaType {
MediaTypePhoto,
MediaTypeVideo,
MediaTypeGeo,
MediaTypeContact,
MediaTypeFile,
MediaTypeGif,
@@ -919,6 +918,15 @@ public:
virtual int32 resize(int32 width) = 0; // return new height
virtual void draw(Painter &p, const QRect &r, uint32 selection, uint64 ms) const = 0;
virtual void dependencyItemRemoved(HistoryItem *dependency) {
}
virtual bool updateDependencyItem() {
return true;
}
virtual MsgId dependencyMsgId() const {
return 0;
}
virtual UserData *viaBot() const {
return 0;
}
@@ -2229,15 +2237,19 @@ public:
void initDimensions();
bool updateReplyTo(bool force = false);
void replyToNameUpdated() const;
bool updateDependencyItem() override {
return updateReplyTo(true);
}
MsgId dependencyMsgId() const override {
return replyToId();
}
int32 replyToWidth() const;
TextLinkPtr replyToLink() const;
MsgId replyToId() const;
HistoryItem *replyToMessage() const;
void replyToReplaced(HistoryItem *oldItem, HistoryItem *newItem);
void dependencyItemRemoved(HistoryItem *dependency) override;
void draw(Painter &p, const QRect &r, uint32 selection, uint64 ms) const;
void drawReplyTo(Painter &p, int32 x, int32 y, int32 w, bool selected, bool likeService = false) const;
@@ -2265,6 +2277,9 @@ public:
protected:
bool updateReplyTo(bool force = false);
void replyToNameUpdated() const;
MsgId replyToMsgId;
HistoryItem *replyToMsg;
TextLinkPtr replyToLnk;
@@ -2296,6 +2311,14 @@ inline int32 newForwardedFlags(PeerData *p, int32 from, HistoryMessage *fwd) {
return result;
}
struct HistoryServicePinned : public BasicInterface<HistoryServicePinned> {
HistoryServicePinned(Interfaces *);
MsgId msgId;
HistoryItem *msg;
TextLinkPtr lnk;
};
class HistoryServiceMsg : public HistoryItem {
public:
@@ -2304,6 +2327,16 @@ public:
void initDimensions();
bool updateDependencyItem() override {
return updatePinned(true);
}
MsgId dependencyMsgId() const override {
if (const HistoryServicePinned *pinned = Get<HistoryServicePinned>()) {
return pinned->msgId;
}
return 0;
}
void countPositionAndSize(int32 &left, int32 &width) const;
void draw(Painter &p, const QRect &r, uint32 selection, uint64 ms) const;
@@ -2344,6 +2377,8 @@ public:
protected:
void setMessageByAction(const MTPmessageAction &action);
bool updatePinned(bool force = false);
bool updatePinnedText(const QString *pfrom = nullptr, QString *ptext = nullptr);
Text _text;
HistoryMedia *_media;