예제 #1
0
void MsgRecordForm::QueryMsgOnlineCb(nim::NIMResCode code, const std::string& id, nim::NIMSessionType type, const nim::QueryMsglogResult& result)
{
	QLOG_APP(L"query online msg end: code={0} id={1} type={2}") <<code <<id <<type;


	if (id != session_id_)
		return;
	is_loading_ = false;
	LoadingTip(false);

	if (code == nim::kNIMResSuccess)
	{
		std::vector<nim::IMMessage> vec;
		for (auto& msg : result.msglogs_)
		{
			vec.push_back(msg);
		}
		ShowMsgs(vec);

		if (vec.size() < kMsgLogNumberShow)
		{
			has_more_ = false;
			return;
		}
	}
}
예제 #2
0
bool MsgRecordForm::Notify(ui::EventArgs* param)
{
	std::wstring name = param->pSender->GetName();
	if(param->Type == ui::kEventNotify)
	{
		MsgBubbleItem* item = dynamic_cast<MsgBubbleItem*>( param->pSender );
		assert(item);
		nim::IMMessage md = item->GetMsg();

		if(param->wParam == BET_RELOAD)
		{
			item->SetLoadStatus(RS_LOADING);
			nim::NOS::FetchMedia(md, nbase::Bind(&MsgRecordForm::OnDownloadCallback, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4), nim::NOS::ProgressCallback());
		}
	}
	else if(param->Type == ui::kEventScrollChange)
	{
		if(name == L"msg_list")
		{
			bool list_top= (msg_list_->GetScrollPos().cy <= 10);
			if(list_top && has_more_ && !is_loading_)
			{
				is_loading_ = true;

				LoadingTip(true);
				msg_list_->SetScrollPosY(0);

				ShowMore(true);
			}
		}
	}
	return true;
}