From 5b811500f6634cb7c39de73ac7b9cc4a56fc7117 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 25 Sep 2015 10:47:32 +0300 Subject: [PATCH] version 0.9.2 prepared --- Telegram/DeployLinux.sh | 24 ----- Telegram/DeployLinux32.sh | 25 ----- Telegram/DeployMacWin.sh | 68 -------------- Telegram/PrepareLinux.sh | 58 ------------ Telegram/PrepareLinux32.sh | 58 ------------ Telegram/PrepareMac.sh | 98 -------------------- Telegram/SourceFiles/boxes/contactsbox.cpp | 15 +-- Telegram/SourceFiles/boxes/contactsbox.h | 5 +- Telegram/SourceFiles/config.h | 5 +- Telegram/SourceFiles/history.cpp | 35 +++++-- Telegram/SourceFiles/history.h | 4 +- Telegram/SourceFiles/historywidget.cpp | 2 +- Telegram/SourceFiles/mainwidget.cpp | 25 ++--- Telegram/SourceFiles/mainwidget.h | 1 + Telegram/Telegram.plist | 2 +- Telegram/Telegram.rc | Bin 5532 -> 5532 bytes Telegram/Telegram.xcodeproj/project.pbxproj | 12 +-- Telegram/Version | 6 +- 18 files changed, 66 insertions(+), 377 deletions(-) delete mode 100755 Telegram/DeployLinux.sh delete mode 100755 Telegram/DeployLinux32.sh delete mode 100755 Telegram/DeployMacWin.sh delete mode 100755 Telegram/PrepareLinux.sh delete mode 100755 Telegram/PrepareLinux32.sh delete mode 100755 Telegram/PrepareMac.sh diff --git a/Telegram/DeployLinux.sh b/Telegram/DeployLinux.sh deleted file mode 100755 index 32de84189b..0000000000 --- a/Telegram/DeployLinux.sh +++ /dev/null @@ -1,24 +0,0 @@ -while IFS='' read -r line || [[ -n "$line" ]]; do - set $line - eval $1="$2" -done < Version - -AppVersionStrFull="$AppVersionStr" -DevParam='' -if [ "$DevChannel" != "0" ]; then - AppVersionStrFull="$AppVersionStr.dev" - DevParam='-dev' -fi - -if [ ! -f "./../Linux/Release/deploy/$AppVersionStrMajor/$AppVersionStrFull/tlinuxupd$AppVersion" ]; then - echo "tlinuxupd$AppVersion not found!"; - exit 1 -fi - -if [ ! -f "./../Linux/Release/deploy/$AppVersionStrMajor/$AppVersionStrFull/tsetup.$AppVersionStrFull.tar.xz" ]; then - echo "tsetup.$AppVersionStrFull.tar.xz not found!" - exit 1 -fi - -scp ./../Linux/Release/deploy/$AppVersionStrMajor/$AppVersionStrFull/tlinuxupd$AppVersion tmaster:tdesktop/www/tlinux/ -scp ./../Linux/Release/deploy/$AppVersionStrMajor/$AppVersionStrFull/tsetup.$AppVersionStrFull.tar.xz tmaster:tdesktop/www/tlinux/ diff --git a/Telegram/DeployLinux32.sh b/Telegram/DeployLinux32.sh deleted file mode 100755 index 398074bbe8..0000000000 --- a/Telegram/DeployLinux32.sh +++ /dev/null @@ -1,25 +0,0 @@ -while IFS='' read -r line || [[ -n "$line" ]]; do - set $line - eval $1="$2" -done < Version - -AppVersionStrFull="$AppVersionStr" -DevParam='' -if [ "$DevChannel" != "0" ]; then - AppVersionStrFull="$AppVersionStr.dev" - DevParam='-dev' -fi - -if [ ! -f "./../Linux/Release/deploy/$AppVersionStrMajor/$AppVersionStrFull/tlinux32upd$AppVersion" ]; then - echo "tlinux32upd$AppVersion not found!" - exit 1 -fi - -if [ ! -f "./../Linux/Release/deploy/$AppVersionStrMajor/$AppVersionStrFull/tsetup32.$AppVersionStrFull.tar.xz" ]; then - echo "tsetup32.$AppVersionStrFull.zip not found!" - exit 1 -fi - -scp ./../Linux/Release/deploy/$AppVersionStrMajor/$AppVersionStrFull/tlinux32upd$AppVersion tmaster:tdesktop/www/tlinux32/ -scp ./../Linux/Release/deploy/$AppVersionStrMajor/$AppVersionStrFull/tsetup32.$AppVersionStrFull.tar.xz tmaster:tdesktop/www/tlinux32/ - diff --git a/Telegram/DeployMacWin.sh b/Telegram/DeployMacWin.sh deleted file mode 100755 index 3e7b32c871..0000000000 --- a/Telegram/DeployMacWin.sh +++ /dev/null @@ -1,68 +0,0 @@ -while IFS='' read -r line || [[ -n "$line" ]]; do - set $line - eval $1="$2" -done < Version - -AppVersionStrFull="$AppVersionStr" -DevParam='' -if [ "$DevChannel" != "0" ]; then - AppVersionStrFull="$AppVersionStr.dev" - DevParam='-dev' -fi - -if [ ! -f "./../Mac/Release/deploy/$AppVersionStrMajor/$AppVersionStrFull/tmacupd$AppVersion" ]; then - echo "tmacupd$AppVersion not found!" - exit 1 -fi - -if [ ! -f "./../Mac/Release/deploy/$AppVersionStrMajor/$AppVersionStrFull/tsetup.$AppVersionStrFull.dmg" ]; then - echo "tsetup.$AppVersionStrFull.dmg not found!" - exit 1 -fi - -if [ ! -f "./../../tother/tmac32/$AppVersionStrMajor/$AppVersionStrFull/tmac32upd$AppVersion" ]; then - echo "tmac32upd$AppVersion not found!" - exit 1 -fi - -if [ ! -f "./../../tother/tmac32/$AppVersionStrMajor/$AppVersionStrFull/tsetup32.$AppVersionStrFull.dmg" ]; then - echo "tsetup32.$AppVersionStrFull.dmg not found!" - exit 1 -fi - -if [ ! -f "./../../tother/tsetup/$AppVersionStrMajor/$AppVersionStrFull/tupdate$AppVersion" ]; then - echo "tupdate$AppVersion not found!" - exit 1 -fi - -if [ ! -f "./../../tother/tsetup/$AppVersionStrMajor/$AppVersionStrFull/tportable.$AppVersionStrFull.zip" ]; then - echo "tportable.$AppVersionStrFull.zip not found!" - exit 1 -fi - -if [ ! -f "./../../tother/tsetup/$AppVersionStrMajor/$AppVersionStrFull/tsetup.$AppVersionStrFull.exe" ]; then - echo "tsetup.$AppVersionStrFull.exe not found!" - exit 1 -fi - -if [ ! -d "./../../../Dropbox/Telegram/deploy/$AppVersionStrMajor" ]; then - mkdir "./../../../Dropbox/Telegram/deploy/$AppVersionStrMajor" -fi - -scp ./../Mac/Release/deploy/$AppVersionStrMajor/$AppVersionStrFull/tmacupd$AppVersion tmaster:tdesktop/www/tmac/ -scp ./../Mac/Release/deploy/$AppVersionStrMajor/$AppVersionStrFull/tsetup.$AppVersionStrFull.dmg tmaster:tdesktop/www/tmac/ -scp ./../../tother/tmac32/$AppVersionStrMajor/$AppVersionStrFull/tmac32upd$AppVersion tmaster:tdesktop/www/tmac32/ -scp ./../../tother/tmac32/$AppVersionStrMajor/$AppVersionStrFull/tsetup32.$AppVersionStrFull.dmg tmaster:tdesktop/www/tmac32/ -scp ./../../tother/tsetup/$AppVersionStrMajor/$AppVersionStrFull/tupdate$AppVersion tmaster:tdesktop/www/tsetup/ -scp ./../../tother/tsetup/$AppVersionStrMajor/$AppVersionStrFull/tportable.$AppVersionStrFull.zip tmaster:tdesktop/www/tsetup/ -scp ./../../tother/tsetup/$AppVersionStrMajor/$AppVersionStrFull/tsetup.$AppVersionStrFull.exe tmaster:tdesktop/www/tsetup/ - -mv -v ./../../tother/tsetup/$AppVersionStrMajor/$AppVersionStrFull ./../../../Dropbox/Telegram/deploy/$AppVersionStrMajor/ - -cp -v ./../Mac/Release/deploy/$AppVersionStrMajor/$AppVersionStrFull/tmacupd$AppVersion ./../../../Dropbox/Telegram/deploy/$AppVersionStrMajor/$AppVersionStrFull/ -cp -v ./../Mac/Release/deploy/$AppVersionStrMajor/$AppVersionStrFull/tsetup.$AppVersionStrFull.dmg ./../../../Dropbox/Telegram/deploy/$AppVersionStrMajor/$AppVersionStrFull/ -cp -rv ./../Mac/Release/deploy/$AppVersionStrMajor/$AppVersionStrFull/Telegram.app.dSYM ./../../../Dropbox/Telegram/deploy/$AppVersionStrMajor/$AppVersionStrFull/ -cp -v ./../../tother/tmac32/$AppVersionStrMajor/$AppVersionStrFull/tmac32upd$AppVersion ./../../../Dropbox/Telegram/deploy/$AppVersionStrMajor/$AppVersionStrFull/ -cp -v ./../../tother/tmac32/$AppVersionStrMajor/$AppVersionStrFull/tsetup32.$AppVersionStrFull.dmg ./../../../Dropbox/Telegram/deploy/$AppVersionStrMajor/$AppVersionStrFull/ -cp -rv ./../../tother/tmac32/$AppVersionStrMajor/$AppVersionStrFull/Telegram.app.dSYM ./../../../Dropbox/Telegram/deploy/$AppVersionStrMajor/$AppVersionStrFull/Telegram32.app.dSYM - diff --git a/Telegram/PrepareLinux.sh b/Telegram/PrepareLinux.sh deleted file mode 100755 index 4cef1bdaee..0000000000 --- a/Telegram/PrepareLinux.sh +++ /dev/null @@ -1,58 +0,0 @@ -while IFS='' read -r line || [[ -n "$line" ]]; do - set $line - eval $1="$2" -done < Version - -AppVersionStrFull="$AppVersionStr" -DevParam='' -if [ "$DevChannel" != "0" ]; then - AppVersionStrFull="$AppVersionStr.dev" - DevParam='-dev' -fi - -if [ -d "./../Linux/Release/deploy/$AppVersionStrMajor/$AppVersionStr.dev" ]; then - echo "Deploy folder for version $AppVersionStr.dev already exists!" - exit 1 -fi - -if [ -d "./../Linux/Release/deploy/$AppVersionStrMajor/$AppVersionStr" ]; then - echo "Deploy folder for version $AppVersionStr already exists!" - exit 1 -fi - -if [ -f "./../Linux/Release/tlinuxupd$AppVersion" ]; then - echo "Update file for version $AppVersion already exists!" - exit 1 -fi - -if [ ! -f "./../Linux/Release/Telegram" ]; then - echo "Telegram not found!" - exit 1 -fi - -if [ ! -f "./../Linux/Release/Updater" ]; then - echo "Updater not found!" - exit 1 -fi - -echo "Preparing version $AppVersionStrFull, executing Packer.." -cd ./../Linux/Release && ./Packer -path Telegram -path Updater -version $AppVersion $DevParam && cd ./../../Telegram -echo "Packer done!" - -if [ ! -d "./../Linux/Release/deploy" ]; then - mkdir "./../Linux/Release/deploy" -fi - -if [ ! -d "./../Linux/Release/deploy/$AppVersionStrMajor" ]; then - mkdir "./../Linux/Release/deploy/$AppVersionStrMajor" -fi - -echo "Copying Telegram, Updater and tlinuxupd$AppVersion to deploy/$AppVersionStrMajor/$AppVersionStrFull.."; -mkdir "./../Linux/Release/deploy/$AppVersionStrMajor/$AppVersionStrFull" -mkdir "./../Linux/Release/deploy/$AppVersionStrMajor/$AppVersionStrFull/Telegram" -mv ./../Linux/Release/Telegram ./../Linux/Release/deploy/$AppVersionStrMajor/$AppVersionStrFull/Telegram/ -mv ./../Linux/Release/Updater ./../Linux/Release/deploy/$AppVersionStrMajor/$AppVersionStrFull/Telegram/ -mv ./../Linux/Release/tlinuxupd$AppVersion ./../Linux/Release/deploy/$AppVersionStrMajor/$AppVersionStrFull/ -cd ./../Linux/Release/deploy/$AppVersionStrMajor/$AppVersionStrFull && tar -cJvf tsetup.$AppVersionStrFull.tar.xz Telegram/ && cd ./../../../../../Telegram -echo "Version $AppVersionStrFull prepared!"; - diff --git a/Telegram/PrepareLinux32.sh b/Telegram/PrepareLinux32.sh deleted file mode 100755 index c088d449fb..0000000000 --- a/Telegram/PrepareLinux32.sh +++ /dev/null @@ -1,58 +0,0 @@ -while IFS='' read -r line || [[ -n "$line" ]]; do - set $line - eval $1="$2" -done < Version - -AppVersionStrFull="$AppVersionStr" -DevParam='' -if [ "$DevChannel" != "0" ]; then - AppVersionStrFull="$AppVersionStr.dev" - DevParam='-dev' -fi - -if [ -d "./../Linux/Release/deploy/$AppVersionStrMajor/$AppVersionStr.dev" ]; then - echo "Deploy folder for version $AppVersionStr.dev already exists!" - exit 1 -fi - -if [ -d "./../Linux/Release/deploy/$AppVersionStrMajor/$AppVersionStr" ]; then - echo "Deploy folder for version $AppVersionStr already exists!" - exit 1 -fi - -if [ -f "./../Linux/Release/tlinux32upd$AppVersion" ]; then - echo "Update file for version $AppVersion already exists!" - exit 1 -fi - -if [ ! -f "./../Linux/Release/Telegram" ]; then - echo "Telegram not found!" - exit 1 -fi - -if [ ! -f "./../Linux/Release/Updater" ]; then - echo "Updater not found!" - exit 1 -fi - -echo "Preparing version $AppVersionStrFull, executing Packer.." -cd ./../Linux/Release && ./Packer -path Telegram -path Updater -version $AppVersion $DevParam && cd ./../../Telegram -echo "Packer done!" - -if [ ! -d "./../Linux/Release/deploy" ]; then - mkdir "./../Linux/Release/deploy" -fi - -if [ ! -d "./../Linux/Release/deploy/$AppVersionStrMajor" ]; then - mkdir "./../Linux/Release/deploy/$AppVersionStrMajor" -fi - -echo "Copying Telegram, Updater and tlinux32upd$AppVersion to deploy/$AppVersionStrMajor/$AppVersionStrFull.."; -mkdir "./../Linux/Release/deploy/$AppVersionStrMajor/$AppVersionStrFull" -mkdir "./../Linux/Release/deploy/$AppVersionStrMajor/$AppVersionStrFull/Telegram" -mv ./../Linux/Release/Telegram ./../Linux/Release/deploy/$AppVersionStrMajor/$AppVersionStrFull/Telegram/ -mv ./../Linux/Release/Updater ./../Linux/Release/deploy/$AppVersionStrMajor/$AppVersionStrFull/Telegram/ -mv ./../Linux/Release/tlinux32upd$AppVersion ./../Linux/Release/deploy/$AppVersionStrMajor/$AppVersionStrFull/ -cd ./../Linux/Release/deploy/$AppVersionStrMajor/$AppVersionStrFull && tar -cJvf tsetup32.$AppVersionStrFull.tar.xz Telegram/ && cd ./../../../../../Telegram -echo "Version $AppVersionStrFull prepared!"; - diff --git a/Telegram/PrepareMac.sh b/Telegram/PrepareMac.sh deleted file mode 100755 index e69d049048..0000000000 --- a/Telegram/PrepareMac.sh +++ /dev/null @@ -1,98 +0,0 @@ -while IFS='' read -r line || [[ -n "$line" ]]; do - set $line - eval $1="$2" -done < Version - -AppVersionStrFull="$AppVersionStr" -DevParam='' -if [ "$DevChannel" != "0" ]; then - AppVersionStrFull="$AppVersionStr.dev" - DevParam='-dev' -fi - -echo "" -echo "Preparing version $AppVersionStrFull.." -echo "" - -if [ -d "./../Mac/Release/deploy/$AppVersionStrMajor/$AppVersionStr.dev" ]; then - echo "Deploy folder for version $AppVersionStr.dev already exists!" - exit 1 -fi - -if [ -d "./../Mac/Release/deploy/$AppVersionStrMajor/$AppVersionStr" ]; then - echo "Deploy folder for version $AppVersionStr already exists!" - exit 1 -fi - -if [ -f "./../Mac/Release/tmacupd$AppVersion" ]; then - echo "Update file for version $AppVersion already exists!" - exit 1 -fi - -if [ ! -d "./../Mac/Release/Telegram.app" ]; then - echo "Telegram.app not found!" - exit 1 -fi - -if [ ! -d "./../Mac/Release/Telegram.app.dSYM" ]; then - echo "Telegram.app.dSYM not found!" - exit 1 -fi - -AppUUID=`dwarfdump -u "./../Mac/Release/Telegram.app/Contents/MacOS/Telegram" | awk -F " " '{print $2}'` -DsymUUID=`dwarfdump -u "./../Mac/Release/Telegram.app.dSYM" | awk -F " " '{print $2}'` -if [ "$AppUUID" != "$DsymUUID" ]; then - echo "UUID of binary '$AppUUID' and dSYM '$DsymUUID' differ!" - exit 1 -fi - -if [ ! -f "./../Mac/Release/Telegram.app/Contents/Resources/Icon.icns" ]; then - echo "Icon.icns not found in Resources!" - exit 1 -fi - -if [ ! -f "./../Mac/Release/Telegram.app/Contents/MacOS/Telegram" ]; then - echo "Telegram not found in MacOS!" - exit 1 -fi - -if [ ! -f "./../Mac/Release/Telegram.app/Contents/Frameworks/Updater" ]; then - echo "Updater not found in Frameworks!" - exit 1 -fi - -if [ ! -d "./../Mac/Release/Telegram.app/Contents/_CodeSignature" ]; then - echo "Telegram signature not found!" - exit 1 -fi - -cd ./../Mac/Release -temppath=`hdiutil attach -readwrite tsetup.dmg | awk -F "\t" 'END {print $3}'` -cp -R ./Telegram.app "$temppath/" -bless --folder "$temppath/" --openfolder "$temppath/" -hdiutil detach "$temppath" -hdiutil convert tsetup.dmg -format UDZO -imagekey zlib-level=9 -ov -o tsetup.$AppVersionStrFull.dmg -cd ./../../Telegram -cd ./../Mac/Release && ./Packer.app/Contents/MacOS/Packer -path Telegram.app -version $AppVersion $DevParam && cd ./../../Telegram - -if [ ! -d "./../Mac/Release/deploy" ]; then - mkdir "./../Mac/Release/deploy" -fi - -if [ ! -d "./../Mac/Release/deploy/$AppVersionStrMajor" ]; then - mkdir "./../Mac/Release/deploy/$AppVersionStrMajor" -fi - -echo "Copying Telegram.app and tmacupd$AppVersion to deploy/$AppVersionStrMajor/$AppVersionStr.."; -mkdir "./../Mac/Release/deploy/$AppVersionStrMajor/$AppVersionStrFull" -mkdir "./../Mac/Release/deploy/$AppVersionStrMajor/$AppVersionStrFull/Telegram" -cp -r ./../Mac/Release/Telegram.app ./../Mac/Release/deploy/$AppVersionStrMajor/$AppVersionStrFull/Telegram/ -mv ./../Mac/Release/Telegram.app.dSYM ./../Mac/Release/deploy/$AppVersionStrMajor/$AppVersionStrFull/ -rm ./../Mac/Release/Telegram.app/Contents/MacOS/Telegram -rm ./../Mac/Release/Telegram.app/Contents/Frameworks/Updater -rm -rf ./../Mac/Release/Telegram.app/Contents/_CodeSignature -mv ./../Mac/Release/tmacupd$AppVersion ./../Mac/Release/deploy/$AppVersionStrMajor/$AppVersionStrFull/ -mv ./../Mac/Release/tsetup.$AppVersionStrFull.dmg ./../Mac/Release/deploy/$AppVersionStrMajor/$AppVersionStrFull/tsetup.$AppVersionStrFull.dmg - -echo "Version $AppVersionStrFull prepared!"; - diff --git a/Telegram/SourceFiles/boxes/contactsbox.cpp b/Telegram/SourceFiles/boxes/contactsbox.cpp index 64ebb79b85..e92feff4f8 100644 --- a/Telegram/SourceFiles/boxes/contactsbox.cpp +++ b/Telegram/SourceFiles/boxes/contactsbox.cpp @@ -1357,16 +1357,7 @@ PeerData *chatOrChannelCreated(const MTPUpdates &updates, const QImage &photo) { switch (updates.type()) { case mtpc_updates: v = &updates.c_updates().vchats.c_vector().v; break; case mtpc_updatesCombined: v = &updates.c_updatesCombined().vchats.c_vector().v; break; - case mtpc_updateShort: { - } break; - case mtpc_updateShortMessage: { - } break; - case mtpc_updateShortChatMessage: { - } break; - case mtpc_updateShortSentMessage: { - } break; - case mtpc_updatesTooLong: { - } break; + default: LOG(("API Error: unexpected update cons %1 (chatOrChannelCreated)").arg(updates.type())); break; } if (v && !v->isEmpty() && v->front().type() == mtpc_chat) { ChatData *chat = App::chat(v->front().c_chat().vid.v); @@ -1871,6 +1862,8 @@ _addBox(0) { connect(&_inner, SIGNAL(mustScrollTo(int, int)), &_scroll, SLOT(scrollToY(int, int))); connect(&_inner, SIGNAL(loaded()), this, SLOT(onLoaded())); + connect(&_loadTimer, SIGNAL(timeout()), &_inner, SLOT(load())); + prepare(); } @@ -1933,7 +1926,7 @@ void MembersBox::onAdminAdded() { if (!_addBox) return; _addBox->onClose(); _addBox = 0; - _inner.load(); + _loadTimer.start(ReloadChannelMembersTimeout); } void MembersBox::hideAll() { diff --git a/Telegram/SourceFiles/boxes/contactsbox.h b/Telegram/SourceFiles/boxes/contactsbox.h index b885844fbc..add3c8303b 100644 --- a/Telegram/SourceFiles/boxes/contactsbox.h +++ b/Telegram/SourceFiles/boxes/contactsbox.h @@ -270,7 +270,6 @@ public: ChannelData *channel() const; MembersFilter filter() const; - void load(); bool isLoaded() const { return !_loading; } @@ -287,6 +286,8 @@ signals: public slots: + void load(); + void updateSel(); void peerUpdated(PeerData *peer); void onPeerNameChanged(PeerData *peer, const PeerData::Names &oldNames, const PeerData::NameFirstChars &oldChars); @@ -386,6 +387,8 @@ private: FlatButton _add, _done; ContactsBox *_addBox; + + SingleTimer _loadTimer; }; class NewGroupBox : public AbstractBox { diff --git a/Telegram/SourceFiles/config.h b/Telegram/SourceFiles/config.h index 8097de65dd..84aa76f2ee 100644 --- a/Telegram/SourceFiles/config.h +++ b/Telegram/SourceFiles/config.h @@ -17,8 +17,8 @@ Copyright (c) 2014 John Preston, https://desktop.telegram.org */ #pragma once -static const int32 AppVersion = 9001; -static const wchar_t *AppVersionStr = L"0.9.1"; +static const int32 AppVersion = 9002; +static const wchar_t *AppVersionStr = L"0.9.2"; static const bool DevVersion = false; static const wchar_t *AppNameOld = L"Telegram Win (Unofficial)"; @@ -147,6 +147,7 @@ enum { SessionsShortPollTimeout = 60000, ChoosePeerByDragTimeout = 1000, // 1 second mouse not moved to choose dialog when dragging a file + ReloadChannelMembersTimeout = 1000, // 1 second wait before reload members in channel after adding }; inline bool isNotificationsUser(uint64 id) { diff --git a/Telegram/SourceFiles/history.cpp b/Telegram/SourceFiles/history.cpp index e85f4ba36b..96e9dd138e 100644 --- a/Telegram/SourceFiles/history.cpp +++ b/Telegram/SourceFiles/history.cpp @@ -687,7 +687,7 @@ HistoryJoined *ChannelHistory::insertJoinedMessage(bool unread) { if (lastSeenDateItem && lastSeenDateItem->date.date() == inviteDate.date()) { lastSeenDateItem->destroy(); } - if (!lastMsgDate.isNull() && inviteDate >= lastMsgDate) { + if (lastMsgDate.isNull() || inviteDate >= lastMsgDate) { setLastMessage(_joinedMessage); if (unread) { newItemAdded(_joinedMessage); @@ -771,11 +771,11 @@ HistoryJoined *ChannelHistory::insertJoinedMessage(bool unread) { return _joinedMessage; } -void ChannelHistory::checkJoinedMessage() { +void ChannelHistory::checkJoinedMessage(bool createUnread) { if (_joinedMessage || peer->asChannel()->inviter <= 0) return; if (isEmpty()) { if (loadedAtTop() && loadedAtBottom()) { - if (insertJoinedMessage(false)) { + if (insertJoinedMessage(createUnread)) { setLastMessage(_joinedMessage); } return; @@ -813,7 +813,8 @@ void ChannelHistory::checkJoinedMessage() { } if (!firstDate.isNull() && !lastDate.isNull() && (firstDate <= inviteDate || loadedAtTop()) && (lastDate > inviteDate || loadedAtBottom())) { - if (insertJoinedMessage(false) && inviteDate >= lastDate) { + bool willBeLastMsg = (inviteDate >= lastDate); + if (insertJoinedMessage(createUnread && willBeLastMsg) && willBeLastMsg) { setLastMessage(_joinedMessage); } } @@ -857,7 +858,13 @@ HistoryItem *ChannelHistory::addNewToBlocks(const MTPMessage &msg, NewMessageTyp if (item && isImportant) { setLastMessage(item); if (type == NewMessageUnread) { - newItemAdded(item); + if (item->unread()) { + newItemAdded(item); + } else if (item->out()) { + outboxRead(item); + } else { + inboxRead(item); + } } } return item; @@ -1534,7 +1541,13 @@ HistoryItem *History::addNewMessage(const MTPMessage &msg, NewMessageType type) if (item) { setLastMessage(item); if (type == NewMessageUnread) { - newItemAdded(item); + if (item->unread()) { + newItemAdded(item); + } else if (item->out()) { + outboxRead(item); + } else { + inboxRead(item); + } } } return item; @@ -1640,7 +1653,13 @@ HistoryItem *History::addNewItem(HistoryBlock *to, bool newBlock, HistoryItem *a height += dh; } if (newMsg) { - newItemAdded(adding); + if (adding->unread()) { + newItemAdded(adding); + } else if (adding->out()) { + outboxRead(adding); + } else { + inboxRead(adding); + } } if (!isChannel() || adding->fromChannel()) { @@ -2105,6 +2124,7 @@ void History::updateShowFrom() { } MsgId History::inboxRead(MsgId upTo) { + if (upTo < 0) return upTo; if (unreadCount) { if (upTo && loadedAtBottom()) App::main()->historyToDown(this); setUnreadCount(upTo ? countUnread(upTo) : 0); @@ -2128,6 +2148,7 @@ MsgId History::inboxRead(HistoryItem *wasRead) { } MsgId History::outboxRead(int32 upTo) { + if (upTo < 0) return upTo; if (!upTo) upTo = msgIdForRead(); if (outboxReadBefore < upTo + 1) outboxReadBefore = upTo + 1; diff --git a/Telegram/SourceFiles/history.h b/Telegram/SourceFiles/history.h index 4d367734d9..cca5e9eea3 100644 --- a/Telegram/SourceFiles/history.h +++ b/Telegram/SourceFiles/history.h @@ -390,7 +390,7 @@ public: } HistoryJoined *insertJoinedMessage(bool unread); - void checkJoinedMessage(); + void checkJoinedMessage(bool createUnread = false); const QDateTime &maxReadMessageDate(); private: @@ -827,7 +827,7 @@ public: } bool unread() const { if ((out() && (id > 0 && id < _history->outboxReadBefore)) || (!out() && id > 0 && id < _history->inboxReadBefore)) return false; - return (id > 0 && !out()) ? true : (_flags & MTPDmessage_flag_unread); + return (id > 0 && !out() && channelId() != NoChannel) ? true : (_flags & MTPDmessage_flag_unread); } bool notifyByFrom() const { return _flags & MTPDmessage_flag_notify_by_from; diff --git a/Telegram/SourceFiles/historywidget.cpp b/Telegram/SourceFiles/historywidget.cpp index 8b0bec7b11..01d424df05 100644 --- a/Telegram/SourceFiles/historywidget.cpp +++ b/Telegram/SourceFiles/historywidget.cpp @@ -4232,7 +4232,7 @@ void HistoryWidget::sendBotCommand(const QString &cmd, MsgId replyTo) { // reply toSend += '@' + username; } - App::main()->sendPreparedText(_history, toSend, false, replyTo ? ((!_peer->isUser()/* && (botStatus == 0 || botStatus == 2)*/) ? replyTo : -1) : 0); + App::main()->sendPreparedText(_history, toSend, replyTo ? ((!_peer->isUser()/* && (botStatus == 0 || botStatus == 2)*/) ? replyTo : -1) : 0, false); if (replyTo) { cancelReply(); if (_keyboard.singleUse() && _keyboard.hasMarkup() && lastKeyboardUsed) { diff --git a/Telegram/SourceFiles/mainwidget.cpp b/Telegram/SourceFiles/mainwidget.cpp index b9763d8bea..3be54d658e 100644 --- a/Telegram/SourceFiles/mainwidget.cpp +++ b/Telegram/SourceFiles/mainwidget.cpp @@ -504,6 +504,10 @@ void MainWidget::updateForwardingTexts() { QVector fromUsers; fromUsers.reserve(_toForward.size()); for (SelectedItemSet::const_iterator i = _toForward.cbegin(), e = _toForward.cend(); i != e; ++i) { + PeerData *from = i.value()->from(); + if (HistoryForwarded *fwd = i.value()->toHistoryForwarded()) { + from = fwd->fromForwarded(); + } if (!fromUsersMap.contains(i.value()->from())) { fromUsersMap.insert(i.value()->from(), true); fromUsers.push_back(i.value()->from()); @@ -2645,7 +2649,13 @@ void MainWidget::sentUpdatesReceived(uint64 randomId, const MTPUpdates &result) void MainWidget::inviteToChannelDone(ChannelData *channel, const MTPUpdates &updates) { sentUpdatesReceived(updates); - channel->updateFull(true); + QTimer::singleShot(ReloadChannelMembersTimeout, this, SLOT(onActiveChannelUpdateFull())); +} + +void MainWidget::onActiveChannelUpdateFull() { + if (activePeer() && activePeer()->isChannel()) { + activePeer()->asChannel()->updateFull(true); + } } void MainWidget::msgUpdated(PeerId peer, const HistoryItem *msg) { @@ -3549,7 +3559,7 @@ void MainWidget::onSelfParticipantUpdated(ChannelData *channel) { if ((h ? h : App::history(channel->id))->isEmpty()) { checkPeerHistory(channel); } else { - h->asChannelHistory()->checkJoinedMessage(); + h->asChannelHistory()->checkJoinedMessage(true); history.peerMessagesUpdated(channel->id); } } else if (h) { @@ -3654,16 +3664,7 @@ void MainWidget::inviteImportDone(const MTPUpdates &updates) { switch (updates.type()) { case mtpc_updates: v = &updates.c_updates().vchats.c_vector().v; break; case mtpc_updatesCombined: v = &updates.c_updatesCombined().vchats.c_vector().v; break; - case mtpc_updateShort: { - } break; - case mtpc_updateShortMessage: { - } break; - case mtpc_updateShortChatMessage: { - } break; - case mtpc_updateShortSentMessage: { - } break; - case mtpc_updatesTooLong: { - } break; + default: LOG(("API Error: unexpected update cons %1 (MainWidget::inviteImportDone)").arg(updates.type())); break; } if (v && !v->isEmpty()) { if (v->front().type() == mtpc_chat) { diff --git a/Telegram/SourceFiles/mainwidget.h b/Telegram/SourceFiles/mainwidget.h index 35b58eeb3a..009dc42fbf 100644 --- a/Telegram/SourceFiles/mainwidget.h +++ b/Telegram/SourceFiles/mainwidget.h @@ -468,6 +468,7 @@ public slots: void onFullPeerUpdated(PeerData *peer); void onViewsIncrement(); + void onActiveChannelUpdateFull(); private: diff --git a/Telegram/Telegram.plist b/Telegram/Telegram.plist index a0122ea01d..ada7a92d3a 100644 --- a/Telegram/Telegram.plist +++ b/Telegram/Telegram.plist @@ -11,7 +11,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.9.1 + 0.9.2 LSMinimumSystemVersion $(MACOSX_DEPLOYMENT_TARGET) CFBundleSignature diff --git a/Telegram/Telegram.rc b/Telegram/Telegram.rc index 026f398c4fc811bb09acf4549de4387b742d98b3..379ade837d7289a0285ac6ac35675b91d5698644 100644 GIT binary patch delta 50 zcmbQEJx6;(0WYJ`