Pass reply info to Window::PeerMenu.

This commit is contained in:
John Preston 2020-11-11 23:47:40 +03:00
parent 4f22171dd6
commit 4a8b59b788
17 changed files with 236 additions and 197 deletions

View file

@ -1817,20 +1817,21 @@ void InnerWidget::contextMenuEvent(QContextMenuEvent *e) {
} else if (const auto history = row.key.history()) { } else if (const auto history = row.key.history()) {
Window::FillPeerMenu( Window::FillPeerMenu(
_controller, _controller,
history->peer, Window::PeerMenuRequest{
_filterId, .peer = history->peer,
.source = Window::PeerMenuRequest::Source::ChatsList,
.filterId = _filterId,
},
[&](const QString &text, Fn<void()> callback) { [&](const QString &text, Fn<void()> callback) {
return _menu->addAction(text, std::move(callback)); return _menu->addAction(text, std::move(callback));
}, });
Window::PeerMenuSource::ChatsList);
} else if (const auto folder = row.key.folder()) { } else if (const auto folder = row.key.folder()) {
Window::FillFolderMenu( Window::FillFolderMenu(
_controller, _controller,
folder, Window::FolderMenuRequest{ folder },
[&](const QString &text, Fn<void()> callback) { [&](const QString &text, Fn<void()> callback) {
return _menu->addAction(text, std::move(callback)); return _menu->addAction(text, std::move(callback));
}, });
Window::PeerMenuSource::ChatsList);
} }
connect(_menu.get(), &QObject::destroyed, [=] { connect(_menu.get(), &QObject::destroyed, [=] {
if (_menuRow.key) { if (_menuRow.key) {

View file

@ -523,8 +523,10 @@ void Widget::refreshFolderTopBar() {
updateControlsGeometry(); updateControlsGeometry();
} }
_folderTopBar->setActiveChat( _folderTopBar->setActiveChat(
_openedFolder, HistoryView::TopBarWidget::ActiveChat{
HistoryView::TopBarWidget::Section::History, .key = _openedFolder,
.section = HistoryView::TopBarWidget::Section::Dialogs,
},
nullptr); nullptr);
} else { } else {
_folderTopBar.destroy(); _folderTopBar.destroy();

View file

@ -171,7 +171,13 @@ void activateBotCommand(
} }
} }
if (const auto m = CheckMainWidget(&msg->history()->session())) { if (const auto m = CheckMainWidget(&msg->history()->session())) {
Window::PeerMenuCreatePoll(m->controller(), msg->history()->peer, chosen, disabled); const auto replyToId = MsgId(0);
Window::PeerMenuCreatePoll(
m->controller(),
msg->history()->peer,
replyToId,
chosen,
disabled);
} }
} break; } break;

View file

@ -707,6 +707,16 @@ void HistoryWidget::setGeometryWithTopMoved(
_topDelta = 0; _topDelta = 0;
} }
void HistoryWidget::refreshTopBarActiveChat() {
_topBar->setActiveChat(
HistoryView::TopBarWidget::ActiveChat{
.key = _history,
.section = HistoryView::TopBarWidget::Section::History,
.currentReplyToId = replyToId(),
},
_history->sendActionPainter());
}
void HistoryWidget::refreshTabbedPanel() { void HistoryWidget::refreshTabbedPanel() {
if (_peer && controller()->hasTabbedSelectorOwnership()) { if (_peer && controller()->hasTabbedSelectorOwnership()) {
createTabbedPanel(); createTabbedPanel();
@ -1588,6 +1598,7 @@ void HistoryWidget::applyDraft(FieldHistoryAction fieldHistoryAction) {
updateControlsVisibility(); updateControlsVisibility();
updateControlsGeometry(); updateControlsGeometry();
} }
refreshTopBarActiveChat();
return; return;
} }
@ -1607,7 +1618,7 @@ void HistoryWidget::applyDraft(FieldHistoryAction fieldHistoryAction) {
} }
updateControlsVisibility(); updateControlsVisibility();
updateControlsGeometry(); updateControlsGeometry();
refreshTopBarActiveChat();
if (_editMsgId || _replyToId) { if (_editMsgId || _replyToId) {
updateReplyEditTexts(); updateReplyEditTexts();
if (!_replyEditMsg) { if (!_replyEditMsg) {
@ -1825,10 +1836,7 @@ void HistoryWidget::showHistory(
} }
_history->setFakeUnreadWhileOpened(true); _history->setFakeUnreadWhileOpened(true);
_topBar->setActiveChat( refreshTopBarActiveChat();
_history,
HistoryView::TopBarWidget::Section::History,
_history->sendActionPainter());
updateTopBarSelection(); updateTopBarSelection();
if (_channel) { if (_channel) {
@ -1915,10 +1923,7 @@ void HistoryWidget::showHistory(
unreadCountUpdated(); // set _historyDown badge. unreadCountUpdated(); // set _historyDown badge.
showAboutTopPromotion(); showAboutTopPromotion();
} else { } else {
_topBar->setActiveChat( refreshTopBarActiveChat();
Dialogs::Key(),
HistoryView::TopBarWidget::Section::History,
nullptr);
updateTopBarSelection(); updateTopBarSelection();
clearFieldText(); clearFieldText();
@ -4763,6 +4768,7 @@ void HistoryWidget::updateBotKeyboard(History *h, bool force) {
updateMouseTracking(); updateMouseTracking();
} }
} }
refreshTopBarActiveChat();
updateControlsGeometry(); updateControlsGeometry();
update(); update();
} }
@ -5479,6 +5485,7 @@ void HistoryWidget::replyToMessage(not_null<HistoryItem*> item) {
updateReplyToName(); updateReplyToName();
updateControlsGeometry(); updateControlsGeometry();
updateField(); updateField();
refreshTopBarActiveChat();
} }
_saveDraftText = true; _saveDraftText = true;
@ -5605,7 +5612,7 @@ bool HistoryWidget::cancelReply(bool lastKeyboardUsed) {
} }
updateBotKeyboard(); updateBotKeyboard();
refreshTopBarActiveChat();
updateControlsGeometry(); updateControlsGeometry();
update(); update();
} else if (auto localDraft = (_history ? _history->localDraft() : nullptr)) { } else if (auto localDraft = (_history ? _history->localDraft() : nullptr)) {

View file

@ -353,6 +353,7 @@ private:
void createTabbedPanel(); void createTabbedPanel();
void setTabbedPanel(std::unique_ptr<TabbedPanel> panel); void setTabbedPanel(std::unique_ptr<TabbedPanel> panel);
void updateField(); void updateField();
void refreshTopBarActiveChat();
void requestMessageData(MsgId msgId); void requestMessageData(MsgId msgId);
void messageDataReceived(ChannelData *channel, MsgId msgId); void messageDataReceived(ChannelData *channel, MsgId msgId);

View file

@ -102,8 +102,10 @@ PinnedWidget::PinnedWidget(
st::historyComposeButton)) st::historyComposeButton))
, _scrollDown(_scroll.get(), st::historyToDown) { , _scrollDown(_scroll.get(), st::historyToDown) {
_topBar->setActiveChat( _topBar->setActiveChat(
_history, TopBarWidget::ActiveChat{
TopBarWidget::Section::Pinned, .key = _history,
.section = TopBarWidget::Section::Pinned,
},
nullptr); nullptr);
_topBar->move(0, 0); _topBar->move(0, 0);

View file

@ -167,10 +167,7 @@ RepliesWidget::RepliesWidget(
session().api().requestFullPeer(_history->peer); session().api().requestFullPeer(_history->peer);
_topBar->setActiveChat( refreshTopBarActiveChat();
_history,
TopBarWidget::Section::Replies,
_sendAction.get());
_topBar->move(0, 0); _topBar->move(0, 0);
_topBar->resizeToWidth(width()); _topBar->resizeToWidth(width());
@ -220,7 +217,7 @@ RepliesWidget::RepliesWidget(
_inner->replyToMessageRequested( _inner->replyToMessageRequested(
) | rpl::start_with_next([=](auto fullId) { ) | rpl::start_with_next([=](auto fullId) {
_composeControls->replyToMessage(fullId); replyToMessage(fullId);
}, _inner->lifetime()); }, _inner->lifetime());
_composeControls->sendActionUpdates( _composeControls->sendActionUpdates(
@ -714,6 +711,7 @@ void RepliesWidget::sendingFilesConfirmed(
} }
if (_composeControls->replyingToMessage().msg == replyTo) { if (_composeControls->replyingToMessage().msg == replyTo) {
_composeControls->cancelReplyMessage(); _composeControls->cancelReplyMessage();
refreshTopBarActiveChat();
} }
} }
@ -1138,6 +1136,17 @@ SendMenu::Type RepliesWidget::sendMenuType() const {
: SendMenu::Type::Scheduled; : SendMenu::Type::Scheduled;
} }
void RepliesWidget::refreshTopBarActiveChat() {
_topBar->setActiveChat(
TopBarWidget::ActiveChat{
.key = _history,
.section = TopBarWidget::Section::Replies,
.rootId = _rootId,
.currentReplyToId = replyToId(),
},
_sendAction.get());
}
MsgId RepliesWidget::replyToId() const { MsgId RepliesWidget::replyToId() const {
const auto custom = _composeControls->replyingToMessage().msg; const auto custom = _composeControls->replyingToMessage().msg;
return custom ? custom : _rootId; return custom ? custom : _rootId;
@ -1181,6 +1190,7 @@ void RepliesWidget::finishSending() {
//if (_previewData && _previewData->pendingTill) previewCancel(); //if (_previewData && _previewData->pendingTill) previewCancel();
doSetInnerFocus(); doSetInnerFocus();
showAtEnd(); showAtEnd();
refreshTopBarActiveChat();
} }
void RepliesWidget::showAtPosition( void RepliesWidget::showAtPosition(
@ -1394,13 +1404,13 @@ bool RepliesWidget::replyToMessage(not_null<HistoryItem*> item) {
if (item->history() != _history || item->replyToTop() != _rootId) { if (item->history() != _history || item->replyToTop() != _rootId) {
return false; return false;
} }
_composeControls->replyToMessage(item->fullId()); replyToMessage(item->fullId());
return true; return true;
} }
MsgId RepliesWidget::currentReplyToIdFor( void RepliesWidget::replyToMessage(FullMsgId itemId) {
not_null<History*> history) const { _composeControls->replyToMessage(itemId);
return (_history == history) ? replyToId() : 0; refreshTopBarActiveChat();
} }
void RepliesWidget::saveState(not_null<RepliesMemento*> memento) { void RepliesWidget::saveState(not_null<RepliesMemento*> memento) {
@ -1626,6 +1636,7 @@ void RepliesWidget::listCancelRequest() {
clearSelected(); clearSelected();
return; return;
} else if (_composeControls->handleCancelRequest()) { } else if (_composeControls->handleCancelRequest()) {
refreshTopBarActiveChat();
return; return;
} }
controller()->showBackFromStack(); controller()->showBackFromStack();

View file

@ -88,8 +88,6 @@ public:
const Window::SectionShow &params, const Window::SectionShow &params,
MsgId messageId) override; MsgId messageId) override;
bool replyToMessage(not_null<HistoryItem*> item) override; bool replyToMessage(not_null<HistoryItem*> item) override;
MsgId currentReplyToIdFor(
not_null<History*> history) const override;
void setInternalState( void setInternalState(
const QRect &geometry, const QRect &geometry,
@ -200,6 +198,8 @@ private:
void restoreReplyReturns(const std::vector<MsgId> &list); void restoreReplyReturns(const std::vector<MsgId> &list);
void checkReplyReturns(); void checkReplyReturns();
void recountChatWidth(); void recountChatWidth();
void replyToMessage(FullMsgId itemId);
void refreshTopBarActiveChat();
void uploadFile(const QByteArray &fileContent, SendMediaType type); void uploadFile(const QByteArray &fileContent, SendMediaType type);
bool confirmSendingFiles( bool confirmSendingFiles(

View file

@ -100,8 +100,10 @@ ScheduledWidget::ScheduledWidget(
ComposeControls::Mode::Scheduled)) ComposeControls::Mode::Scheduled))
, _scrollDown(_scroll, st::historyToDown) { , _scrollDown(_scroll, st::historyToDown) {
_topBar->setActiveChat( _topBar->setActiveChat(
_history, TopBarWidget::ActiveChat{
TopBarWidget::Section::Scheduled, .key = _history,
.section = TopBarWidget::Section::Scheduled,
},
nullptr); nullptr);
_topBar->move(0, 0); _topBar->move(0, 0);

View file

@ -115,7 +115,7 @@ TopBarWidget::TopBarWidget(
using AnimationUpdate = Data::Session::SendActionAnimationUpdate; using AnimationUpdate = Data::Session::SendActionAnimationUpdate;
session().data().sendActionAnimationUpdated( session().data().sendActionAnimationUpdated(
) | rpl::filter([=](const AnimationUpdate &update) { ) | rpl::filter([=](const AnimationUpdate &update) {
return (update.history == _activeChat.history()); return (update.history == _activeChat.key.history());
}) | rpl::start_with_next([=] { }) | rpl::start_with_next([=] {
update(); update();
}, lifetime()); }, lifetime());
@ -191,13 +191,13 @@ void TopBarWidget::refreshLang() {
} }
void TopBarWidget::onSearch() { void TopBarWidget::onSearch() {
if (_activeChat) { if (_activeChat.key) {
_controller->content()->searchInChat(_activeChat); _controller->content()->searchInChat(_activeChat.key);
} }
} }
void TopBarWidget::onCall() { void TopBarWidget::onCall() {
if (const auto peer = _activeChat.peer()) { if (const auto peer = _activeChat.key.peer()) {
if (const auto user = peer->asUser()) { if (const auto user = peer->asUser()) {
Core::App().calls().startOutgoingCall(user, false); Core::App().calls().startOutgoingCall(user, false);
} }
@ -205,7 +205,7 @@ void TopBarWidget::onCall() {
} }
void TopBarWidget::showMenu() { void TopBarWidget::showMenu() {
if (!_activeChat || _menu) { if (!_activeChat.key || _menu) {
return; return;
} }
_menu.create(parentWidget()); _menu.create(parentWidget());
@ -228,27 +228,31 @@ void TopBarWidget::showMenu() {
})); }));
_menuToggle->installEventFilter(_menu); _menuToggle->installEventFilter(_menu);
const auto addAction = [&]( const auto addAction = [&](
const QString & text, const QString &text,
Fn<void()> callback) { Fn<void()> callback) {
return _menu->addAction(text, std::move(callback)); return _menu->addAction(text, std::move(callback));
}; };
if (const auto peer = _activeChat.peer()) { if (const auto peer = _activeChat.key.peer()) {
using Source = Window::PeerMenuRequest::Source;
const auto source = (_activeChat.section == Section::Scheduled)
? Source::ScheduledSection
: (_activeChat.section == Section::Replies)
? Source::RepliesSection
: Source::History;
Window::FillPeerMenu( Window::FillPeerMenu(
_controller, _controller,
peer, Window::PeerMenuRequest{
FilterId(), .peer = peer,
addAction, .source = source,
(_section == Section::Scheduled .rootId = _activeChat.rootId,
? Window::PeerMenuSource::ScheduledSection .currentReplyToId = _activeChat.currentReplyToId,
: (_section == Section::Replies) },
? Window::PeerMenuSource::RepliesSection addAction);
: Window::PeerMenuSource::History)); } else if (const auto folder = _activeChat.key.folder()) {
} else if (const auto folder = _activeChat.folder()) {
Window::FillFolderMenu( Window::FillFolderMenu(
_controller, _controller,
folder, Window::FolderMenuRequest{ folder },
addAction, addAction);
Window::PeerMenuSource::History);
} else { } else {
Unexpected("Empty active chat in TopBarWidget::showMenu."); Unexpected("Empty active chat in TopBarWidget::showMenu.");
} }
@ -265,13 +269,13 @@ void TopBarWidget::toggleInfoSection() {
&& (Core::App().settings().thirdSectionInfoEnabled() && (Core::App().settings().thirdSectionInfoEnabled()
|| Core::App().settings().tabbedReplacedWithInfo())) { || Core::App().settings().tabbedReplacedWithInfo())) {
_controller->closeThirdSection(); _controller->closeThirdSection();
} else if (_activeChat.peer()) { } else if (_activeChat.key.peer()) {
if (_controller->canShowThirdSection()) { if (_controller->canShowThirdSection()) {
Core::App().settings().setThirdSectionInfoEnabled(true); Core::App().settings().setThirdSectionInfoEnabled(true);
Core::App().saveSettingsDelayed(); Core::App().saveSettingsDelayed();
if (Adaptive::ThreeColumn()) { if (Adaptive::ThreeColumn()) {
_controller->showSection( _controller->showSection(
Info::Memento::Default(_activeChat.peer()), Info::Memento::Default(_activeChat.key.peer()),
Window::SectionShow().withThirdColumn()); Window::SectionShow().withThirdColumn());
} else { } else {
_controller->resizeForThirdSection(); _controller->resizeForThirdSection();
@ -325,7 +329,7 @@ void TopBarWidget::paintEvent(QPaintEvent *e) {
} }
void TopBarWidget::paintTopBar(Painter &p) { void TopBarWidget::paintTopBar(Painter &p) {
if (!_activeChat) { if (!_activeChat.key) {
return; return;
} }
auto nameleft = _leftTaken; auto nameleft = _leftTaken;
@ -333,18 +337,18 @@ void TopBarWidget::paintTopBar(Painter &p) {
auto statustop = st::topBarHeight - st::topBarArrowPadding.bottom() - st::dialogsTextFont->height; auto statustop = st::topBarHeight - st::topBarArrowPadding.bottom() - st::dialogsTextFont->height;
auto availableWidth = width() - _rightTaken - nameleft; auto availableWidth = width() - _rightTaken - nameleft;
const auto history = _activeChat.history(); const auto history = _activeChat.key.history();
const auto folder = _activeChat.folder(); const auto folder = _activeChat.key.folder();
if (folder if (folder
|| history->peer->sharedMediaInfo() || history->peer->sharedMediaInfo()
|| (_section == Section::Scheduled) || (_activeChat.section == Section::Scheduled)
|| (_section == Section::Pinned)) { || (_activeChat.section == Section::Pinned)) {
// #TODO feed name emoji. // #TODO feed name emoji.
auto text = (_section == Section::Scheduled) auto text = (_activeChat.section == Section::Scheduled)
? ((history && history->peer->isSelf()) ? ((history && history->peer->isSelf())
? tr::lng_reminder_messages(tr::now) ? tr::lng_reminder_messages(tr::now)
: tr::lng_scheduled_messages(tr::now)) : tr::lng_scheduled_messages(tr::now))
: (_section == Section::Pinned) : (_activeChat.section == Section::Pinned)
? _customTitleText ? _customTitleText
: folder : folder
? folder->chatListName() ? folder->chatListName()
@ -362,7 +366,7 @@ void TopBarWidget::paintTopBar(Painter &p) {
(height() - st::historySavedFont->height) / 2, (height() - st::historySavedFont->height) / 2,
width(), width(),
text); text);
} else if (_section == Section::Replies) { } else if (_activeChat.section == Section::Replies) {
p.setPen(st::dialogsNameFg); p.setPen(st::dialogsNameFg);
p.setFont(st::semiboldFont); p.setFont(st::semiboldFont);
p.drawTextLeft( p.drawTextLeft(
@ -384,7 +388,7 @@ void TopBarWidget::paintTopBar(Painter &p) {
p.setPen(st::historyStatusFg); p.setPen(st::historyStatusFg);
p.drawTextLeft(nameleft, statustop, width(), _customTitleText); p.drawTextLeft(nameleft, statustop, width(), _customTitleText);
} }
} else if (const auto history = _activeChat.history()) { } else if (const auto history = _activeChat.key.history()) {
const auto peer = history->peer; const auto peer = history->peer;
const auto &text = peer->topBarNameText(); const auto &text = peer->topBarNameText();
const auto badgeStyle = Ui::PeerBadgeStyle{ const auto badgeStyle = Ui::PeerBadgeStyle{
@ -483,29 +487,30 @@ void TopBarWidget::mousePressEvent(QMouseEvent *e) {
} }
void TopBarWidget::infoClicked() { void TopBarWidget::infoClicked() {
if (!_activeChat) { const auto key = _activeChat.key;
if (!key) {
return; return;
} else if (_activeChat.folder()) { } else if (key.folder()) {
_controller->closeFolder(); _controller->closeFolder();
//} else if (const auto feed = _activeChat.feed()) { // #feed //} else if (const auto feed = _activeChat.feed()) { // #feed
// _controller->showSection(Info::Memento( // _controller->showSection(Info::Memento(
// feed, // feed,
// Info::Section(Info::Section::Type::Profile))); // Info::Section(Info::Section::Type::Profile)));
} else if (_activeChat.peer()->isSelf()) { } else if (key.peer()->isSelf()) {
_controller->showSection(Info::Memento( _controller->showSection(Info::Memento(
_activeChat.peer(), key.peer(),
Info::Section(Storage::SharedMediaType::Photo))); Info::Section(Storage::SharedMediaType::Photo)));
} else if (_activeChat.peer()->isRepliesChat()) { } else if (key.peer()->isRepliesChat()) {
_controller->showSection(Info::Memento( _controller->showSection(Info::Memento(
_activeChat.peer(), key.peer(),
Info::Section(Storage::SharedMediaType::Photo))); Info::Section(Storage::SharedMediaType::Photo)));
} else { } else {
_controller->showPeerInfo(_activeChat.peer()); _controller->showPeerInfo(key.peer());
} }
} }
void TopBarWidget::backClicked() { void TopBarWidget::backClicked() {
if (_activeChat.folder()) { if (_activeChat.key.folder()) {
_controller->closeFolder(); _controller->closeFolder();
} else { } else {
_controller->showBackFromStack(); _controller->showBackFromStack();
@ -513,14 +518,14 @@ void TopBarWidget::backClicked() {
} }
void TopBarWidget::setActiveChat( void TopBarWidget::setActiveChat(
Dialogs::Key chat, ActiveChat activeChat,
Section section,
SendActionPainter *sendAction) { SendActionPainter *sendAction) {
if (_activeChat == chat && _section == section) { if (_activeChat.key == activeChat.key
&& _activeChat.section == activeChat.section) {
_activeChat = activeChat;
return; return;
} }
_activeChat = chat; _activeChat = activeChat;
_section = section;
_sendAction = sendAction; _sendAction = sendAction;
_back->clearState(); _back->clearState();
update(); update();
@ -544,7 +549,7 @@ void TopBarWidget::setCustomTitle(const QString &title) {
} }
void TopBarWidget::refreshInfoButton() { void TopBarWidget::refreshInfoButton() {
if (const auto peer = _activeChat.peer()) { if (const auto peer = _activeChat.key.peer()) {
auto info = object_ptr<Ui::UserpicButton>( auto info = object_ptr<Ui::UserpicButton>(
this, this,
_controller, _controller,
@ -577,14 +582,14 @@ int TopBarWidget::countSelectedButtonsTop(float64 selectedShown) {
} }
void TopBarWidget::updateSearchVisibility() { void TopBarWidget::updateSearchVisibility() {
const auto historyMode = (_section == Section::History); const auto historyMode = (_activeChat.section == Section::History);
const auto smallDialogsColumn = _activeChat.folder() const auto smallDialogsColumn = _activeChat.key.folder()
&& (width() < _back->width() + _search->width()); && (width() < _back->width() + _search->width());
_search->setVisible(historyMode && !smallDialogsColumn); _search->setVisible(historyMode && !smallDialogsColumn);
} }
void TopBarWidget::updateControlsGeometry() { void TopBarWidget::updateControlsGeometry() {
if (!_activeChat) { if (!_activeChat.key) {
return; return;
} }
auto hasSelected = (_selectedCount > 0); auto hasSelected = (_selectedCount > 0);
@ -621,7 +626,7 @@ void TopBarWidget::updateControlsGeometry() {
if (_back->isHidden()) { if (_back->isHidden()) {
_leftTaken = st::topBarArrowPadding.right(); _leftTaken = st::topBarArrowPadding.right();
} else { } else {
const auto smallDialogsColumn = _activeChat.folder() const auto smallDialogsColumn = _activeChat.key.folder()
&& (width() < _back->width() + _search->width()); && (width() < _back->width() + _search->width());
_leftTaken = smallDialogsColumn ? (width() - _back->width()) / 2 : 0; _leftTaken = smallDialogsColumn ? (width() - _back->width()) / 2 : 0;
_back->moveToLeft(_leftTaken, otherButtonsTop); _back->moveToLeft(_leftTaken, otherButtonsTop);
@ -666,7 +671,7 @@ void TopBarWidget::setAnimatingMode(bool enabled) {
} }
void TopBarWidget::updateControlsVisibility() { void TopBarWidget::updateControlsVisibility() {
if (!_activeChat) { if (!_activeChat.key) {
return; return;
} else if (_animatingMode) { } else if (_animatingMode) {
hideChildren(); hideChildren();
@ -679,7 +684,7 @@ void TopBarWidget::updateControlsVisibility() {
auto backVisible = Adaptive::OneColumn() auto backVisible = Adaptive::OneColumn()
|| !_controller->content()->stackIsEmpty() || !_controller->content()->stackIsEmpty()
|| _activeChat.folder(); || _activeChat.key.folder();
_back->setVisible(backVisible); _back->setVisible(backVisible);
if (_info) { if (_info) {
_info->setVisible(Adaptive::OneColumn()); _info->setVisible(Adaptive::OneColumn());
@ -687,21 +692,22 @@ void TopBarWidget::updateControlsVisibility() {
if (_unreadBadge) { if (_unreadBadge) {
_unreadBadge->show(); _unreadBadge->show();
} }
const auto historyMode = (_section == Section::History); const auto section = _activeChat.section;
const auto hasPollsMenu = _activeChat.peer() const auto historyMode = (section == Section::History);
&& _activeChat.peer()->canSendPolls(); const auto hasPollsMenu = _activeChat.key.peer()
const auto hasMenu = !_activeChat.folder() && _activeChat.key.peer()->canSendPolls();
&& ((_section == Section::Scheduled || _section == Section::Replies) const auto hasMenu = !_activeChat.key.folder()
&& ((section == Section::Scheduled || section == Section::Replies)
? hasPollsMenu ? hasPollsMenu
: historyMode); : historyMode);
updateSearchVisibility(); updateSearchVisibility();
_menuToggle->setVisible(hasMenu); _menuToggle->setVisible(hasMenu);
_infoToggle->setVisible(historyMode _infoToggle->setVisible(historyMode
&& !_activeChat.folder() && !_activeChat.key.folder()
&& !Adaptive::OneColumn() && !Adaptive::OneColumn()
&& _controller->canShowThirdSection()); && _controller->canShowThirdSection());
const auto callsEnabled = [&] { const auto callsEnabled = [&] {
if (const auto peer = _activeChat.peer()) { if (const auto peer = _activeChat.key.peer()) {
if (const auto user = peer->asUser()) { if (const auto user = peer->asUser()) {
return session().serverConfig().phoneCallsEnabled.current() return session().serverConfig().phoneCallsEnabled.current()
&& user->hasCalls(); && user->hasCalls();
@ -719,7 +725,7 @@ void TopBarWidget::updateControlsVisibility() {
void TopBarWidget::updateMembersShowArea() { void TopBarWidget::updateMembersShowArea() {
const auto membersShowAreaNeeded = [&] { const auto membersShowAreaNeeded = [&] {
const auto peer = _activeChat.peer(); const auto peer = _activeChat.key.peer();
if ((_selectedCount > 0) || !peer) { if ((_selectedCount > 0) || !peer) {
return false; return false;
} else if (const auto chat = peer->asChat()) { } else if (const auto chat = peer->asChat()) {
@ -805,7 +811,7 @@ void TopBarWidget::updateAdaptiveLayout() {
} }
void TopBarWidget::refreshUnreadBadge() { void TopBarWidget::refreshUnreadBadge() {
if (!Adaptive::OneColumn() && !_activeChat.folder()) { if (!Adaptive::OneColumn() && !_activeChat.key.folder()) {
_unreadBadge.destroy(); _unreadBadge.destroy();
return; return;
} else if (_unreadBadge) { } else if (_unreadBadge) {
@ -834,8 +840,9 @@ void TopBarWidget::refreshUnreadBadge() {
void TopBarWidget::updateUnreadBadge() { void TopBarWidget::updateUnreadBadge() {
if (!_unreadBadge) return; if (!_unreadBadge) return;
const auto muted = session().data().unreadBadgeMutedIgnoreOne(_activeChat); const auto key = _activeChat.key;
const auto counter = session().data().unreadBadgeIgnoreOne(_activeChat); const auto muted = session().data().unreadBadgeMutedIgnoreOne(key);
const auto counter = session().data().unreadBadgeIgnoreOne(key);
const auto text = [&] { const auto text = [&] {
if (!counter) { if (!counter) {
return QString(); return QString();
@ -862,12 +869,15 @@ void TopBarWidget::updateInfoToggleActive() {
} }
void TopBarWidget::updateOnlineDisplay() { void TopBarWidget::updateOnlineDisplay() {
if (!_activeChat.peer()) return; const auto peer = _activeChat.key.peer();
if (!peer) {
return;
}
QString text; QString text;
const auto now = base::unixtime::now(); const auto now = base::unixtime::now();
bool titlePeerTextOnline = false; bool titlePeerTextOnline = false;
if (const auto user = _activeChat.peer()->asUser()) { if (const auto user = peer->asUser()) {
if (session().supportMode() if (session().supportMode()
&& !session().supportHelper().infoCurrent(user).text.empty()) { && !session().supportHelper().infoCurrent(user).text.empty()) {
text = QString::fromUtf8("\xe2\x9a\xa0\xef\xb8\x8f check info"); text = QString::fromUtf8("\xe2\x9a\xa0\xef\xb8\x8f check info");
@ -876,7 +886,7 @@ void TopBarWidget::updateOnlineDisplay() {
text = Data::OnlineText(user, now); text = Data::OnlineText(user, now);
titlePeerTextOnline = Data::OnlineTextActive(user, now); titlePeerTextOnline = Data::OnlineTextActive(user, now);
} }
} else if (const auto chat = _activeChat.peer()->asChat()) { } else if (const auto chat = peer->asChat()) {
if (!chat->amIn()) { if (!chat->amIn()) {
text = tr::lng_chat_status_unaccessible(tr::now); text = tr::lng_chat_status_unaccessible(tr::now);
} else if (chat->participants.empty()) { } else if (chat->participants.empty()) {
@ -907,7 +917,7 @@ void TopBarWidget::updateOnlineDisplay() {
text = tr::lng_group_status(tr::now); text = tr::lng_group_status(tr::now);
} }
} }
} else if (const auto channel = _activeChat.peer()->asChannel()) { } else if (const auto channel = peer->asChannel()) {
if (channel->isMegagroup() if (channel->isMegagroup()
&& (channel->membersCount() > 0) && (channel->membersCount() > 0)
&& (channel->membersCount() && (channel->membersCount()
@ -954,7 +964,10 @@ void TopBarWidget::updateOnlineDisplay() {
} }
void TopBarWidget::updateOnlineDisplayTimer() { void TopBarWidget::updateOnlineDisplayTimer() {
if (!_activeChat.peer()) return; const auto peer = _activeChat.key.peer();
if (!peer) {
return;
}
const auto now = base::unixtime::now(); const auto now = base::unixtime::now();
auto minTimeout = crl::time(86400); auto minTimeout = crl::time(86400);
@ -962,13 +975,13 @@ void TopBarWidget::updateOnlineDisplayTimer() {
auto hisTimeout = Data::OnlineChangeTimeout(user, now); auto hisTimeout = Data::OnlineChangeTimeout(user, now);
accumulate_min(minTimeout, hisTimeout); accumulate_min(minTimeout, hisTimeout);
}; };
if (const auto user = _activeChat.peer()->asUser()) { if (const auto user = peer->asUser()) {
handleUser(user); handleUser(user);
} else if (auto chat = _activeChat.peer()->asChat()) { } else if (const auto chat = peer->asChat()) {
for (const auto user : chat->participants) { for (const auto user : chat->participants) {
handleUser(user); handleUser(user);
} }
} else if (_activeChat.peer()->isChannel()) { } else if (peer->isChannel()) {
} }
updateOnlineDisplayIn(minTimeout); updateOnlineDisplayIn(minTimeout);
} }

View file

@ -45,10 +45,17 @@ public:
}; };
enum class Section { enum class Section {
History, History,
Dialogs, // For folder view in dialogs list.
Scheduled, Scheduled,
Pinned, Pinned,
Replies, Replies,
}; };
struct ActiveChat {
Dialogs::Key key;
Section section = Section::History;
MsgId rootId = 0;
MsgId currentReplyToId = 0;
};
TopBarWidget( TopBarWidget(
QWidget *parent, QWidget *parent,
@ -66,8 +73,7 @@ public:
void setAnimatingMode(bool enabled); void setAnimatingMode(bool enabled);
void setActiveChat( void setActiveChat(
Dialogs::Key chat, ActiveChat activeChat,
Section section,
SendActionPainter *sendAction); SendActionPainter *sendAction);
void setCustomTitle(const QString &title); void setCustomTitle(const QString &title);
@ -131,8 +137,7 @@ private:
void updateUnreadBadge(); void updateUnreadBadge();
const not_null<Window::SessionController*> _controller; const not_null<Window::SessionController*> _controller;
Dialogs::Key _activeChat; ActiveChat _activeChat;
Section _section = Section::History;
QString _customTitleText; QString _customTitleText;
int _selectedCount = 0; int _selectedCount = 0;

View file

@ -577,10 +577,11 @@ void WrapWidget::showTopBarMenu() {
if (const auto peer = key().peer()) { if (const auto peer = key().peer()) {
Window::FillPeerMenu( Window::FillPeerMenu(
_controller->parentController(), _controller->parentController(),
peer, Window::PeerMenuRequest{
FilterId(), .peer = peer,
addAction, .source = Window::PeerMenuRequest::Source::Profile,
Window::PeerMenuSource::Profile); },
addAction);
//} else if (const auto feed = key().feed()) { // #feed //} else if (const auto feed = key().feed()) { // #feed
// Window::FillFeedMenu( // Window::FillFeedMenu(
// _controller->parentController(), // _controller->parentController(),

View file

@ -819,17 +819,6 @@ crl::time MainWidget::highlightStartTime(not_null<const HistoryItem*> item) cons
return _history->highlightStartTime(item); return _history->highlightStartTime(item);
} }
MsgId MainWidget::currentReplyToIdFor(not_null<History*> history) const {
if (_mainSection) {
return _mainSection->currentReplyToIdFor(history);
} else if (_history->history() == history) {
return _history->replyToId();
} else if (const auto localDraft = history->localDraft()) {
return localDraft->msgId;
}
return 0;
}
void MainWidget::sendBotCommand( void MainWidget::sendBotCommand(
not_null<PeerData*> peer, not_null<PeerData*> peer,
UserData *bot, UserData *bot,

View file

@ -175,8 +175,6 @@ public:
// While HistoryInner is not HistoryView::ListWidget. // While HistoryInner is not HistoryView::ListWidget.
crl::time highlightStartTime(not_null<const HistoryItem*> item) const; crl::time highlightStartTime(not_null<const HistoryItem*> item) const;
MsgId currentReplyToIdFor(not_null<History*> history) const;
void sendBotCommand( void sendBotCommand(
not_null<PeerData*> peer, not_null<PeerData*> peer,
UserData *bot, UserData *bot,

View file

@ -128,10 +128,6 @@ public:
virtual bool replyToMessage(not_null<HistoryItem*> item) { virtual bool replyToMessage(not_null<HistoryItem*> item) {
return false; return false;
} }
[[nodiscard]] virtual MsgId currentReplyToIdFor(
not_null<History*> history) const {
return 0;
}
// Create a memento of that section to store it in the history stack. // Create a memento of that section to store it in the history stack.
// This method may modify the section ("take" heavy items). // This method may modify the section ("take" heavy items).

View file

@ -107,13 +107,13 @@ class Filler {
public: public:
Filler( Filler(
not_null<SessionController*> controller, not_null<SessionController*> controller,
not_null<PeerData*> peer, PeerMenuRequest request,
FilterId filterId, const PeerMenuCallback &addAction);
const PeerMenuCallback &addAction,
PeerMenuSource source);
void fill(); void fill();
private: private:
using Source = PeerMenuRequest::Source;
[[nodiscard]] bool showInfo(); [[nodiscard]] bool showInfo();
[[nodiscard]] bool showHidePromotion(); [[nodiscard]] bool showHidePromotion();
[[nodiscard]] bool showToggleArchived(); [[nodiscard]] bool showToggleArchived();
@ -132,10 +132,9 @@ private:
void addPollAction(not_null<PeerData*> peer); void addPollAction(not_null<PeerData*> peer);
not_null<SessionController*> _controller; not_null<SessionController*> _controller;
PeerMenuRequest _request;
not_null<PeerData*> _peer; not_null<PeerData*> _peer;
FilterId _filterId = 0;
const PeerMenuCallback &_addAction; const PeerMenuCallback &_addAction;
PeerMenuSource _source;
}; };
@ -143,9 +142,8 @@ class FolderFiller {
public: public:
FolderFiller( FolderFiller(
not_null<SessionController*> controller, not_null<SessionController*> controller,
not_null<Data::Folder*> folder, FolderMenuRequest request,
const PeerMenuCallback &addAction, const PeerMenuCallback &addAction);
PeerMenuSource source);
void fill(); void fill();
private: private:
@ -158,9 +156,9 @@ private:
//void addUngroup(); //void addUngroup();
not_null<SessionController*> _controller; not_null<SessionController*> _controller;
FolderMenuRequest _request;
not_null<Data::Folder*> _folder; not_null<Data::Folder*> _folder;
const PeerMenuCallback &_addAction; const PeerMenuCallback &_addAction;
PeerMenuSource _source;
}; };
@ -279,19 +277,16 @@ void TogglePinnedDialog(
Filler::Filler( Filler::Filler(
not_null<SessionController*> controller, not_null<SessionController*> controller,
not_null<PeerData*> peer, PeerMenuRequest request,
FilterId filterId, const PeerMenuCallback &addAction)
const PeerMenuCallback &addAction,
PeerMenuSource source)
: _controller(controller) : _controller(controller)
, _peer(peer) , _request(request)
, _filterId(filterId) , _peer(request.peer)
, _addAction(addAction) , _addAction(addAction) {
, _source(source) {
} }
bool Filler::showInfo() { bool Filler::showInfo() {
if (_source == PeerMenuSource::Profile if (_request.source == Source::Profile
|| _peer->isSelf() || _peer->isSelf()
|| _peer->isRepliesChat()) { || _peer->isRepliesChat()) {
return false; return false;
@ -307,7 +302,7 @@ bool Filler::showInfo() {
} }
bool Filler::showHidePromotion() { bool Filler::showHidePromotion() {
if (_source != PeerMenuSource::ChatsList) { if (_request.source != Source::ChatsList) {
return false; return false;
} }
const auto history = _peer->owner().historyLoaded(_peer); const auto history = _peer->owner().historyLoaded(_peer);
@ -317,7 +312,7 @@ bool Filler::showHidePromotion() {
} }
bool Filler::showToggleArchived() { bool Filler::showToggleArchived() {
if (_source != PeerMenuSource::ChatsList) { if (_request.source != Source::ChatsList) {
return false; return false;
} }
const auto history = _peer->owner().historyLoaded(_peer); const auto history = _peer->owner().historyLoaded(_peer);
@ -330,7 +325,7 @@ bool Filler::showToggleArchived() {
} }
bool Filler::showTogglePin() { bool Filler::showTogglePin() {
if (_source != PeerMenuSource::ChatsList) { if (_request.source != Source::ChatsList) {
return false; return false;
} }
const auto history = _peer->owner().historyLoaded(_peer); const auto history = _peer->owner().historyLoaded(_peer);
@ -349,7 +344,7 @@ void Filler::addHidePromotion() {
void Filler::addTogglePin() { void Filler::addTogglePin() {
const auto controller = _controller; const auto controller = _controller;
const auto filterId = _filterId; const auto filterId = _request.filterId;
const auto peer = _peer; const auto peer = _peer;
const auto history = peer->owner().history(peer); const auto history = peer->owner().history(peer);
const auto pinText = [=] { const auto pinText = [=] {
@ -479,7 +474,7 @@ void Filler::addBlockUser(not_null<UserData*> user) {
void Filler::addUserActions(not_null<UserData*> user) { void Filler::addUserActions(not_null<UserData*> user) {
const auto controller = _controller; const auto controller = _controller;
const auto window = &_controller->window(); const auto window = &_controller->window();
if (_source != PeerMenuSource::ChatsList) { if (_request.source != Source::ChatsList) {
if (user->session().supportMode()) { if (user->session().supportMode()) {
_addAction("Edit support info", [=] { _addAction("Edit support info", [=] {
user->session().supportHelper().editInfo(controller, user); user->session().supportHelper().editInfo(controller, user);
@ -527,13 +522,13 @@ void Filler::addUserActions(not_null<UserData*> user) {
if (!user->isInaccessible() if (!user->isInaccessible()
&& user != user->session().user() && user != user->session().user()
&& !user->isRepliesChat() && !user->isRepliesChat()
&& _source != PeerMenuSource::ChatsList) { && _request.source != Source::ChatsList) {
addBlockUser(user); addBlockUser(user);
} }
} }
void Filler::addChatActions(not_null<ChatData*> chat) { void Filler::addChatActions(not_null<ChatData*> chat) {
if (_source != PeerMenuSource::ChatsList) { if (_request.source != Source::ChatsList) {
const auto controller = _controller; const auto controller = _controller;
if (EditPeerInfoBox::Available(chat)) { if (EditPeerInfoBox::Available(chat)) {
const auto text = tr::lng_manage_group_title(tr::now); const auto text = tr::lng_manage_group_title(tr::now);
@ -573,7 +568,7 @@ void Filler::addChannelActions(not_null<ChannelData*> channel) {
// [=] { ToggleChannelGrouping(channel, !grouped); }); // [=] { ToggleChannelGrouping(channel, !grouped); });
// } // }
//} //}
if (_source != PeerMenuSource::ChatsList) { if (_request.source != Source::ChatsList) {
if (channel->isBroadcast()) { if (channel->isBroadcast()) {
if (const auto chat = channel->linkedChat()) { if (const auto chat = channel->linkedChat()) {
_addAction(tr::lng_profile_view_discussion(tr::now), [=] { _addAction(tr::lng_profile_view_discussion(tr::now), [=] {
@ -623,7 +618,7 @@ void Filler::addChannelActions(not_null<ChannelData*> channel) {
text, text,
[=] { channel->session().api().joinChannel(channel); }); [=] { channel->session().api().joinChannel(channel); });
} }
if (_source != PeerMenuSource::ChatsList) { if (_request.source != Source::ChatsList) {
const auto needReport = !channel->amCreator() const auto needReport = !channel->amCreator()
&& (!isGroup || channel->isPublic()); && (!isGroup || channel->isPublic());
if (needReport) { if (needReport) {
@ -639,19 +634,26 @@ void Filler::addPollAction(not_null<PeerData*> peer) {
return; return;
} }
const auto controller = _controller; const auto controller = _controller;
const auto source = (_source == PeerMenuSource::ScheduledSection) const auto source = (_request.source == Source::ScheduledSection)
? Api::SendType::Scheduled ? Api::SendType::Scheduled
: Api::SendType::Normal; : Api::SendType::Normal;
const auto flag = PollData::Flags(); const auto flag = PollData::Flags();
const auto replyToId = _request.currentReplyToId;
auto callback = [=] { auto callback = [=] {
PeerMenuCreatePoll(controller, peer, flag, flag, source); PeerMenuCreatePoll(
controller,
peer,
replyToId,
flag,
flag,
source);
}; };
_addAction(tr::lng_polls_create(tr::now), std::move(callback)); _addAction(tr::lng_polls_create(tr::now), std::move(callback));
} }
void Filler::fill() { void Filler::fill() {
if (_source == PeerMenuSource::ScheduledSection if (_request.source == Source::ScheduledSection
|| _source == PeerMenuSource::RepliesSection) { || _request.source == Source::RepliesSection) {
addPollAction(_peer); addPollAction(_peer);
return; return;
} }
@ -667,10 +669,10 @@ void Filler::fill() {
if (showInfo()) { if (showInfo()) {
addInfo(); addInfo();
} }
if (_source != PeerMenuSource::Profile && !_peer->isSelf()) { if (_request.source != Source::Profile && !_peer->isSelf()) {
PeerMenuAddMuteAction(_peer, _addAction); PeerMenuAddMuteAction(_peer, _addAction);
} }
if (_source == PeerMenuSource::ChatsList) { if (_request.source == Source::ChatsList) {
//addSearch(); //addSearch();
addToggleUnreadMark(); addToggleUnreadMark();
} }
@ -686,19 +688,16 @@ void Filler::fill() {
FolderFiller::FolderFiller( FolderFiller::FolderFiller(
not_null<SessionController*> controller, not_null<SessionController*> controller,
not_null<Data::Folder*> folder, FolderMenuRequest request,
const PeerMenuCallback &addAction, const PeerMenuCallback &addAction)
PeerMenuSource source)
: _controller(controller) : _controller(controller)
, _folder(folder) , _request(request)
, _addAction(addAction) , _folder(request.folder)
, _source(source) { , _addAction(addAction) {
} }
void FolderFiller::fill() { void FolderFiller::fill() {
if (_source == PeerMenuSource::ChatsList) { addTogglesForArchive();
addTogglesForArchive();
}
} }
void FolderFiller::addTogglesForArchive() { void FolderFiller::addTogglesForArchive() {
@ -838,6 +837,7 @@ void PeerMenuShareContactBox(
void PeerMenuCreatePoll( void PeerMenuCreatePoll(
not_null<Window::SessionController*> controller, not_null<Window::SessionController*> controller,
not_null<PeerData*> peer, not_null<PeerData*> peer,
MsgId replyToId,
PollData::Flags chosen, PollData::Flags chosen,
PollData::Flags disabled, PollData::Flags disabled,
Api::SendType sendType) { Api::SendType sendType) {
@ -859,9 +859,7 @@ void PeerMenuCreatePoll(
auto action = Api::SendAction(peer->owner().history(peer)); auto action = Api::SendAction(peer->owner().history(peer));
action.clearDraft = false; action.clearDraft = false;
action.options = result.options; action.options = result.options;
if (const auto id = controller->content()->currentReplyToIdFor(action.history)) { action.replyTo = replyToId;
action.replyTo = id;
}
if (const auto localDraft = action.history->localDraft()) { if (const auto localDraft = action.history->localDraft()) {
action.clearDraft = localDraft->textWithTags.text.isEmpty(); action.clearDraft = localDraft->textWithTags.text.isEmpty();
} }
@ -1314,20 +1312,17 @@ Fn<void()> DeleteAndLeaveHandler(not_null<PeerData*> peer) {
void FillPeerMenu( void FillPeerMenu(
not_null<SessionController*> controller, not_null<SessionController*> controller,
not_null<PeerData*> peer, PeerMenuRequest request,
FilterId filterId, const PeerMenuCallback &callback) {
const PeerMenuCallback &callback, Filler filler(controller, request, callback);
PeerMenuSource source) {
Filler filler(controller, peer, filterId, callback, source);
filler.fill(); filler.fill();
} }
void FillFolderMenu( void FillFolderMenu(
not_null<SessionController*> controller, not_null<SessionController*> controller,
not_null<Data::Folder*> folder, FolderMenuRequest request,
const PeerMenuCallback &callback, const PeerMenuCallback &callback) {
PeerMenuSource source) { FolderFiller filler(controller, request, callback);
FolderFiller filler(controller, folder, callback, source);
filler.fill(); filler.fill();
} }

View file

@ -32,12 +32,24 @@ class Controller;
class SessionController; class SessionController;
class SessionNavigation; class SessionNavigation;
enum class PeerMenuSource { struct PeerMenuRequest {
ChatsList, enum class Source {
History, ChatsList,
Profile, History,
ScheduledSection, Profile,
RepliesSection, ScheduledSection,
RepliesSection,
};
not_null<PeerData*> peer;
Source source = Source::ChatsList;
FilterId filterId = 0;
MsgId rootId = 0;
MsgId currentReplyToId = 0;
};
struct FolderMenuRequest {
not_null<Data::Folder*> folder;
}; };
using PeerMenuCallback = Fn<QAction*( using PeerMenuCallback = Fn<QAction*(
@ -46,15 +58,12 @@ using PeerMenuCallback = Fn<QAction*(
void FillPeerMenu( void FillPeerMenu(
not_null<SessionController*> controller, not_null<SessionController*> controller,
not_null<PeerData*> peer, PeerMenuRequest request,
FilterId filterId, const PeerMenuCallback &addAction);
const PeerMenuCallback &addAction,
PeerMenuSource source);
void FillFolderMenu( void FillFolderMenu(
not_null<SessionController*> controller, not_null<SessionController*> controller,
not_null<Data::Folder*> folder, FolderMenuRequest request,
const PeerMenuCallback &addAction, const PeerMenuCallback &addAction);
PeerMenuSource source);
void PeerMenuAddMuteAction( void PeerMenuAddMuteAction(
not_null<PeerData*> peer, not_null<PeerData*> peer,
@ -80,6 +89,7 @@ void PeerMenuAddChannelMembers(
void PeerMenuCreatePoll( void PeerMenuCreatePoll(
not_null<Window::SessionController*> controller, not_null<Window::SessionController*> controller,
not_null<PeerData*> peer, not_null<PeerData*> peer,
MsgId replyToId = 0,
PollData::Flags chosen = PollData::Flags(), PollData::Flags chosen = PollData::Flags(),
PollData::Flags disabled = PollData::Flags(), PollData::Flags disabled = PollData::Flags(),
Api::SendType sendType = Api::SendType::Normal); Api::SendType sendType = Api::SendType::Normal);