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


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

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


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

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

示例4: SendTalkMessage

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

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

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

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

示例8: offlineBatch

void OnlineStatSyncAdapter::offlineBatch(const JidSeq& seq) {
	if (!seq.empty()) {
		getManagerOneway(seq.size())->offlineBatch(seq);
	}
}
开发者ID:bradenwu,项目名称:oce,代码行数:5,代码来源:OnlineStatSyncAdapter.cpp

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

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

示例11: handle

void NotifyPrivateChatTask::handle(){
  string sender_identity_str = mucUserIdentityToString(sender->identity);
  if(sender_identity_str.empty()){
    return;
  }
	MCE_DEBUG("MucGateManagerI::NotifyPrivateChat--> senderjid = " << jidToString(sender->jid) << " roomid = " << mucRoomIdToString(sender->identity->roomid) << " targetuser = " << targetuser << " msg = " << msg);
	JidSeq imusers;
  try{
    imusers = OnlineCenterAdapter::instance().getUserJids(targetuser, 4);
		MCE_DEBUG("MucGateManagerI::NotifyPrivateChat --> CALL ONLINECENTER  get IM jids.size = " << imusers.size());
  }
  catch(Ice::Exception& e){
    MCE_WARN("MucGateManagerI::NotifyPrivateChat --> call OnlineCenterAdapter.getUserJids ERR  line:"<<__LINE__<<" err:"<<e);
  }
  catch(std::exception& e){
    MCE_WARN("MucGateManagerI::NotifyPrivateChat --> call OnlineCenterAdapter.getUserJids ERR  line:"<<__LINE__<<" err:"<<e.what());
  }
	MessageSeq seq;
  JidSeq::const_iterator jit = imusers.begin();
  for(; jit != imusers.end(); ++jit){
    xml_document doc;
    xml_node messageNode = doc.append_child();
		messageNode.set_name("message");
    messageNode.append_attribute("from").set_value(sender_identity_str.c_str());
    messageNode.append_attribute("to").set_value(jidToString((*jit)).c_str());
		messageNode.append_attribute("type").set_value("chat");
    xml_node bodyNode = messageNode.append_child();
		bodyNode.set_name("body");
		bodyNode.append_child(node_pcdata).set_value(msg.c_str());
    MessagePtr msg = new Message();
    msg->from = sender->jid;
    msg->to = (*jit);
    msg->msg = doc.xml();
    msg->type = MESSAGE;//none
    msg->msgKey = -1;
    seq.push_back(msg);
  }
	try{
		MCE_INFO("MucGateManagerI::NotifyPrivateChat --> CALL MucDeliver.deliver seq.size = " << seq.size());
		MucDeliverAdapter::instance().deliver(seq);
	} catch(Ice::Exception& e){
    MCE_WARN("MucGateManagerI::NotifyPrivateChat --> call MucDeliver.deliver ERR  line:"<<__LINE__<<" err:"<<e);
  }
  catch(std::exception& e){
    MCE_WARN("MucGateManagerI::NotifyPritateChat--> call MucDeliver.deliver ERR  line:"<<__LINE__<<" err:"<<e.what());
  }

}
开发者ID:gunner14,项目名称:old_rr_code,代码行数:48,代码来源:MucTask.cpp


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