当前位置: 首页>>代码示例>>C++>>正文


C++ RoomInfoPtr类代码示例

本文整理汇总了C++中RoomInfoPtr的典型用法代码示例。如果您正苦于以下问题:C++ RoomInfoPtr类的具体用法?C++ RoomInfoPtr怎么用?C++ RoomInfoPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了RoomInfoPtr类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: MCE_DEBUG

void RoomPool::SetPermision(int opuser, Permisions permision, int targetuser, const MucRoomIdPtr& roomid){
  MCE_DEBUG("RoomPool::SetPermision --> opuser = " << opuser << " permision = " << permision << " targetuser = " << targetuser << " roomname = " << roomid->roomname);
  MucActiveUserPtr opaptr;
  MucActiveUserSeq targetseq;
  JidSeq presenceUsers;
  RoomInfoPtr riptr;
  {
    IceUtil::RWRecMutex::WLock lock(_rwmutex);
    riptr = GetRoom(roomid);
    if(riptr){
      targetseq = riptr->GetActiveUserSeq(targetuser);
      riptr->SetPermision(targetuser, permision);
    }
  }
  if(riptr){
    IceUtil::RWRecMutex::RLock lock(_rwmutex);
    opaptr = riptr->GetActiveUser(opuser);
    if(opaptr){
      presenceUsers = riptr->GetAllActiveJids();
      if(permision == POutcast || permision == PNone){
				//如果是踢人的话,要把自己加上,notify self
        for(MucActiveUserSeq::iterator it = targetseq.begin(); it != targetseq.end(); ++it){
          presenceUsers.push_back((*it)->jid);
        }
      }
    }
  }
  if(riptr && opaptr && !presenceUsers.empty()){
    MucGateAdapter::instance().NotifySetPermision(opaptr, presenceUsers, targetseq, permision);
  }
}
开发者ID:bradenwu,项目名称:oce,代码行数:31,代码来源:RoomPool.cpp

示例2: SetPermisionForIM

bool RoomPool::SetPermisionForIM(int opuser, Permisions permision, int targetuser, const MucRoomIdPtr& roomid){
  bool setok = false;
  MucActiveUserPtr opaptr;
  MucActiveUserSeq targetseq;
  JidSeq presenceUsers;
  RoomInfoPtr riptr;
  {
    IceUtil::RWRecMutex::WLock lock(_rwmutex);
    riptr = GetRoom(roomid);
    if(riptr){
      targetseq = riptr->GetActiveUserSeq(targetuser);
      setok = riptr->SetPermisionForIM(opuser, permision, targetuser);
    }
    else{
      return false;
    }
  }
  if(setok){
    IceUtil::RWRecMutex::RLock lock(_rwmutex);
    opaptr = riptr->GetActiveUser(opuser);
    if(opaptr){
      presenceUsers = riptr->GetAllActiveJids();
      if(permision == POutcast || permision == PNone){
        for(MucActiveUserSeq::iterator it = targetseq.begin(); it != targetseq.end(); ++it){
          presenceUsers.push_back((*it)->jid);
        }
      }
    }
  }
  if(setok && opaptr && !presenceUsers.empty()){
    MucGateAdapter::instance().NotifySetPermision(opaptr, presenceUsers, targetseq, permision);
  }
  return setok;
}
开发者ID:bradenwu,项目名称:oce,代码行数:34,代码来源:RoomPool.cpp

示例3: ChatSetingChange

void RoomPool::ChatSetingChange(int userid, const MucRoomIdPtr& roomid, int set){
	RoomInfoPtr riptr;
	MucActiveUserSeq seq;
	MCE_DEBUG("RoomPool::ChatSetingChange --> userid = " << userid << " roomid = " << mucRoomIdToString(roomid) << " set = " << set);
	{
		IceUtil::RWRecMutex::RLock lock(_rwmutex);
		riptr = GetRoom(roomid);
		if(riptr){
			seq = riptr->GetActiveUserSeq(userid);
		}
	}
	if(seq.empty()){
		MCE_DEBUG("RoomPool::ChatSetingChange --> userid = " << userid << " roomid = " << mucRoomIdToString(roomid) << " set = " << set << " no MucActiveUserSeq");
		return;
	}
	JidSeq webjids;
	for(MucActiveUserSeq::iterator ait = seq.begin(); ait != seq.end(); ++ait){
		if('W' == (*ait)->jid->endpoint[0]){
			webjids.push_back((*ait)->jid);
		}
	}
	if(webjids.empty()){
		MCE_DEBUG("RoomPool::ChatSetingChange --> userid = " << userid << " roomid = " << mucRoomIdToString(roomid) << " set = " << set << " no webjids");
		return;
	}
	try{
		MucGateAdapter::instance().NotifyChatSetingChange(roomid, webjids, set);
	}catch(Ice::Exception& e){
		MCE_WARN("RoomPool::ChatSetingChange--> call MucGate.NotifyChatSetingChange ERR  line:"<<__LINE__<<" err:"<<e);
	}
	catch(std::exception& e){
		MCE_WARN("RoomPool::ChatSetingChange--> call MucGate.NotifyChatSetingChange ERR  line:"<<__LINE__<<" err:"<<e.what());
	}
}
开发者ID:bradenwu,项目名称:oce,代码行数:34,代码来源:RoomPool.cpp

示例4: lock

int RoomPool::GetUserCount(const MucRoomIdPtr& roomid){
  IceUtil::RWRecMutex::RLock lock(_rwmutex);
  RoomInfoPtr riptr = GetRoom(roomid);
  if(riptr){
    return riptr->GetUserCount();
  }
}
开发者ID:bradenwu,项目名称:oce,代码行数:7,代码来源:RoomPool.cpp

示例5: removeAll

void BackupManagerI::removeAll(const RoomIdPtr& rid, const Ice::Current&) {
	if (rid) {
		Ice::Long hashcode = StrUtil::hashcode(roomIdToString(rid));
		RoomInfoPtr ri = ServiceI::instance().findObject<RoomInfoPtr>(ROOM_INFO, hashcode);
		if (ri) {
			ri->removeAll(rid);
		}
		_addRemoveSqlObj(rid);
	}
}
开发者ID:bradenwu,项目名称:oce,代码行数:10,代码来源:BackupManagerI.cpp

示例6: GetUserByPermision

MucActiveUserSeq RoomPool::GetUserByPermision(const MucRoomIdPtr& roomid, Permisions permision){
  MucActiveUserSeq ans;
  RoomInfoPtr riptr;
  IceUtil::RWRecMutex::RLock lock(_rwmutex);
  riptr = GetRoom(roomid);
  if(!riptr){
    return ans;
  }
  ans = riptr->GetActiveUserSeq(permision);
  return ans;
}
开发者ID:bradenwu,项目名称:oce,代码行数:11,代码来源:RoomPool.cpp

示例7: MCE_DEBUG

OccupantSeq BackupManagerI::get(const RoomIdPtr& rid, const Ice::Current&) {
	MCE_DEBUG("call BackupManagerI::get");
	if (rid) {
		Ice::Long hashcode = StrUtil::hashcode(roomIdToString(rid));
		RoomInfoPtr ri = ServiceI::instance().locateObject<RoomInfoPtr>(ROOM_INFO, hashcode);
		if (ri) {
			MCE_DEBUG("BackupManagerI::get   --> return size:"<< ri->get(rid).size());
			return ri->get(rid);
		}
	}
	return OccupantSeq();

}
开发者ID:bradenwu,项目名称:oce,代码行数:13,代码来源:BackupManagerI.cpp

示例8: QueryRunner

Ice::ObjectPtr RoomInfoFactoryI::create(Ice::Long hashcode) {
	Statement sql;
	sql << "select * from occupant_backup where hashcode = " << boost::lexical_cast<string>(hashcode).c_str();
	//MCE_DEBUG("RoomFactoryI::create --> " << sql);
	try {
#ifndef NEWARCH
		mysqlpp::Result res = QueryRunner("im_groupchat", CDbRServer).store(sql);
#else
		mysqlpp::StoreQueryResult res = QueryRunner("im_groupchat", CDbRServer).store(sql);
#endif
		MCE_DEBUG("RoomInfoFactoryI::create --> load occupant_backup from database, count=" << res.size());
		RoomInfoPtr ri = new RoomInfo();
		for (size_t i= 0; i<res.size(); ++i) {

			mysqlpp::Row row = res.at(i);

			OccupantPtr o = new Occupant();
#ifndef NEWARCH
			o->rJid = stringToRoomJid(row["rjid"].get_string());
#else
			o->rJid = stringToRoomJid(row["rjid"].c_str());
#endif
			o->fJid = new Jid();
			o->fJid->userId = (int)row["userid"];
#ifndef NEWARCH
			o->fJid->endpoint = row["endpoint"].get_string();
#else
			o->fJid->endpoint = row["endpoint"].c_str();
#endif
			o->fJid->index = (Ice::Long)row["jid_index"];

			o->aType = (Affiliation)(int)row["affiliation"];
			o->role = (RoomRole)(int)row["role"];

			ri->put(o);
		}
		return ri;
	} catch(Ice::Exception& e) {
		MCE_WARN(e << " at " << __FILE__ << ":" << __LINE__);
	} catch (std::exception& e) {
		MCE_WARN(e.what() << " at " << __FILE__ << ":" << __LINE__);
	} catch (...) {
		MCE_WARN("Unkown exception at " << __FILE__ << ":" << __LINE__);
	}

	return 0;
}
开发者ID:bradenwu,项目名称:oce,代码行数:47,代码来源:BackupManagerI.cpp

示例9: MCE_DEBUG

void RoomPool::SendTalkMessage(const JidPtr& opuser, const MucRoomIdPtr& roomid, const string& msg){
  MCE_DEBUG("RoomPool::SendTalkMessage --> jid = " << jidToString(opuser) << " roomname = " << roomid->roomname << " msg = " << msg);
  MucActiveUserPtr opaptr;
  JidSeq presenceUsers;
	RoomInfoPtr riptr;

  {
    IceUtil::RWRecMutex::RLock lock(_rwmutex);
    riptr = GetRoom(roomid);
  }
  {
    MCE_DEBUG("RoomPool::SendTalkMessage -->GetRoom HERE");
		if(!riptr){
      GetActiveUsers(roomid);
      MCE_DEBUG("RoomPool::SendTalkMessage --> LOCATE NEW ROOM");
		}
  }

  {
  
    IceUtil::RWRecMutex::RLock lock(_rwmutex);
    if (!riptr)
      riptr = GetRoom(roomid);
		if(!riptr){
      MCE_WARN("RoomPool::SendTalkMessage --> LOCATE NEW ROOM ERROR"); 
      return;
      
		}
    MCE_DEBUG("RoomPool::SendTalkMessage -->GetRoom OK");
		opaptr = riptr->GetActiveUser(opuser);
		if(opaptr){
			presenceUsers = riptr->GetAllActiveJids();
		}else{
    	MCE_WARN("RoomPool::SendTalkMessage --> no activeuser in room.....it is so amazing pull the jid :" << jidToString(opuser) << " into the room");
			TaskManager::instance().execute(new PullLostUserTask(opuser));
		}
  }
  if(opaptr && !presenceUsers.empty()){
    MCE_DEBUG("RoomPool::SendTalkMessage --> presenceUsers.size = " << presenceUsers.size());
    MucGateAdapter::instance().NotifyGroupChat(opaptr, presenceUsers, msg);
  }
}
开发者ID:gunner14,项目名称:old_rr_code,代码行数:42,代码来源:RoomPool.cpp

示例10: AwayRoom

void RoomPool::AwayRoom(const JidPtr& opuser, const MucRoomIdPtr& roomid){
  //如果一个用户的副本进入了在线中心,那么这个用户退出在线中心的行为是下线。
  //第三方副本可以awayroom
  RoomInfoPtr riptr;
  MucActiveUserPtr opaptr;
  //MucActiveUserSeq presenceUsers;
  JidSeq presenceUsers;
  bool awayok = false;
  bool kickroomok = false;
	int mucstatus = 0;
  {
    IceUtil::RWRecMutex::WLock lock(_rwmutex);
    riptr = GetRoom(roomid);
		if(!riptr){
			return;
		}
    opaptr = riptr->GetActiveUser(opuser);
    awayok = riptr->AwayRoom(opuser);
    if(awayok && !riptr->GetUserCount()){
      MCE_DEBUG("RoomPool::AwayRoom --> user away ok and room is empty so kick it");
      kickroomok = KickRoom(roomid);
    }
  }

  if(awayok){
    if(!kickroomok){
      IceUtil::RWRecMutex::RLock lock(_rwmutex);
      presenceUsers = riptr->GetAllActiveJids();
			mucstatus = riptr->GetUserMucStatus(opuser->userId);
    }
		if(opaptr){
    	presenceUsers.push_back(opaptr->jid);
		}
  }

  if(awayok && opaptr && !presenceUsers.empty()){
    MucGateAdapter::instance().NotifyUserAwayRoom(opaptr, presenceUsers, mucstatus);
  }
  MCE_DEBUG("RoomPool::AwayRoom --> jid = " << jidToString(opuser) << " roomname = " << roomid->roomname << " awayok = " << awayok << " mucstatus = " << mucstatus);
}
开发者ID:bradenwu,项目名称:oce,代码行数:40,代码来源:RoomPool.cpp


注:本文中的RoomInfoPtr类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。