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


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

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


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

示例1: unbind

void SessionPool::unbind(const string& sessionKey, const JidPtr& jid) {
	IceUtil::RWRecMutex::WLock lock(_mutex);
	Stat st(this, false);
	if(jid){
		MCE_INFO("SessionPool::unbind --> " << jidToString(jid));
	}
	map<int, WebSessionPtr>::iterator it = _pool.find(jid->userId);
	if (it != _pool.end()) {
		it->second->unbind(sessionKey, jid);
	} else {
		MCE_DEBUG("SessionPool::unbind --> not in pool jid:"<< jidToString(jid));
		JidSeq jseq = OnlineCenterAdapter::instance().getUserJids(jid->userId);
		for (size_t i = 0; i < jseq.size(); ++i) {
			if (jseq.at(i)->endpoint == ServiceI::instance().getName()) {
				try {
					MCE_DEBUG("SessionPool::unbind --> not in pool jid:"<< jidToString(jseq.at(i)));
					LoginMsgHandlerAdapter::instance().unbind(jseq.at(i));
					PresenceMsgHandlerAdapter::instance().offline(jseq.at(i));
				} catch(Ice::Exception & e) {
					MCE_WARN("do unbind err:"<<e);
				}
			}
		}
	}
}
开发者ID:bradenwu,项目名称:oce,代码行数:25,代码来源:ProxyManagerI.cpp

示例2: handle

void KickUserTimer::handle(){
	while(true){
		pair<int, int> p;
		{
			IceUtil::Mutex::Lock lock(_mutex);
			if(_users.empty()){
				break;
			}
			p = _users.front();
			if((time(NULL)-p.second) < 1*60){
				break;
			}
			_users.pop_front();
		}

		JidSeq jids;
		try{
			jids = OnlineCenterAdapter::instance().getUserJids(p.first);
		}catch(Ice::Exception& e){
			MCE_WARN("KickUserTimer::handle-->OnlineCenterAdapter::getUserJids-->" << e);
		}
		MCE_INFO("KickUserTimer::handle --> user:" << p.first << " onlinesize:" << jids.size() << " size:" << _users.size());
		if(jids.empty()){
			continue;
		}	
		for(int i=0; i<jids.size(); i++){
			try{
				MCE_INFO("KickUserTimer::handle -- > offline " << jidToString(jids.at(i)));
				OnlineCenterAdapter::instance().offline(jids.at(i));
			}catch(Ice::Exception& e){
				MCE_WARN("KickUserTimer::handle-->OnlineCenterAdapter::offline-->" << e << " " << jidToString(jids.at(i)));
			}
			try{
				MCE_INFO("KickUserTimer::handle -- > close " << jidToString(jids.at(i)));
				TalkProxyAdapter::instance().kick(jids.at(i));
			}catch(Ice::Exception& e){
				MCE_WARN("KickUserTimer::handle-->TalkProxyAdapter::kick-->" << e << " " << jidToString(jids.at(i)));
			}
		}
	}
}
开发者ID:bradenwu,项目名称:oce,代码行数:41,代码来源:PresenceTask.cpp

示例3: deliver

void WTalkProxyManagerI::deliver(const MessageSeq& msgs, const Ice::Current&) {
	MCE_DEBUG("WTalkProxyManagerI::deliver --> msgs.size:"<<msgs.size());
	for (size_t i = 0; i < msgs.size(); ++i) {
		if ((msgs.at(i)->type == MESSAGE) || (msgs.at(i)->type == OFFLINE_MESSAGE) || (msgs.at(i)->type == PHONE_NOTIFY)) {

			//MCE_DEBUG("msg:"<<msgs.at(i)->msg<<"  toid:"<<msgs.at(i)->to->userId);
			JidSeq jseq = _pools[msgs.at(i)->to->userId % POOLSIZE].getAccessJid(msgs.at(i)->to->userId);
			//MCE_DEBUG("jid size:"<<jseq.size()<<"  toid:"<<msgs.at(i)->to->userId);
			string body;
			xml_document doc;
			try{
				msgs.at(i)->msg = MsgFilterAdapter::instance().wapFilter(msgs.at(i)->msg);
			}catch(Ice::Exception& e){
				MCE_WARN("WTalkProxyManagerI::deliver --> invoke antispam err, " << e);
			}

			if(doc.load(msgs.at(i)->msg.c_str())){
				body = doc.child("message").child("body").first_child().value();
			}
			MCE_INFO("WTalkProxyManagerI::deliver --> from:" << jidToString(msgs.at(i)->from) << " to:" << jidToString(msgs.at(i)->to) << " msg:" << body);
			_pools[msgs.at(i)->to->userId % POOLSIZE].storeMsg(msgs.at(i));

			if (jseq.empty()) {
				//TalkLogicAdapter::instance().unbind(msgs.at(i)->to);
				MCE_WARN("WTalkProxyManagerI::deliver --> access jid size = 0");
				return;
			}

			for (size_t j = 0; j < jseq.size(); ++j) {
				MessagePtr msg = new Message();
				msg->from = msgs.at(i)->from;
				msg->to = jseq.at(j);
				msg->type = msgs.at(i)-> type;
				msg->msg = msgs.at(i)->msg;
				msg->msgKey = msgs.at(i)->msgKey;
				MCE_DEBUG("call pipepool   toid:"<<msg->to->userId);
				PipePool::instance().push(jseq.at(j)->endpoint, 0, msg);
			}
		}
	}
}
开发者ID:bradenwu,项目名称:oce,代码行数:41,代码来源:ProxyManagerI.cpp

示例4: removeBuddyNotify

void IqHandlerI::removeBuddyNotify(Ice::Int from, Ice::Int to,
		const Ice::Current&) {
	StatFunc statF("IqHandlerI::removeBuddyNotify");

	//JidSeq toJids = PresenceAdapter::instance().getOnlineUserJidSeq(to);
	//JidSeq fromJids = PresenceAdapter::instance().getOnlineUserJidSeq(from);
	JidSeq toJids;
	JidSeq fromJids;
	try{
		//toJids = OnlineCenterAdapter::instance().getUserJids(to, 4);
		toJids = TalkFunStateAdapter::instance().getUserJids(to, 4);
	}catch(Ice::Exception& e){
		MCE_WARN("IqHandlerI::removeBuddyNotify-->OnlineCenterAdapter::getUserJids-->err" << e);
	}
	try{
		//fromJids = OnlineCenterAdapter::instance().getUserJids(from, 4);
		fromJids = TalkFunStateAdapter::instance().getUserJids(from, 4);
	}catch(Ice::Exception& e){
		MCE_WARN("IqHandlerI::removeBuddyNotify-->OnlineCenterAdapter::getUserJids-->err" << e);	
	}
	if(toJids.empty() && fromJids.empty()){
		return;
	}
	MessageSeq seq;
	for (size_t i = 0; i < fromJids.size(); ++i) {

		ostringstream msg;
		msg<<"<iq type='set' id='"<<time(NULL)<<"'>"
				<<"<query xmlns='jabber:iq:roster'>" <<"<item jid='"<<to
				<<"@talk.xiaonei.com' subscription='remove' />"
				<<"</query></iq>";

		//			IqHandlerI::instance().getProxyServerOneway(fromJids.at(i)->endpoint)->deliver(fromJids.at(i), msg.str());
		MessagePtr mPtr = new Message();
		mPtr->from = new Jid();
		mPtr->from->userId = -1;
		mPtr->to = fromJids.at(i);
		mPtr->msg = msg.str();
		mPtr->type = IQ_SET;
		seq.push_back(mPtr);
	}

	for (size_t i = 0; i < toJids.size(); ++i) {

		JidPtr fromJid = new Jid();
		fromJid->userId = from;
		fromJid->endpoint = "talk.xiaonei.com";
		fromJid->index = -1;

		ostringstream msg;
		msg<<"<presence  from='"<<from<<"@talk.xiaonei.com' to='"
				<<jidToString(toJids.at(i))<<"' type='unsubscribed' id='"
				<<time(NULL) <<"'/>";

		MessagePtr mPtr = new Message();
		mPtr -> from = fromJid;
		mPtr -> to = toJids.at(i);
		mPtr -> msg = msg.str();
		mPtr -> type = PRESENCE_COMMON;
		seq.push_back(mPtr);

		msg.str("");
		msg<<"<iq type='set' id='"<<time(NULL)<<"'>"
				<<"<query xmlns='jabber:iq:roster'>" <<"<item jid='"<<from
				<<"@talk.xiaonei.com' subscription='remove' />"
				<<"</query></iq>";

		//			IqHandlerI::instance().getProxyServerOneway(toJids.at(i)->endpoint)->deliver(toJids.at(i), msg.str());
		mPtr = new Message();
		mPtr -> from = fromJid;
		mPtr -> to = toJids.at(i);
		mPtr -> msg = msg.str();
		mPtr -> type = IQ_SET;
		seq.push_back(mPtr);
	}
	try{
		TalkDeliverAdapter::instance().deliver(seq);
	}catch(Ice::Exception& e){
		MCE_WARN("IqHandlerI::removeBuddyNotify-->TalkDeliverAdapter::deliver-->err" << e);
	}
}
开发者ID:gunner14,项目名称:old_rr_code,代码行数:81,代码来源:IqHandlerI.cpp

示例5: changeBuddyGroupNotify

void IqHandlerI::changeBuddyGroupNotify(const BuddyItemPtr& bi, const Ice::Current&) {
  if(!bi){
    return;
  }
	MCE_DEBUG("IqHandlerI::changeBuddyGroupNotify --> host:"<<bi->host);
	MyUtil::IntSeq buddys;

	for (map<int,MyUtil::StrSeq>::iterator it = bi->items.begin(); it != bi->items.end(); ++it) {
		buddys.push_back(it->first);
	}
  TalkUserMap buddyInfo;
  try{
		buddyInfo = TalkCacheClient::instance().GetUserBySeqWithLoad(bi->host, buddys);
		if(buddyInfo.size() != buddys.size()){
			MCE_INFO("IqHandlerI::changeBuddyGroupNotify --> may be warn get from TalkCacheClient size is not equal actor = " << bi->host << " ids.size = " << buddys.size() << " map.size = " << buddyInfo.size());
		}else{
			MCE_INFO("IqHandlerI::changeBuddyGroupNotify --> success get from TalkCacheClient size is equal actor = " << bi->host << " ids.size = " << buddys.size() << " map.size = " << buddyInfo.size());
    }
	}catch(Ice::Exception& e){
    MCE_WARN("IqHandlerI::changeBuddyGroupNotify --> TalkCacheClient err, " << e);
  }
	
  MessageSeq mSeq;
  JidSeq jids;
  try{
	  //jids = OnlineCenterAdapter::instance().getUserJids(bi->host, 4);
	  jids = TalkFunStateAdapter::instance().getUserJids(bi->host, 4);
  }catch(Ice::Exception& e){
    MCE_WARN("IqHandlerI::changeBuddyGroupNotify-->OnlineCenterAdapter::getUserJids-->" << e);
  }
	for (size_t j = 0; j < jids.size(); ++j) {
		for (map<int,MyUtil::StrSeq>::iterator it = bi->items.begin(); it
				!= bi->items.end(); ++it) {
			xml_document doc;
			xml_node iqNode = doc.append_child();
			iqNode.set_name("iq");
			iqNode.append_attribute("type") = "set";
			iqNode.append_attribute("id") = (int)time(NULL);
			iqNode.append_attribute("to") = jidToString(jids.at(j)).c_str();

			xml_node queryNode = iqNode.append_child();
			queryNode.set_name("query");
			queryNode.append_attribute("xmlns") = "jabber:iq:roster";

			xml_node itemNode = queryNode.append_child();
			itemNode.set_name("item");
			ostringstream jos;
			jos << it->first << "@talk.xiaonei.com";
			itemNode.append_attribute("jid") = jos.str().c_str();//jid.c_str();

      TalkUserMap::iterator oit = buddyInfo.find(it->first);
			if (oit != buddyInfo.end()) {
				itemNode.append_attribute("name") = oit->second->name.c_str();
			} else {
				itemNode.append_attribute("name") = boost::lexical_cast<string>(it->first).c_str();
			}

			//itemNode.append_attribute("name") = name.c_str();
			itemNode.append_attribute("subscription") = "both";

			for (size_t k = 0; k < it->second.size(); ++k) {
				xml_node groupNode = itemNode.append_child();
				groupNode.set_name("group");
				groupNode.append_child(node_pcdata).set_value(it->second.at(k).c_str());
			}

			MessagePtr mPtr = new Message();
			//mPtr->from = new Jid();
			mPtr->from = jids.at(j);
			mPtr->to = jids.at(j);
			mPtr->type = IQ_SET;
			mPtr->msg = doc.xml();
			mSeq.push_back(mPtr);
			MCE_DEBUG("IqHandlerI::changeBuddyGroupNotify --> xml:"<<doc.xml());
		}
	}
	try{
		TalkDeliverAdapter::instance().deliver(mSeq);
	}catch(Ice::Exception& e){
		MCE_WARN("IqHandlerI::changeBuddyGroupNotify-->TalkDeliverAdapter::deliver-->err" << e);
	}
}
开发者ID:gunner14,项目名称:old_rr_code,代码行数:82,代码来源:IqHandlerI.cpp

示例6: getAvatars

AvatarSeq OnlineCenterAdapter::getAvatars(const JidSeq& jids) {
	if(jids.empty()){
		return AvatarSeq();
	}
	return getManager(jids.at(0)->userId)->getAvatars(jids);
}
开发者ID:gunner14,项目名称:old_rr_code,代码行数:6,代码来源:OnlineCenterAdapter.cpp


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