예제 #1
0
void SessionForm::OnTeamMemberAdd(const std::string& tid, const nim::TeamMemberProperty& team_member_info)
{
	if (!IsTeamMemberType(team_member_info.GetUserType()))
		return;

	if(tid == session_id_)
	{
		team_member_info_list_[team_member_info.GetAccountID()] = team_member_info;
		std::wstring wid = nbase::UTF8ToUTF16(team_member_info.GetAccountID());

		Control* ctrl = member_list_->FindSubControl(wid);
		if(ctrl == NULL)
		{
			TeamItem* item = new TeamItem;
			GlobalManager::FillBoxWithCache(item, L"session/team_item.xml");
			member_list_->Add(item);

			item->InitControl();
			item->SetTeamMember(team_member_info);
		}
		else
		{
			QLOG_WAR(L"OnTeamMemberAdd found the duplicate id, id={0}") << wid.c_str();
		}

		std::wstring str = nbase::StringPrintf(L"群成员(共%d人)", member_list_->GetCount());
		label_member_->SetText(str);

		if (LoginManager::GetInstance()->IsEqual(team_member_info.GetAccountID()))
		{
			btn_header_->SetEnabled(true);
		}
	}
}
예제 #2
0
void TeamService::InvokeAddTeamMember(const std::string& tid, const nim::TeamMemberProperty& team_member)
{
	assert(nbase::MessageLoop::current()->ToUIMessageLoop());

	QLOG_APP(L"invoke add: tid={0} uid={1}") << tid << team_member.GetAccountID();
	for(auto& it : add_team_member_cb_)
	{
		(*it.second)(tid, team_member);
	}
}