Esempio n. 1
0
//获取uid的好友用户中不是gid的粉丝的那些用户
MyUtil::IntSeq MutualFriendsCacheManagerI::getUnMutualFriends(int uid, const MyUtil::GlobalIdPtr& gid, int begin, int limit, const Ice::Current& current) {
	ostringstream msg;
	msg << "uid = " << uid << ", gid = " << GlobalIdTransfer::get(gid) << ", begin = " << begin << ", limit = " << limit;
	InvokeClient ic = InvokeClient::create(current, msg.str(), InvokeClient::INVOKE_LEVEL_INFO);

	MyUtil::IntSeq fids = getAllFansAsc(gid);
	MyUtil::IntSeq uids = getFriendsAsc(uid);
	MyUtil::IntSeq result;

	if (limit < -1 || begin < 0 || uid < 0) {
		return result;
	} else {
		int count = 0;
		int countLimit = (limit == -1) ? uids.size() : limit;
		MyUtil::IntSeq::iterator fit = fids.begin();
		MyUtil::IntSeq::iterator uit = uids.begin();

		while (fit != fids.end() && uit != uids.end() && count < countLimit + begin) {
			if (*fit < *uit) {
				fit++;
			} else if (*uit < *fit) {
				if(count >= begin){
					result.push_back(*uit);
				}
				count++;
				uit++;
			} else {
				fit++;
				uit++;
			}
		}
		return result;
	}
}
Esempio n. 2
0
void UserNameWriterAdapter::run()
{
	while(true)
	{
		MyUtil::IntSeq ids;
		{
			IceUtil::Monitor<IceUtil::Mutex>::Lock lock(_mutex);
			if(_idSet.empty())
			{
				_mutex.wait();
			}
			ids.insert(ids.end(), _idSet.begin(), _idSet.end());
			_idSet.clear();
		}
		for(MyUtil::IntSeq::const_iterator it = ids.begin(); it != ids.end(); ++it)
		{
			UserNameWriterPrx prx = getUserNameWriter(*it);
			if(prx)
			{
				try
				{
					prx->reload(*it);
				}catch(Ice::Exception& e)
				{
					MCE_WARN("UserNameWriterAdapter::run reload Exception id = " << *it <<" " << e.what());
				}
			}
		}
	}
}
Esempio n. 3
0
bool MutualFriendsCacheManagerI::isFans(int uid, const MyUtil::GlobalIdPtr& gid, const Ice::Current& current) {
	ostringstream msg;
	msg << "uid = " << uid << ", gid = " << GlobalIdTransfer::get(gid);
	InvokeClient ic = InvokeClient::create(current, msg.str(), InvokeClient::INVOKE_LEVEL_INFO);

	MyUtil::IntSeq fans = getAllFansAsc(gid);
	MyUtil::IntSeq::iterator it = lower_bound(fans.begin(), fans.end(), gid);
	return it != fans.end();
}
Esempio n. 4
0
MyUtil::IntSeq RecentlyOnlineBuddyData::get_most_recent(int limit) {
	IceUtil::Mutex::Lock lock(*this);
	MyUtil::IntSeq result;
	for (std::deque<int>::reverse_iterator it = _buddies.rbegin();
		(int) result.size()	< limit && it != _buddies.rend(); ++it) {
		if (find(result.begin(), result.end(), *it)!=result.end()) continue;
		result.push_back(*it);
	}
	return result;
}
Esempio n. 5
0
ObjectResultPtr BuddyApplyCacheNPreloaderFactory::create(const MyUtil::IntSeq& ids) {

	MCE_INFO("BuddyApplyCacheNPreloaderFactory::create group -> id size: "<<ids.size());
	int minId = ids.front();
	int maxId = ids[ids.size()-1];
	MCE_INFO("BuddyApplyCacheNPreloaderFactory::create group -> id from: "<<minId <<" to: "<<maxId);

	ObjectResultPtr results = new ObjectResult;

	for(std::vector<int>::const_iterator it = ids.begin(); it != ids.end() ; ++it)
	{
		int id = *it;
		BuddyApplyCacheNPtr buddyApplyCacheResult = new BuddyApplyCacheN();
		buddyApplyCacheResult->ownerId = id;
		BuddyApplyCacheResultHandlerI handler(buddyApplyCacheResult);
		Statement sql;
		sql
		<< "SELECT applicant,UNIX_TIMESTAMP(time) AS unix_time,why,stat_from,group_name"
		<< " FROM buddyapply_accepter_" << abs(id % 100) << " WHERE accepter = '" << id << "'"
		<< " ORDER BY time DESC"
		<< " LIMIT 100";
		ostringstream pattern;
		pattern << "buddyapply_accepter_" << id % 100;
		QueryRunner("buddyapplycache_accepter", CDbRServer,pattern.str()).query(sql, handler);
	
		results->data.insert(make_pair(*it, buddyApplyCacheResult));
	}

	MCE_INFO("BuddyApplyCacheNPreloaderFactory::create group -> data.size: "<< results->data.size());
	return results;

}
Esempio n. 6
0
void UserLoginData::AppendUserFriends(MyUtil::Int2IntSeqMap& result, 
									const MyUtil::IntSeq& userFriends, 	
									const MyUtil::Int2IntSeqMap& negtiveFriendsMap) {
	MCE_INFO("[UserLoginData] AppendUserFriends");
	for (Int2IntSeqMap::iterator iter = result.begin();
			iter != result.end(); ++iter) {
		IntSeq& recommendList = iter->second;
		IntSeq tempRecommendList(recommendList);

		Int2IntSeqMap::const_iterator fIt = negtiveFriendsMap.find(iter->first);

		if (fIt != negtiveFriendsMap.end() && !recommendList.empty()) {
			for (IntSeq::const_iterator it = userFriends.begin();
					it != userFriends.end(); ++it) {
				if (find(tempRecommendList.begin(), tempRecommendList.end(), *it) != tempRecommendList.end()) {  //过滤好友中已经推出的好友
					continue;
				}

				UserLoginMapType::iterator ff = _userLoginMap.find( *it );
				if (ff == _userLoginMap.end() || (int)ff->second.count() < ACTIVEDAYS) {                  //过滤不活跃的推荐
					continue;
				}
				
				vector<int>::const_iterator userFriendIter = lower_bound(fIt->second.begin(), fIt->second.end(), *it);    //过滤好友列表
				if (userFriendIter == fIt->second.end() || *userFriendIter != *it) {
					recommendList.push_back(*it);
				}
			}
		}
	}
}
Esempio n. 7
0
void RecentlyOnlineBuddyData::add_old_online(const MyUtil::IntSeq& sorted_buddies) {
	IceUtil::Mutex::Lock lock(*this);
	for (MyUtil::IntSeq::const_iterator it = sorted_buddies.begin(); it
			!= sorted_buddies.end(); ++it) {
		_buddies.push_front(*it);
	}
}
Esempio n. 8
0
SnapshotEntrySeqMap BuddyCoreSnapshotI::getFriends(const ::MyUtil::IntSeq& ids,
		const Ice::Current& current) {
	SnapshotEntrySeqMap result;
	ServiceI& service = ServiceI::instance();
	for (IntSeq::const_iterator it = ids.begin(); it != ids.end(); ++it) {
		EntryListHolderPtr owner = service.findObject<EntryListHolderPtr>(
				CATEGORY_ENTRY, *it);
		if (!owner) {
			continue;
		}
		EntryList ownerList = owner->getAll();
		SnapshotEntrySeq ownerSnap;
		for (EntryList::iterator ownerIt = ownerList.begin(); ownerIt
				!= ownerList.end(); ++ownerIt) {
			int ownerToId = ownerIt->to;
			uint32_t ownerDesc = ownerIt->desc;
			//MCE_INFO("Owner:"<<*it <<" Buddy:"<<ownerToId << " Desc:"<<ownerDesc);
			if (ownerDesc!=DESC_FRIEND) {
				continue;
			}
			SnapshotEntry entryOwner;
			entryOwner.toId = ownerToId;
			entryOwner.desc = BuddyDescHelper::translateDesc(ownerDesc);
			ownerSnap.push_back(entryOwner);
		}
		result[*it] = ownerSnap;
	}
	return result;
}
Esempio n. 9
0
void HatDataWriterI::reload(const MyUtil::IntSeq& ids, const Ice::Current & current) {

	ostringstream inMsg;
	inMsg<<"id size = " << ids.size();
	MyUtil::InvokeClient ic = MyUtil::InvokeClient::create(current, inMsg.str(), MyUtil::InvokeClient::INVOKE_LEVEL_INFO);

	MyUtil::ObjectResultPtr result = new MyUtil::ObjectResult;
	com::xiaonei::xce::Statement sql;
	sql << "SELECT * FROM " << TABLE_HAT << " WHERE id IN ( ";
	for(MyUtil::IntSeq::const_iterator it = ids.begin(); it != ids.end(); ++it)
	{
		if(it != ids.begin())
		{
			sql << ",";
		}
		sql << *it;
	}
	sql << " )";

	BatchHatDataResultHandlerI handler(result);

	{
		com::xiaonei::xce::QueryRunner(DB_MEMBERS, com::xiaonei::xce::CDbRServer).query(sql, handler);
		xce::adapter::hatdata::HatDataReaderAdapter::instance().setData(result);
	}
}
Esempio n. 10
0
void MiniGroupWriterAdapter::run() {
  while (true) {
    MyUtil::IntSeq userIds;
    MyUtil::LongSeq miniGroupIds;
    {
      IceUtil::Monitor<IceUtil::Mutex>::Lock lock(_mutex);
      if (_userIdSet.empty() && _miniGroupIdSet.empty()) {
        _mutex.wait();
      }
      userIds.insert(userIds.end(), _userIdSet.begin(), _userIdSet.end());
      _userIdSet.clear();
      miniGroupIds.insert(miniGroupIds.end(), _miniGroupIdSet.begin(), _miniGroupIdSet.end());
      _miniGroupIdSet.clear();
    }
    if (!userIds.empty()) {
      try {
        getMiniGroupWriterPrx(0)->reloadUsers(userIds);
      } catch(Ice::Exception& e) {
        MCE_WARN("[MiniGroupWriterAdapter::run] reloadUsers size = " << userIds.size());
      }
    }
    if (!miniGroupIds.empty()) {
      try {
        getMiniGroupWriterPrx(0)->reloadMiniGroups(miniGroupIds);
      } catch(Ice::Exception& e) {
        MCE_WARN("[MiniGroupWriterAdapter::run] reloadMiniGroups size = " << miniGroupIds.size());
      }
    }
  }
}
Esempio n. 11
0
Int2BuddyRelationMap BuddyManagerI::getBuddyRelationBatch(const ::MyUtil::IntSeq& userIds, const Ice::Current& current){
	Int2BuddyRelationMap result;
        for (IntSeq::const_iterator it = userIds.begin(); it != userIds.end(); ++it) {
                BuddyRelationPtr brp = getBuddyRelation(*it, current);
                result.insert(make_pair(*it, brp));
        }
        return result;
}
Esempio n. 12
0
void UserLoginData::setNegtiveUserList(const MyUtil::IntSeq& userList) {
	IceUtil::RWRecMutex::WLock lock(_init_flag_mutex);
	
	for(IntSeq::const_iterator iter=userList.begin(); iter!=userList.end(); ++iter) {
		_negtiveUserList.insert( *iter );
	}		
	MCE_INFO("[UserLoginData] setNegtiveUserList _negtiveUserList size(" << _negtiveUserList.size() << ")");
}
Esempio n. 13
0
::MyUtil::Int2IntSeqMap BuddyManagerI::getBlockSeqBatch(
		const ::MyUtil::IntSeq& userIds, const Ice::Current& current) {
	::MyUtil::Int2IntSeqMap result;
	for (IntSeq::const_iterator it = userIds.begin(); it != userIds.end(); ++it) {
		IntSeq sublist = getBlockSeq(*it, 0, -1, current);
		result.insert(make_pair(*it, sublist));
	}
	return result;
}
Esempio n. 14
0
void xce::distcache::userapicache::DelayReloadThread::add(const MyUtil::IntSeq& ids)
{
  IceUtil::Monitor<IceUtil::Mutex>::Lock lock(_mutex);
  _idSet.insert(ids.begin(), ids.end());
  if(_idSet.size() >= 100)
  {
    _mutex.notify();
  }
}
Esempio n. 15
0
MyUtil::IntSeq TalkRightAdapter::batchVerify(const VerifySeq& seq) {
	map<int, VerifySeq> vMap;
	for (size_t i = 0; i < seq.size(); ++i) {
		vMap[abs(seq.at(i)->to) % getCluster()].push_back(seq.at(i));
	}
	MyUtil::IntSeq res;
	for (map<int,VerifySeq>::iterator it = vMap.begin(); it != vMap.end(); ++it) {
		try {
			MyUtil::IntSeq tmp = getManager(it->first)->batchVerify(it->second);
			res.insert(res.end(),tmp.begin(),tmp.end());
		} catch(...) {
			for(size_t i = 0; i < it->second.size(); ++i){
				res.push_back(it->second.at(i)->index);
			}
		}
	}
	return res;
}
Esempio n. 16
0
MyUtil::IntSeq IPRecordData::getWithMask(int limit,::MyUtil::IntSeq mask){
	IceUtil::Mutex::Lock lock(*this);
	MyUtil::IntSeq result;
	if( limit == 0){
		return result;
	}
	std::sort( mask.begin(), mask.end(), std::less<int>() );
	for( MyUtil::IntSeq::reverse_iterator it = _users.rbegin(); it != _users.rend(); ++it ) {
		MyUtil::IntSeq::iterator itMask = lower_bound(mask.begin(),mask.end(),*it);
		if( itMask!=mask.end() && *itMask==*it){
			continue;
		}
		result.push_back(*it);
		if (--limit==0) {
			break;
		}
	}
	return result;
}
Esempio n. 17
0
MyUtil::IntSeq MutualFriendsCacheManagerI::getFans(const MyUtil::GlobalIdPtr& gid, int begin, int limit, const Ice::Current& current) {
	ostringstream msg;
	msg << "gid = " << GlobalIdTransfer::get(gid) << ", begin = " << begin << ", limit = " << limit;
	InvokeClient ic = InvokeClient::create(current, msg.str(), InvokeClient::INVOKE_LEVEL_INFO);

	MyUtil::IntSeq fans = getAllFansAsc(gid);
	MyUtil::IntSeq result;
	if (limit < -1 || begin < 0) {
		return result;
	} else {
		MyUtil::IntSeq::iterator it = lower_bound(fans.begin(), fans.end(), gid);
		int countLimit = (limit == -1) ? fans.size() : limit;
		for (int count = 0; it != fans.end() && count < countLimit; it++) {
			result.push_back(*it);
			count++;
		}
		return result;
	}
}
Esempio n. 18
0
void BuddyManagerI::denyAllApplied(::Ice::Int from,
		const Ice::Current& current) {
	MyUtil::IntSeq ids = getAppliedSeq(from, 0, -1, current);
	for (MyUtil::IntSeq::iterator it = ids.begin(); it != ids.end(); ++it) {
		Relationship apply;
		apply.from = *it;
		apply.to = from;
		MCE_DEBUG("denyAllApplied: deny " << *it);
		denyApply(apply, current);
	}
}
Esempio n. 19
0
MyUtil::IntSeq UserLoginData::getActiveUser(const MyUtil::IntSeq& userList) {
	MCE_INFO("[UserLoginData] getActiveUser userList size = " << userList.size());
	IntSeq result;
	for(IntSeq::const_iterator iter=userList.begin();
			iter!=userList.end(); ++iter) {
		if( _negtiveUserList.count(*iter) <= 0 ) {       //活跃用户
			result.push_back(*iter);
		}
	}	
	return result; 
}
Esempio n. 20
0
void RoomManagerI::removeRoom(const RoomIdPtr& rid, const Ice::Current&) {
	IceUtil::RWRecMutex::WLock lock(_mutex);
	MCE_DEBUG("RoomManagerI::removeRoom --> remove room, "
			<< roomIdToString(rid));

	Ice::Long hashcode = StrUtil::hashcode(roomIdToString(rid));
	RoomClusterPtr rc = ServiceI::instance().findObject<RoomClusterPtr>(ROOM_CLUSTER, hashcode);
	if (!rc) {
		return;
	}
	rc->remove(rid);

	MemberListPtr ml = ServiceI::instance().locateObject<MemberListPtr>(MEMBER_LIST, hashcode);
	if (!ml) {
		return;
	}

	Int2IntSeqMap memMap = ml->getMemberList(rid);
/*	for (Int2IntSeqMap::iterator it = memMap.begin(); it != memMap.end(); ++it) {
		for (size_t i = 0; i < it->second.size(); ++i) {
			RoomListPtr rl = ServiceI::instance().findObject<RoomListPtr>(ROOM_LIST, it->second.at(i));
			if (rl) {
				rl->removeRoom(rid);
			}
		}
	}
*/
	ml->remove(rid);

	Statement sql;
	sql << "delete from room where roomid='" << roomIdToString(rid) << "'";
	Statement sql2;
	sql2 << "delete from room_member where roomid='" << roomIdToString(rid)
			<< "'";

	try {
		QueryRunner("im_groupchat", CDbWServer).store(sql);
		QueryRunner("im_groupchat", CDbWServer).store(sql2);
	} 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__);
	}
	MyUtil::IntSeq userIds;
	for (Int2IntSeqMap::iterator it = memMap.begin(); it != memMap.end(); ++it) {
		if(it->first < Member){
			continue;
		}
		userIds.insert(userIds.end(), it->second.begin(), it->second.end());
	}
	UserRoomAdapter::instance().removeRoomIds(userIds, rid);
}
void ReloadTask::handle(){
  MyUtil::IntSeq buddies;
  try {
    buddies = BuddyByIdCacheAdapter::instance().getFriendListAsc( _id, -1 );
  } catch( Ice::Exception e ){
    MCE_WARN("[ReloadTask] id=" << _id << " found Ice::Exception : " << e.what() );
    return;
  } catch( ... ){
    MCE_WARN("[ReloadTask] id=" << _id << " found Ice::Exception" );
    return;
  }
  multimap<int, int> orderFriend;
  try{
    Statement sql;
    sql	<< "SELECT guest, UNIX_TIMESTAMP(time) AS time FROM relation_"
      << (_id % 100)
      << " WHERE host="
      << _id;

    ostringstream pattern;
    pattern << "relation_" << (_id % 100);

    QueryRunner("relation_buddycache", CDbRServer, pattern.str()).query(
        sql, OrderedListHandler( buddies, orderFriend, "time", "guest" ) );
  }catch(std::exception& e){
    MCE_WARN( "[ReloadTask] handle " << _id << " std::exception " << e.what() );
    return;
  }catch(...){
    MCE_WARN( "[ReloadTask] handle " << _id << " unknown exception." );
    return;
  }

  int time_now = (int)time(NULL);
  MyUtil::IntSeq times;
  ostringstream timestr;
  for( MyUtil::IntSeq::iterator itB=buddies.begin(); itB!=buddies.end(); ++itB ){
    times.push_back( time_now );
    timestr << time_now << " ";
  }

  for (multimap<int, int>::reverse_iterator itMap = orderFriend.rbegin(); itMap
      != orderFriend.rend(); ++itMap ){
    buddies.push_back(itMap->second);
    times.push_back(itMap->first);
    timestr << itMap->first << " ";
  }

  BuddyByAddTimeDataNPtr obj = new BuddyByAddTimeDataN;
  buddies.swap(obj->friends);
  times.swap(obj->times);

  MCE_INFO("[ReloadTask] id=" << _id << " friends.size()=" << obj->friends.size() << " times=" << timestr.str() );
  SetDataHelper::instance().invokeDelay(_id,obj,timestr.str());
}
Esempio n. 22
0
Int2BoolMap OnlineStateFilterManagerI::getOnlineStateBatch(const MyUtil::IntSeq& ids, const Ice::Current& current) {
    ostringstream op;
    Int2BoolMap res;
    for( MyUtil::IntSeq::const_iterator it = ids.begin(); it != ids.end(); ++it ) {
        res[*it] = _online_state[*it];
        op << *it << "(" << res[*it] << ") ";
    }
    MCE_INFO("OnlineStateFilterManagerI::getOnlineStateBatch -> " << op.str()
             << " " << current.con->toString().substr(current.con->toString().find("remote", 25)));
    return res;
}
Esempio n. 23
0
void xce::compareinfo::CompareInfoReloaderI::reload(const MyUtil::IntSeq& ids, const Ice::Current& current) {
	ostringstream oss;
	oss << "CompareInfoReloaderI::reload -> size: "<<ids.size() << current.con->toString().substr(current.con->toString().find("remote",25));
	TimeCost tc = TimeCost::create(oss.str(), TimeCost::LOG_LEVEL_INFO);
	MyUtil::IntSeq tempids;
	for (MyUtil::IntSeq::const_iterator i=ids.begin(); i!=ids.end();++i){
		if (*i > 0) {
			tempids.push_back(*i);
		}
	}
	MyUtil::TaskManager::instance().execute(new ReloadTask(tempids, current));
}
Esempio n. 24
0
void xce::usercache::UserCacheReloaderI::GetUserNames(const MyUtil::IntSeq& ids, MyUtil::ObjectResultPtr& data) {
        com::xiaonei::xce::Statement sql;
        sql << "SELECT id, name FROM user_names WHERE id IN (";
        for (MyUtil::IntSeq::const_iterator it = ids.begin(); it != ids.end(); ++it) {
                if (it != ids.begin()) {
                        sql << ",";
                }
                sql << *it;
        }
        sql << ")";
        com::xiaonei::xce::QueryRunner("usercache_names",com::xiaonei::xce::CDbRServer).query(sql, BatchUserNamesResultHandler(data));
}
Esempio n. 25
0
void xce::distcache::userapicache::DistUserApiCacheReloaderI::GetUserUrl(const MyUtil::IntSeq& ids, MyUtil::ObjectResultPtr& data) {
  com::xiaonei::xce::Statement sql;
  sql << "SELECT id,mainurl,headurl,tinyurl FROM user_url WHERE id IN (";
  for (MyUtil::IntSeq::const_iterator it = ids.begin(); it != ids.end(); ++it) {
    if (it != ids.begin()) {
      sql << ",";
    }
    sql << *it;
  }
  sql << ")";
  com::xiaonei::xce::QueryRunner("userapicache_user_url",com::xiaonei::xce::CDbRServer).query(sql, BatchUserUrlResultHandler(data));
}
Esempio n. 26
0
void xce::distcache::userapicache::DistUserApiCacheReloaderI::GetUserConfig(const MyUtil::IntSeq& ids, MyUtil::ObjectResultPtr& data) {
  com::xiaonei::xce::Statement sql;
  sql << "SELECT id,basic_config,status_config,profile_privacy FROM user_config WHERE id IN (";
  for (MyUtil::IntSeq::const_iterator it = ids.begin(); it != ids.end(); ++it) {
    if (it != ids.begin()) {
      sql << ",";
    }
    sql << *it;
  }
  sql << ")";
  com::xiaonei::xce::QueryRunner("userapicache_user_config",com::xiaonei::xce::CDbRServer).query(sql, BatchUserConfigResultHandler(data));
}
Esempio n. 27
0
void xce::distcache::userapicache::DistUserApiCacheReloaderI::GetUserBorn(const MyUtil::IntSeq& ids, MyUtil::ObjectResultPtr& data) {
  com::xiaonei::xce::Statement sql;
  sql << "SELECT id,gender,birth_year,birth_month,birth_day,home_province, home_city FROM user_born WHERE id IN (";
  for (MyUtil::IntSeq::const_iterator it = ids.begin(); it != ids.end(); ++it) {
    if (it != ids.begin()) {
      sql << ",";
    }
    sql << *it;
  }
  sql << ")";
  com::xiaonei::xce::QueryRunner("userapicache_user_born",com::xiaonei::xce::CDbRServer).query(sql, BatchUserBornResultHandler(data));
}
Esempio n. 28
0
//--------------------------------------------------------------------------------
void VertifyPipe::handle(const ObjectSeq& seq) {

	//MCE_INFO("VertifyPipe::handle --> thread_id = " << pthread_self());
	if (seq.empty()) {
		return;
	} else {
		//MCE_DEBUG("VertifyPipe::handle --> objectseq size = " <<seq.size());
	}
	
	VerifySeq vSeq;
	IntSeq needNotVerifyUsers;
	for (size_t i = 0; i < seq.size(); ++i) {
		MessagePtr m = MessagePtr::dynamicCast(seq.at(i));
		//MCE_INFO("m->from = " << m->from->userId << " m->to = " << m->to->userId);
		if( (m->type != MESSAGE && m->type != OFFLINE_MESSAGE) || (m->from->userId == 365734329 || m->to->userId == 365734329) ){//客服ID,不检查好友。
			//MCE_INFO("VertifyPipe::handle --> m->from = " << m->from << " m->to = " << m->to);
			needNotVerifyUsers.push_back(i);
			continue;
		}
		VerifyPtr v = new Verify();
		v->from = m->from->userId;
		v->to = m->to->userId;
		/*if(MESSAGE != m->type){
			v->to = v->from;
		}*/
		v->type = m->type;

/*		if (v->type == SYSTEM_MESSAGE) {
			v->sysMsgType = m->from->endpoint;
		}*/
		v->index = i;

		vSeq.push_back(v);
	}
	MyUtil::IntSeq indexSeq;
	try{
	 indexSeq = TalkRightAdapter::instance().batchVerify(getIndex(), vSeq);
	}catch(Ice::Exception& e){
		MCE_WARN("VertifyPipe::handle-->TalkRightAdapter::batchVerify-->" << e);
		}
	indexSeq.insert(indexSeq.end(), needNotVerifyUsers.begin(), needNotVerifyUsers.end());

	//MCE_DEBUG("VertifyPipe::handle -->indexSeq size:"<<indexSeq.size());
	for (size_t i = 0; i < indexSeq.size(); ++i) {
		MessagePtr m = MessagePtr::dynamicCast(seq.at(indexSeq.at(i)));
		//MCE_DEBUG("VertifyPipe::handle --> "<<m->to->index);
		if (m->to->index == 0 || m->to->index == 2 || m->to->index >1) {
			//MCE_DEBUG("VertifyPipe::handle --> endpoint:"<<m->to->endpoint);
			PipePool::instance().push(m->to->endpoint, 0, m);
		}
	}

}
Esempio n. 29
0
::MyUtil::Int2IntSeqMap BuddyByOnlineTimeCacheManagerI::getFriendLists(
    const MyUtil::IntSeq& hostIds, const Ice::Current& current){
  ostringstream msg;
  msg << "hostIds.size()=" << hostIds.size();
  InvokeClient ic = InvokeClient::create(current, msg.str(), InvokeClient::INVOKE_LEVEL_INFO);

  Int2IntSeqMap result;
  for(MyUtil::IntSeq::const_iterator it = hostIds.begin();it!=hostIds.end();++it) {
    result.insert( make_pair( *it, locateBuddyByOnlineTimeDataI(*it)->get_most_recent(0,-1) ) );
  }
  return result;
}
Esempio n. 30
0
void UserAdsCacheLoaderI::load(const MyUtil::IntSeq& ids, const Ice::Current& current) {
	MCE_DEBUG("UserAdsCacheLoaderI::load -> size: "<<ids.size()<<" " << current.con->toString().substr(current.con->toString().find("remote",25)));
	MyUtil::IntSeq is;
  for (MyUtil::IntSeq::const_iterator i = ids.begin(); i != ids.end(); ++i) {
    if (*i > 0) {
      is.push_back(*i);
    }
  }
  if (is.size() <= 0) {
    return ;
  }
  CacheLoader<UserAdsCacheManagerPrx>::instance().reload(is);
}