Пример #1
0
RoomMemberListPtr RoomPool::SelectRoomMembers(const MucRoomIdPtr& roomid){
  int irid = GetIdFromMucRoomId(roomid);
	if(!irid){
		return NULL;
	}
  Statement sql;
  string tablename = GetDbTableName(irid);

  RoomMemberListPtr rmlptr = new RoomMemberList(roomid->roomname, irid);
  //sql<< "select member_id from " << tablename << " where minigroup_id = " << irid;
  sql << "select user_id, member_type from " << tablename << " where session_id = " << irid;
  MCE_DEBUG("RoomPool::SelectRoomMembers-->tablename," << tablename);
  mysqlpp::StoreQueryResult res = QueryRunner(DB_INSTANCE, CDbRServer, tablename).store(sql);
  if (res && res.num_rows() > 0) {
    for (size_t i = 0; i < res.num_rows(); ++i) {
      mysqlpp::Row row = res.at(i);
      // int userid = (int)row["member_id"];
      //MCE_DEBUG("RoomPool::SelectRoomMembers-->user_id," << (int)row["user_id"] << ",member_type," << (int)row["member_type"]);
      if (1 == (int)row["member_type"]) {
        int userid = (int)row["user_id"];
        rmlptr->AddMember(userid);

      }
    }
  }
	return rmlptr;
}
Пример #2
0
void RoomPool::AddRoomMember(int userid, const MucRoomIdPtr& roomid){
  RoomMemberListPtr rmlptr;
  bool addok = false;
  rmlptr = GetMemberList(roomid);
  if(rmlptr){
    IceUtil::RWRecMutex::WLock lock(_rwmutex);
    addok = rmlptr->AddMember(userid);
  }
  MCE_DEBUG("RoomPool::AddRoomMember --> userid = " << userid << " roomname = " << roomid->roomname << " addok = " << addok);
}