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

removed itemReplaced

This commit is contained in:
John Preston
2015-12-23 15:55:32 +03:00
parent 41f5a87c80
commit 73a4d3510d
12 changed files with 47 additions and 192 deletions

View File

@@ -64,36 +64,6 @@ void ApiWrap::itemRemoved(HistoryItem *item) {
}
}
void ApiWrap::itemReplaced(HistoryItem *oldItem, HistoryItem *newItem) {
if (HistoryReply *reply = oldItem->toHistoryReply()) {
ChannelData *channel = reply->history()->peer->asChannel();
ReplyToRequests *requests(replyToRequests(channel, true));
if (requests) {
ReplyToRequests::iterator i = requests->find(reply->replyToId());
if (i != requests->cend()) {
for (QList<HistoryReply*>::iterator j = i->replies.begin(); j != i->replies.end();) {
if ((*j) == reply) {
if (HistoryReply *newReply = newItem->toHistoryReply()) {
*j = newReply;
++j;
} else {
j = i->replies.erase(j);
}
} else {
++j;
}
}
if (i->replies.isEmpty()) {
requests->erase(i);
}
}
if (channel && requests->isEmpty()) {
_channelReplyToRequests.remove(channel);
}
}
}
}
void ApiWrap::requestReplyTo(HistoryReply *reply, ChannelData *channel, MsgId id) {
ReplyToRequest &req(channel ? _channelReplyToRequests[channel][id] : _replyToRequests[id]);
req.replies.append(reply);