diff --git a/Telegram/SourceFiles/app.cpp b/Telegram/SourceFiles/app.cpp index 90f2997802..b3733dbb5c 100644 --- a/Telegram/SourceFiles/app.cpp +++ b/Telegram/SourceFiles/app.cpp @@ -540,6 +540,30 @@ namespace App { cdata->version = d.vversion.v; } } break; + case mtpc_channelForbidden: { + const MTPDchannelForbidden &d(chat.c_channelForbidden()); + + PeerId peer(peerFromChannel(d.vid.v)); + data = App::channel(peer); + data->input = MTP_inputPeerChannel(d.vid, d.vaccess_hash); + + ChannelData *cdata = data->asChannel(); + cdata->inputChat = MTP_inputChannel(d.vid, d.vaccess_hash); + + cdata->setName(qs(d.vtitle), QString()); + + cdata->access = d.vaccess_hash.v; + cdata->setPhoto(MTP_chatPhotoEmpty()); + cdata->date = 0; +// cdata->count = -1; + cdata->adminned = false; + + cdata->isBroadcast = false; + cdata->isPublic = false; + + cdata->left = false; + cdata->forbidden = true; + } break; } if (!data) continue; diff --git a/Telegram/SourceFiles/dialogswidget.cpp b/Telegram/SourceFiles/dialogswidget.cpp index 8bbdeaf2e0..2d0ed54fba 100644 --- a/Telegram/SourceFiles/dialogswidget.cpp +++ b/Telegram/SourceFiles/dialogswidget.cpp @@ -833,7 +833,7 @@ void DialogsListWidget::peopleReceived(const QString &query, const QVector::const_iterator i = people.cbegin(), e = people.cend(); i != e; ++i) { PeerId peerId = peerFromMTP(*i); History *h = App::historyLoaded(peerId); - if (h && !h->isEmpty()) continue; // skip dialogs + if (h && !h->dialogs.isEmpty()) continue; // skip dialogs peopleResults.push_back(App::peer(peerId)); } diff --git a/Telegram/SourceFiles/mtproto/mtpConnection.h b/Telegram/SourceFiles/mtproto/mtpConnection.h index 5262799b9b..63d9357c43 100644 --- a/Telegram/SourceFiles/mtproto/mtpConnection.h +++ b/Telegram/SourceFiles/mtproto/mtpConnection.h @@ -60,6 +60,9 @@ enum { MTPDchannel_flag_left = (1 << 3), MTPDchannel_flag_kicked = (1 << 4), + MTPDchat_flag_left = (1 << 3), + MTPDchat_flag_kicked = (1 << 4), + MTPupdates_ChannelDifference_flag_final = (1 << 0), MTPDchannelMessagesFilter_flag_only_important = (1 << 0), diff --git a/Telegram/SourceFiles/structs.cpp b/Telegram/SourceFiles/structs.cpp index 79609df36a..4a4841b90c 100644 --- a/Telegram/SourceFiles/structs.cpp +++ b/Telegram/SourceFiles/structs.cpp @@ -104,6 +104,8 @@ void PeerData::updateName(const QString &newName, const QString &newNameOrPhone, if (isUser()) { asUser()->username = newUsername; asUser()->setNameOrPhone(newNameOrPhone); + } else if (isChannel()) { + asChannel()->username = newUsername; } Names oldNames = names; @@ -154,6 +156,8 @@ void PeerData::fillNames() { if (isUser()) { if (!asUser()->nameOrPhone.isEmpty() && asUser()->nameOrPhone != name) toIndex += ' ' + textAccentFold(asUser()->nameOrPhone); if (!asUser()->username.isEmpty()) toIndex += ' ' + textAccentFold(asUser()->username); + } else if (isChannel()) { + if (!asChannel()->username.isEmpty()) toIndex += ' ' + textAccentFold(asChannel()->username); } if (cRussianLetters().match(toIndex).hasMatch()) { toIndex += ' ' + translitRusEng(toIndex);