some optimizations in shortchatmessage
This commit is contained in:
		
							parent
							
								
									2121ce1210
								
							
						
					
					
						commit
						080a08fa76
					
				
					 2 changed files with 4 additions and 2 deletions
				
			
		|  | @ -85,7 +85,7 @@ void ApiWrap::requestReplyTo(HistoryReply *reply, MsgId to) { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void ApiWrap::requestFullPeer(PeerData *peer) { | void ApiWrap::requestFullPeer(PeerData *peer) { | ||||||
| 	if (_fullRequests.contains(peer)) return; | 	if (!peer || _fullRequests.contains(peer)) return; | ||||||
| 	mtpRequestId req; | 	mtpRequestId req; | ||||||
| 	if (peer->chat) { | 	if (peer->chat) { | ||||||
| 		req = MTP::send(MTPmessages_GetFullChat(MTP_int(App::chatFromPeer(peer->id))), rpcDone(&ApiWrap::gotChatFull, peer), rpcFail(&ApiWrap::gotPeerFailed, peer)); | 		req = MTP::send(MTPmessages_GetFullChat(MTP_int(App::chatFromPeer(peer->id))), rpcDone(&ApiWrap::gotChatFull, peer), rpcFail(&ApiWrap::gotPeerFailed, peer)); | ||||||
|  |  | ||||||
|  | @ -2979,8 +2979,10 @@ void MainWidget::handleUpdates(const MTPUpdates &updates) { | ||||||
| 
 | 
 | ||||||
| 	case mtpc_updateShortChatMessage: { | 	case mtpc_updateShortChatMessage: { | ||||||
| 		const MTPDupdateShortChatMessage &d(updates.c_updateShortChatMessage()); | 		const MTPDupdateShortChatMessage &d(updates.c_updateShortChatMessage()); | ||||||
| 		if (!App::chatLoaded(d.vchat_id.v) || !App::userLoaded(d.vfrom_id.v) || (d.has_fwd_from_id() && !App::userLoaded(d.vfwd_from_id.v))) { | 		bool noFrom = !App::userLoaded(d.vfrom_id.v); | ||||||
|  | 		if (!App::chatLoaded(d.vchat_id.v) || noFrom || (d.has_fwd_from_id() && !App::userLoaded(d.vfwd_from_id.v))) { | ||||||
| 			MTP_LOG(0, ("getDifference { good - getting user for updateShortChatMessage }%1").arg(cTestMode() ? " TESTMODE" : "")); | 			MTP_LOG(0, ("getDifference { good - getting user for updateShortChatMessage }%1").arg(cTestMode() ? " TESTMODE" : "")); | ||||||
|  | 			if (noFrom) App::api()->requestFullPeer(App::chatLoaded(d.vchat_id.v)); | ||||||
| 			return getDifference(); | 			return getDifference(); | ||||||
| 		} | 		} | ||||||
| 		if (!updPtsUpdated(d.vpts.v, d.vpts_count.v)) { | 		if (!updPtsUpdated(d.vpts.v, d.vpts_count.v)) { | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue
	
	 John Preston
						John Preston