Exemplo n.º 1
0
void LayerGroupList::tableCellTouched(TableView* table, TableViewCell* cell)
{
    ClearError();
    GroupCell* message_cell = dynamic_cast<GroupCell*>(cell);
    auto group_data = groups_.at(cell->getIdx());
    sizeOffset = table->getContentOffset();
    
    //GDM->set_select_group_id(sp_group_data->get_id());
    //GDM->set_select_group(sp_group_data);
    //GDM->set_chat_status(1);
    //        if(sp_group_data->get_is_member())
    //        {
    //            LayerChat* glc = LayerChat::create();
    //            glc->set_show_dir(LAYER_SHOW_DIRECTION::RIGHT_TO_LEFT);
    //            BaseLayer* parent = static_cast<BaseLayer*>(this->getParent());
    //            parent->addChild(glc);
    //
    //            GDM->clear_unreal_message_by_group_id(GDM->get_select_group()->get_id());
    //
    //            message_cell->update_property(sp_group_data);
    //        }
    //        else
    //        {
    ////            BaseLayer* parent = static_cast<BaseLayer*>(this->getParent());
    ////            EnterGroupLayer* egl = EnterLayerGroupList::create();
    ////            parent->addChild(egl);
    //        }
    if (group_layer_type_ == LayerGroupList::GROUPLAYERTYPE::GROUPLAYER)
    {
        
        //        GDM->clear_unreal_message_by_group_id(group_data->groupid());
        //
        //        message_cell->update_property(group_data);
        
        log("进入俱乐部聊天");
        is_select_group_ = false;
        LayerChat* glc = LayerChat::createByGroup(group_data.groupid());
        glc->set_show_dir(LAYER_SHOW_DIRECTION::RIGHT_TO_LEFT);
        AddGlobalLayer(glc);
        
        message_cell->update_ui();
    }
    else if (group_layer_type_ == LayerGroupList::GROUPLAYERTYPE::GAMESELECTGROUP)
    {
        if (group_data.type() == msg::GroupType::OFFICALGROUP)
        {
            ShowError(tools::local_string("create_no_club","无法在官方俱乐部创建房间"));
            is_select_group_ = false;
        }
        else if (select_group_callback_)
        {
            select_group_callback_(group_data);
            is_select_group_ = true;
        }
        
    }
}
Exemplo n.º 2
0
void GroupListModule_Impl::_groupuserlistResponse(CImPdu* pdu)
{
	CImPduClientGroupUserListResponse* pduData = (CImPduClientGroupUserListResponse*)pdu;
	std::string groupid(pduData->GetGroupId(), pduData->GetGroupIdLen());
	std::string groupSid = _MakeGroupSID(groupid);
	util::TTAutoLock lock(&m_lock);
	module::GroupInfoEntity groupInfo;
	if (getGroupInfoBySId(groupid, groupInfo))
	{
		APP_LOG(LOG_ERROR, _T("获取的是已知群的信息"));
	}
	else//保存这个讨论组信息
	{
		groupInfo.gId = groupid;//ID

		user_id_t* pUserInfo = pduData->GetUserList();//群成员
		if (NULL != pUserInfo)
		{
			for (UInt32 i = 0; i < pduData->GetUserCnt(); ++i)
			{
				std::string Sid;
				Sid.assign(pUserInfo[i].id_url, pUserInfo[i].id_len);
				groupInfo.groupMemeberList.push_back(Sid);
			}
		}
		if (NULL != pduData->GetGroupAvatar())//头像
		{
			groupInfo.avatarLocalPath.assign(pduData->GetGroupAvatar(), pduData->GetGroupAvatarLen());
		}
		if (NULL != pduData->GetGroupName())//名字
		{
			std::string sTemp(pduData->GetGroupName(), pduData->GetGroupNameLen());
			groupInfo.csName = util::stringToCString(sTemp, CP_UTF8);
		}
		groupInfo.type = pduData->GetGroupType();
		m_mapGroups.insert(std::make_pair(groupid, groupInfo));
	}

	logic::GetLogic()->asynNotifyObserver(module::KEY_GROUPLIST_UPDATE_NEWGROUPADDED, groupSid);//通知UI新增加了一个讨论组
}