support of bots added to megagroups

This commit is contained in:
John Preston
2015-11-20 16:34:37 +03:00
parent 417024e6d2
commit ecc49f9cd4
13 changed files with 166 additions and 31 deletions
+19 -1
View File
@@ -1727,6 +1727,13 @@ int32 HistoryInner::itemTop(const HistoryItem *item) const { // -1 if should not
return (top < 0) ? top : (top + item->y + item->block()->y);
}
void HistoryInner::notifyIsBotChanged() {
_botInfo = (_history && _history->peer->isUser()) ? _history->peer->asUser()->botInfo : 0;
if (_botInfo && !_botInfo->inited && App::api()) {
App::api()->requestFullPeer(_peer);
}
}
void HistoryInner::applyDragSelection() {
applyDragSelection(&_selected);
}
@@ -2935,7 +2942,7 @@ void HistoryWidget::updateStickers() {
_stickersUpdateRequest = MTP::send(MTPmessages_GetAllStickers(MTP_string(cStickersHash())), rpcDone(&HistoryWidget::stickersGot), rpcFail(&HistoryWidget::stickersFailed));
}
void HistoryWidget::botCommandsChanged(UserData *user) {
void HistoryWidget::notifyBotCommandsChanged(UserData *user) {
if (_peer && (_peer == user || !_peer->isUser())) {
if (_attachMention.clearFilteredCommands()) {
checkMentionDropdown();
@@ -2943,6 +2950,15 @@ void HistoryWidget::botCommandsChanged(UserData *user) {
}
}
void HistoryWidget::notifyUserIsBotChanged(UserData *user) {
if (_peer && _peer == user) {
_list->notifyIsBotChanged();
_list->updateBotInfo();
updateControlsVisibility();
resizeEvent(0);
}
}
void HistoryWidget::stickersGot(const MTPmessages_AllStickers &stickers) {
cSetLastStickersUpdate(getms(true));
_stickersUpdateRequest = 0;
@@ -6344,6 +6360,8 @@ void HistoryWidget::peerUpdated(PeerData *data) {
App::api()->requestFullPeer(data);
} else if (data->isUser() && data->asUser()->blocked == UserBlockUnknown) {
App::api()->requestFullPeer(data);
} else if (data->isMegagroup() && !data->asChannel()->mgInfo->botStatus) {
App::api()->requestBots(data->asChannel());
}
}
if (!_a_show.animating()) {