Example #1
0
void ReloginManager::OnOperationCallback(std::shared_ptr<void> param)
{
	m_bDoReloginNow = FALSE;
	LoginParam* pLoginParam = (LoginParam*)param.get();
	if (LOGIN_OK == pLoginParam->result)
	{
		LOG__(ERR, _T("ReloginManager regloin success!!!"));

		module::getSessionModule()->setTime(pLoginParam->serverTime);

		//通知服务器客户端初始化完毕,获取组织架构信息和群列表
		module::getLoginModule()->notifyLoginDone();

		//清空存在客户端的未读消息,因为服务端又会将这个消息送过来,避免重复
		module::getMessageModule()->removeAllMessage();

		//获取最近联系会话
		UInt32 updateTime = module::getSessionModule()->getGlobalUpdateTime();
		LOG__(APP, _T("IMRecentContactSessionReq after relogin done, local update time = %d"), updateTime);
		IM::Buddy::IMRecentContactSessionReq imRecentContactSessionReq;
		imRecentContactSessionReq.set_user_id(module::getSysConfigModule()->userId());
		imRecentContactSessionReq.set_latest_update_time(updateTime);
		module::getTcpClientModule()->sendPacket(IM::BaseDefine::ServiceID::SID_BUDDY_LIST
			, IM::BaseDefine::BuddyListCmdID::CID_BUDDY_LIST_RECENT_CONTACT_SESSION_REQUEST
			, &imRecentContactSessionReq);

		//通知网络已经恢复正常,可以进行各种操作了
		module::getLoginModule()->asynNotifyObserver(module::KEY_LOGIN_RELOGINOK, pLoginParam->mySelectedStatus);
	}
	else
	{
		LOG__(ERR, _T("ReloginManager regloin failed!!!"));
		module::getTcpClientModule()->shutdown();

		//TCP\IP验证token失效,开启重新获取token的task
		//if (LOGIN_TOKEN_FAILED == pLoginParam->result)
		{
			//开启定时获取token的定时器
		}
		if (IM::BaseDefine::REFUSE_REASON_VERSION_TOO_OLD == pLoginParam->result)
		{
			CString csTip = util::getMultilingual()->getStringById(_T("STRID_WEBLOGINFORM_TIP_VERSION_TOOOLD"));
			CString csTitle = module::getMiscModule()->getAppTitle();
			::MessageBox(0, csTip, csTitle, MB_OK | MB_ICONINFORMATION);
			module::getMiscModule()->quitTheApplication();
		}
		else
		{
			startReloginTimer(++m_secondCount);
		}
	}
}
Example #2
0
uint32_t ClientConn::getRecentSession(uint32_t nUserId, uint32_t nLastTime)
{
    CImPdu cPdu;
    IM::Buddy::IMRecentContactSessionReq msg;
    msg.set_user_id(nUserId);
    msg.set_latest_update_time(nLastTime);
    cPdu.SetPBMsg(&msg);
    cPdu.SetServiceId(IM::BaseDefine::SID_BUDDY_LIST);
    cPdu.SetCommandId(IM::BaseDefine::CID_BUDDY_LIST_RECENT_CONTACT_SESSION_REQUEST);
    uint32_t nSeqNo = m_pSeqAlloctor->getSeq(ALLOCTOR_PACKET);
    cPdu.SetSeqNum(nSeqNo);
    SendPdu(&cPdu);
    return nSeqNo;
}
Example #3
0
void MainListLayout::DoInit()
{
	m_pManager->AddNotifier(this);

	m_Tab = static_cast<CTabLayoutUI*>(m_pManager->FindSubControlByName(this, _T("tabs")));
	m_EAuserTreelist = static_cast<CEAUserTreelistUI*>(m_pManager->FindSubControlByName(this, _T("friends")));
	m_GroupList = static_cast<CGroupsTreelistUI*>(m_pManager->FindSubControlByName(this, _T("groupsList")));
	m_UIRecentConnectedList = static_cast<CUIRecentSessionList*>(m_pManager->FindSubControlByName(this, _T("recentlyList")));

	//默认选中最近联系人列表
	m_Tab->SelectItem(2);

	//所有业务模块的本地化数据加载
	imcore::IMLibCoreStartOperationWithLambda(
		[]()
	{
		if (!module::getUserListModule()->startup())
		{
			LOG__(ERR, _T("userlist module local db datas start failed!"));
		}
		LOG__(APP, _T("userlist module local db datas start done"));
		if (!module::getGroupListModule()->startup())
		{
			LOG__(ERR, _T("grouplist module local db datas start failed!"));
		}
		LOG__(APP, _T("grouplist module local db datas start done"));
		if (!module::getSessionModule()->startup())
		{
			LOG__(ERR, _T("session module local db datas start failed!"));
		}
		LOG__(APP, _T("session module local db datas start done"));
		//获取最近联系会话
		UInt32 updateTime = module::getSessionModule()->getGlobalUpdateTime();
		LOG__(APP, _T("IMRecentContactSessionReq , local update time = %d"), updateTime);
		IM::Buddy::IMRecentContactSessionReq imRecentContactSessionReq;
		imRecentContactSessionReq.set_user_id(module::getSysConfigModule()->userId());
		imRecentContactSessionReq.set_latest_update_time(updateTime);
		module::getTcpClientModule()->sendPacket(IM::BaseDefine::ServiceID::SID_BUDDY_LIST
			, IM::BaseDefine::BuddyListCmdID::CID_BUDDY_LIST_RECENT_CONTACT_SESSION_REQUEST
			, &imRecentContactSessionReq);
	}
	);
}