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

pin/unpin messages in supergroups, local hide for pinned messages

This commit is contained in:
John Preston
2016-03-10 13:15:21 +03:00
parent 420e82d421
commit efa5fc443a
24 changed files with 667 additions and 183 deletions

View File

@@ -908,6 +908,17 @@ struct HistoryMessageForwarded : public BasicInterface<HistoryMessageForwarded>
mutable Text _text;
};
class HistoryDependentItemCallback : public SharedCallback2<void, ChannelData*, MsgId> {
public:
HistoryDependentItemCallback(FullMsgId dependent) : _dependent(dependent) {
}
void call(ChannelData *channel, MsgId msgId) const override;
private:
FullMsgId _dependent;
};
class HistoryMedia;
class HistoryItem : public HistoryElem, public Interfaces {
public:
@@ -1076,7 +1087,12 @@ public:
return (channel->amEditor() || channel->amModerator() || out());
}
bool canPin() const {
return id > 0 && _history->peer->isMegagroup() && (_history->peer->asChannel()->amEditor() || _history->peer->asChannel()->amCreator()) && toHistoryMessage();
}
bool canEdit(const QDateTime &cur) const;
bool hasDirectLink() const {
return id > 0 && _history->peer->isChannel() && _history->peer->asChannel()->isPublic();
}
@@ -1536,6 +1552,9 @@ public:
}
ImagePtr replyPreview();
QString getCaption() const {
return _caption.original();
}
bool needsBubble(const HistoryItem *parent) const {
return !_caption.isEmpty() || parent->Is<HistoryMessageForwarded>() || parent->toHistoryReply() || parent->viaBot();
}