mirror of https://github.com/procxx/kepka.git
				
				
				
			search channel by username
This commit is contained in:
		
							parent
							
								
									c3270d6b66
								
							
						
					
					
						commit
						eaacc1b7e2
					
				|  | @ -540,6 +540,30 @@ namespace App { | ||||||
| 					cdata->version = d.vversion.v; | 					cdata->version = d.vversion.v; | ||||||
| 				} | 				} | ||||||
| 			} break; | 			} 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; | 			if (!data) continue; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -833,7 +833,7 @@ void DialogsListWidget::peopleReceived(const QString &query, const QVector<MTPPe | ||||||
| 	for (QVector<MTPPeer>::const_iterator i = people.cbegin(), e = people.cend(); i != e; ++i) { | 	for (QVector<MTPPeer>::const_iterator i = people.cbegin(), e = people.cend(); i != e; ++i) { | ||||||
| 		PeerId peerId = peerFromMTP(*i); | 		PeerId peerId = peerFromMTP(*i); | ||||||
| 		History *h = App::historyLoaded(peerId); | 		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)); | 		peopleResults.push_back(App::peer(peerId)); | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | @ -60,6 +60,9 @@ enum { | ||||||
| 	MTPDchannel_flag_left = (1 << 3), | 	MTPDchannel_flag_left = (1 << 3), | ||||||
| 	MTPDchannel_flag_kicked = (1 << 4), | 	MTPDchannel_flag_kicked = (1 << 4), | ||||||
| 
 | 
 | ||||||
|  | 	MTPDchat_flag_left = (1 << 3), | ||||||
|  | 	MTPDchat_flag_kicked = (1 << 4), | ||||||
|  | 
 | ||||||
| 	MTPupdates_ChannelDifference_flag_final = (1 << 0), | 	MTPupdates_ChannelDifference_flag_final = (1 << 0), | ||||||
| 
 | 
 | ||||||
| 	MTPDchannelMessagesFilter_flag_only_important = (1 << 0), | 	MTPDchannelMessagesFilter_flag_only_important = (1 << 0), | ||||||
|  |  | ||||||
|  | @ -104,6 +104,8 @@ void PeerData::updateName(const QString &newName, const QString &newNameOrPhone, | ||||||
| 	if (isUser()) { | 	if (isUser()) { | ||||||
| 		asUser()->username = newUsername; | 		asUser()->username = newUsername; | ||||||
| 		asUser()->setNameOrPhone(newNameOrPhone); | 		asUser()->setNameOrPhone(newNameOrPhone); | ||||||
|  | 	} else if (isChannel()) { | ||||||
|  | 		asChannel()->username = newUsername; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	Names oldNames = names; | 	Names oldNames = names; | ||||||
|  | @ -154,6 +156,8 @@ void PeerData::fillNames() { | ||||||
| 	if (isUser()) { | 	if (isUser()) { | ||||||
| 		if (!asUser()->nameOrPhone.isEmpty() && asUser()->nameOrPhone != name) toIndex += ' ' + textAccentFold(asUser()->nameOrPhone); | 		if (!asUser()->nameOrPhone.isEmpty() && asUser()->nameOrPhone != name) toIndex += ' ' + textAccentFold(asUser()->nameOrPhone); | ||||||
| 		if (!asUser()->username.isEmpty()) toIndex += ' ' + textAccentFold(asUser()->username); | 		if (!asUser()->username.isEmpty()) toIndex += ' ' + textAccentFold(asUser()->username); | ||||||
|  | 	} else if (isChannel()) { | ||||||
|  | 		if (!asChannel()->username.isEmpty()) toIndex += ' ' + textAccentFold(asChannel()->username); | ||||||
| 	} | 	} | ||||||
| 	if (cRussianLetters().match(toIndex).hasMatch()) { | 	if (cRussianLetters().match(toIndex).hasMatch()) { | ||||||
| 		toIndex += ' ' + translitRusEng(toIndex); | 		toIndex += ' ' + translitRusEng(toIndex); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue