Display forwarded info in video messages.

This commit is contained in:
John Preston
2017-04-30 15:44:17 +03:00
parent 4659b664e7
commit eb240defa3
8 changed files with 136 additions and 80 deletions
@@ -290,23 +290,23 @@ void System::showNext() {
_waitTimer.start(next - ms);
break;
} else {
HistoryItem *fwd = notifyItem->Has<HistoryMessageForwarded>() ? notifyItem : nullptr; // forwarded notify grouping
int32 fwdCount = 1;
auto forwardedItem = notifyItem->Has<HistoryMessageForwarded>() ? notifyItem : nullptr; // forwarded notify grouping
auto forwardedCount = 1;
auto ms = getms(true);
History *history = notifyItem->history();
auto history = notifyItem->history();
auto j = _whenMaps.find(history);
if (j == _whenMaps.cend()) {
history->clearNotifications();
} else {
HistoryItem *nextNotify = 0;
auto nextNotify = (HistoryItem*)nullptr;
do {
history->skipNotification();
if (!history->hasNotification()) {
break;
}
j.value().remove((fwd ? fwd : notifyItem)->id);
j.value().remove((forwardedItem ? forwardedItem : notifyItem)->id);
do {
auto k = j.value().constFind(history->currentNotification()->id);
if (k != j.value().cend()) {
@@ -317,11 +317,11 @@ void System::showNext() {
history->skipNotification();
} while (history->hasNotification());
if (nextNotify) {
if (fwd) {
HistoryItem *nextFwd = nextNotify->Has<HistoryMessageForwarded>() ? nextNotify : nullptr;
if (nextFwd && fwd->author() == nextFwd->author() && qAbs(int64(nextFwd->date.toTime_t()) - int64(fwd->date.toTime_t())) < 2) {
fwd = nextFwd;
++fwdCount;
if (forwardedItem) {
auto nextForwarded = nextNotify->Has<HistoryMessageForwarded>() ? nextNotify : nullptr;
if (nextForwarded && forwardedItem->author() == nextForwarded->author() && qAbs(int64(nextForwarded->date.toTime_t()) - int64(forwardedItem->date.toTime_t())) < 2) {
forwardedItem = nextForwarded;
++forwardedCount;
} else {
nextNotify = nullptr;
}
@@ -332,7 +332,7 @@ void System::showNext() {
} while (nextNotify);
}
_manager->showNotification(notifyItem, fwdCount);
_manager->showNotification(notifyItem, forwardedCount);
if (!history->hasNotification()) {
_waiters.remove(history);