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


C++ JidSeq::push_back方法代码示例

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


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

示例1: 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

示例2: 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

示例3: SetPermision

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

示例4: AwayRoom

bool RoomInfo::AwayRoom(int userid){
  bool awayok = false;
  JidPtr jid = new Jid();
  jid->userId = userid;
  jid->index = 0;
	

	JidSeq offlinejids;
  Jid2ActiveUserMap::iterator nit = _jid2activeuser.lower_bound(jid);
  for(; nit != _jid2activeuser.end(); ++nit){
    if(nit->second->jid->userId == userid){
      offlinejids.push_back(nit->second->jid);
			//TaskManager::instance().execute(new PageCacheNotifyTask("offline", userid, nit->second->identity->roomid));
      awayok = true;
    }
    else{
      break;
    }
  }
	for(JidSeq::iterator jit = offlinejids.begin(); jit != offlinejids.end(); ++jit){
		AwayRoom((*jit));
	}
  //MCE_DEBUG("RoomInfo::AwayRoom --> userid = " << userid << " awayok = " << awayok);
  return awayok;
}
开发者ID:bradenwu,项目名称:oce,代码行数:25,代码来源:RoomPool.cpp

示例5: remove

bool User::remove(const string& endpoint, JidSeq &seq, NotifyType& type) {
	//MCE_WARN("User::remove --> " << endpoint);
	map<Ice::Long, list<AvatarPtr>::iterator >::iterator it = _avatars.begin();
	for (; it != _avatars.end();) {
		if ((*(it->second))->jid->endpoint != endpoint) {
			++it;
			continue;
		}
		seq.push_back((*(it->second))->jid);
		OnlineManagerI::instance().getPool((*(it->second))->jid->userId)->erase(it->second);
		_avatars.erase(it++);
	}
	OnlineStat oldStat = _onlineStat;
	if (!_avatars.empty()) {
		updateOnlineStatAndOnlineType((*(_avatars.begin()->second))->jid->userId);
	}
	if (!seq.empty()) {
		OnlineStat newStat = _onlineStat;
		if (oldStat==INVISIABLE && newStat==INVISIABLE) {
			type = AvatarToItsOtherAvatars;
		} else if (oldStat!=INVISIABLE && newStat!=INVISIABLE) {
			type = AvatarToAll;
		} else {
			type = AllAvatarsToBuddies;
		}
	}
	return _avatars.empty();
}
开发者ID:bradenwu,项目名称:oce,代码行数:28,代码来源:User.cpp

示例6: handle

/*
void WebSession::handle() {
	MCE_DEBUG("WebSession::handle --> " << jidToString(_sessionJid));
	if (::time(NULL) - _timestamp >= MAX_DURATION) {
		WTalkProxyManagerI::instance().destroySession(this->_sessionJid);
	} else {
		if (_jidMap.empty()) {
			TaskManager::instance().schedule(this);
		}
	}
}
*/
JidSeq WebSession::getAccessJid() {
	JidSeq seq;
	for (map<Ice::Long,JidPtr>::iterator it = _jidMap.begin(); it
			!= _jidMap.end(); ++it) {
		seq.push_back(it->second);
	}
	return seq;
}
开发者ID:bradenwu,项目名称:oce,代码行数:20,代码来源:ProxyManagerI.cpp

示例7: GetAllActiveJids

JidSeq RoomInfo::GetAllActiveJids(){
  JidSeq ans;
  Jid2ActiveUserMap::iterator nit = _jid2activeuser.begin();
  for(; nit != _jid2activeuser.end(); ++nit){
    if(POutcast != nit->second->permision && STATUSCODE_OFFLINE != nit->second->statuscode){
      ans.push_back(nit->first);
    }
  }
  MCE_DEBUG("RoomInfo::GetAllActiveJids --> ans.size = " << ans.size());
  return ans;
}
开发者ID:bradenwu,项目名称:oce,代码行数:11,代码来源:RoomPool.cpp

示例8: UserOnline

void RoomPool::UserOnline(const MucActiveUserPtr& activeuser){
  MCE_DEBUG("RoomPool::UserOnline --> jid = " << jidToString(activeuser->jid));
  MucActiveUserPtr opaptr;
  MucActiveUserSeq presenceUsers;
  RoomInfoPtr riptr;
  bool addok = false;
	int mucstatus = 0;
  {
    //针对频繁上下线,不能上写锁。
    IceUtil::RWRecMutex::RLock lock(_rwmutex);
    riptr = GetRoom(activeuser->identity->roomid);
    if(!riptr){
			//TaskManager::instance().execute(new PageCacheNotifyTask("online", activeuser->jid->userId, activeuser->identity->roomid));
      return;
    }
		presenceUsers = riptr->GetAllActiveUsers();
		presenceUsers.push_back(activeuser);    //加自己
  }
  if(riptr){
		//如果用户是IM用户,而且房间也cache了,这样发送邀请。
		if('T' == activeuser->jid->endpoint[0]){
			MCE_DEBUG("RoomPool::UserOnline --> user is an im user and room is in cache. so send invite to it!");
			try{
				JidSeq jids;
				jids.push_back(activeuser->jid);
				MucGateAdapter::instance().InviteIMusers(activeuser->identity->roomid, jids);
			}catch(Ice::Exception& e){
      	MCE_WARN("RoomPool::UserOnline--> call MucTalkRoom.GetRoomActiveUserSeq ERR  line:"<<__LINE__<<" err:"<<e);
   	 	}
    	catch(std::exception& e){
      	MCE_WARN("RoomPool::EnterRoom --> call MucTalkRoom.GetRoomActiveUserSeq ERR  line:"<<__LINE__<<" err:"<<e.what());
    	}
			return;
		}

    //如果这个房间被cache住了,在线中心会响应这个用户的上线行为
    IceUtil::RWRecMutex::WLock lock(_rwmutex);
    addok = riptr->AddActiveUser(activeuser);
		if(addok){
			mucstatus = riptr->GetUserMucStatus(activeuser->jid->userId);
		}
  }

  if(addok && !presenceUsers.empty()){
    MucGateAdapter::instance().NotifyUserEnterRoom(activeuser, presenceUsers, mucstatus);
  }
}
开发者ID:bradenwu,项目名称:oce,代码行数:47,代码来源:RoomPool.cpp

示例9: GetActiveUsers

MucUserIdentitySeq RoomPool::GetActiveUsers(const MucRoomIdPtr& roomid){
  MCE_DEBUG("RoomPool::GetActiveUsers --> roomname = " << roomid->roomname << " roomdomain = " << roomid->domain);
  bool hasroom = false;
  JidSeq imusers;
  MucActiveUserSeq activeusers;
  MucUserIdentitySeq ans;
  RoomInfoPtr riptr;
  {
    IceUtil::RWRecMutex::RLock lock(_rwmutex);
    riptr = GetRoom(roomid);
    if(riptr){
      hasroom = true;
      ans = riptr->GetAllUserIdentity();
    }
  }
  if(!hasroom && PERMANENT == roomid->domain){
    MCE_DEBUG("RoomPool::GetActiveUsers --> roomname = " << roomid->roomname << " pull from MucTalkRoom");
		try{
    	activeusers = MucTalkRoomAdapter::instance().GetRoomActiveUserSeq(roomid);
		}
		catch(Ice::Exception& e){
			MCE_WARN("RoomPool::GetActiveUsers --> call MucTalkRoom.GetRoomActiveUserSeq ERR  line:"<<__LINE__<<" err:"<<e);
		}
		catch(std::exception& e){
			MCE_WARN("RoomPool::GetActiveUsers --> call MucTalkRoom.GetRoomActiveUserSeq ERR  line:"<<__LINE__<<" err:"<<e.what());
		}
		if(activeusers.empty()){
			MCE_DEBUG("RoomPool::GetActiveUsers --> call MucTalkRoom.GetRoomActiveUserSeq empty result so [email protected]@");
		  return ans;
		}
		bool checkagain = false;
		IceUtil::RWRecMutex::WLock lock(_rwmutex);
		riptr = GetRoom(roomid);
    if(riptr){
      MCE_DEBUG("RoomPool::GetActiveUsers --> after check again bool againcheck = true so only return room's all activeusers ");
      checkagain = true;
      ans = riptr->GetAllUserIdentity();
    }
    if(!checkagain){
      MCE_DEBUG("RoomPool::GetActiveUsers --> after check again bool againcheck = false we add web activeusers into server cache and send invite to imusers if have");
      bool hasaddroom = false;
      set<int> uids;
      MucActiveUserSeq::iterator it = activeusers.begin();
      for(; it != activeusers.end(); ++it){
        if((*it)->jid->endpoint[0] == 'W'){
          hasaddroom = true;
					MCE_DEBUG("RoomPool::GetActiveUsers --> PUSH ACIVEUSER INFO : jid = " << jidToString((*it)->jid) << " roomname = " << (*it)->identity->roomid->roomname << " domain = " << (*it)->identity->roomid->domain << " permision = " << (*it)->permision);
          JoinRoom((*it));
        }
        else if((*it)->jid->endpoint[0] == 'T'){
          imusers.push_back((*it)->jid);
        }
        pair<set<int>::iterator, bool > insertres = uids.insert((*it)->jid->userId);
        if(insertres.second){
          ans.push_back((*it)->identity);
        }
      }
      if(!hasaddroom){
        CreateRoom(roomid);
      }
    }
  }
  if(!imusers.empty()){
    MCE_DEBUG("RoomPool::GetActiveUsers send invite to imusers : size = " << imusers.size());
    MucGateAdapter::instance().InviteIMusers(roomid, imusers);
  }
  MCE_DEBUG("RoomPool::GetActiveUsers --> roomname = " << roomid->roomname << " all activeusers.size = " << ans.size());
	for(MucUserIdentitySeq::iterator logit = ans.begin(); logit != ans.end(); ++logit){
  	MCE_DEBUG("RoomPool::GetActiveUsers --> activeuser info : roomname = " << (*logit)->roomid->roomname << " nickname = " << (*logit)->nickname);
	}
  return ans;
}
开发者ID:bradenwu,项目名称:oce,代码行数:72,代码来源:RoomPool.cpp

示例10: EnterRoom


//.........这里部分代码省略.........
		opaptr = activeuser;
    MCE_DEBUG("RoomPool::EnterRoom --> domain == " << PERMANENT);
    {
      IceUtil::RWRecMutex::RLock lock(_rwmutex);
      riptr = GetRoom(activeuser->identity->roomid);
    }
    if(riptr){
			//如果房间存在,直接加人
      MCE_DEBUG("RoomPool::EnterRoom --> riptr is not null so call it AddActiveUser function");
      IceUtil::RWRecMutex::WLock lock(_rwmutex);
      enterok = riptr->AddActiveUser(activeuser);
    }
    else{
      MCE_DEBUG("RoomPool::EnterRoom --> riptr is null .No " << activeuser->identity->roomid->roomname << " in cache pull from MucTalkRoom");
      hasroom = false;
      JidSeq imusers;
      MCE_DEBUG("RoomPool::EnterRoom --> CALL MucTalkRoomAdapter.GetRoomActiveUserSeq roomname = " << activeuser->identity->roomid->roomname);
      try{
        presenceUsers = MucTalkRoomAdapter::instance().GetRoomActiveUserSeq(activeuser->identity->roomid);
      }
      catch(Ice::Exception& e){
        MCE_WARN("RoomPool::EnterRoom --> call MucTalkRoom.GetRoomActiveUserSeq ERR  line:"<<__LINE__<<" err:"<<e);
      }
      catch(std::exception& e){
        MCE_WARN("RoomPool::EnterRoom --> call MucTalkRoom.GetRoomActiveUserSeq ERR  line:"<<__LINE__<<" err:"<<e.what());
      }
      {
        IceUtil::RWRecMutex::WLock lock(_rwmutex);
        bool againcheck = false;
        riptr = GetRoom(activeuser->identity->roomid);
        if(riptr){
          MCE_DEBUG("RoomPool::EnterRoom --> after check again bool againcheck = true so it means the users has pull hera already so only add it");
          againcheck = true;
					hasroom = true;
          enterok = riptr->AddActiveUser(activeuser);
        }
        if(!againcheck){
          MCE_DEBUG("RoomPool::EnterRoom --> after check again  bool againcheck = false so push the web presenceUsers(get from MucTalkRoom) into room and send invite to IM users");
          bool hasaddroom = false;
          MucActiveUserSeq::iterator it = presenceUsers.begin();
          for(; it != presenceUsers.end();){
            if((*it)->jid->endpoint[0] == 'W'){
              hasaddroom = true;
              riptr = JoinRoom((*it));
							++it;
            }
						else if(equal(activeuser->jid, (*it)->jid)){
							MCE_DEBUG("RoomPool::EnterRoom --> the activeuser self enter room");
							//第三方客户端可能会起不同的名字所以在这里要加入房间的参数activeuser 并且修改这个seq里面的元素。
							hasaddroom = true;
							riptr = JoinRoom(activeuser);
							(*it) = activeuser;
							++it;
						}
            else if((*it)->jid->endpoint[0] == 'T'){
              imusers.push_back((*it)->jid);
							//对于客户端用户,我们发送邀请。所以,它并不在房间内,我们要从广播用户内删除他们。
							it = presenceUsers.erase(it);
            }
          }
          if(!hasaddroom){
            riptr = CreateRoom(activeuser->identity->roomid);
          }
					if(riptr){
						//判断拉进来的用户里面有没有自己
						opaptr = riptr->GetActiveUser(activeuser->jid);
						if(opaptr){
							enterok = true;
						}
					}
        }
      }
      if(enterok && !imusers.empty()){
        MCE_DEBUG("RoomPool::EnterRoom --> send invite to imiusers size = " << imusers.size());
        MucGateAdapter::instance().InviteIMusers(activeuser->identity->roomid, imusers);
      }
    }
  }
	
	if(!enterok){
		MCE_DEBUG("RoomPool::EnterRoom --> jid = " << jidToString(activeuser->jid) << " enterok = false return");
		return;
	}
	
  if(hasroom){
    IceUtil::RWRecMutex::RLock lock(_rwmutex);
    presenceUsers = riptr->GetAllActiveUsers();
  }
  if(opaptr && !presenceUsers.empty()){
    MCE_DEBUG("RoomPool::EnterRoom --> jid = " << jidToString(activeuser->jid) << " OK");
		for(MucActiveUserSeq::iterator logit = presenceUsers.begin(); logit != presenceUsers.end(); ++logit){
			MCE_DEBUG("RoomPool::EnterRoom --> presenceUser : info " << jidToString((*logit)->jid) << " room : " << mucUserIdentityToString((*logit)->identity) << " permision = " << (*logit)->permision);
		}
		if(PERMANENT == activeuser->identity->roomid->domain && riptr){
    	IceUtil::RWRecMutex::RLock lock(_rwmutex);
			mucstatus = riptr->GetUserMucStatus(activeuser->jid->userId);
		}
    MucGateAdapter::instance().NotifyUserEnterRoom(opaptr, presenceUsers, mucstatus);
  }
}
开发者ID:bradenwu,项目名称:oce,代码行数:101,代码来源:RoomPool.cpp


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