void NoticePipe::handle(const ObjectSeq& objs){ MessageSeq msgs; IntSeq ids; for (size_t i = 0; i < objs.size(); ++i) { MessagePtr m = MessagePtr::dynamicCast(objs.at(i)); msgs.push_back(m); ids.push_back(m->to->userId); } JidSeqMap jmap; try{ //jmap = OnlineCenterAdapter::instance().getUsersJids(ids); jmap = TalkFunStateAdapter::instance().getUsersJids(ids); }catch(Ice::Exception& e){ //MCE_WARN("NoticePipe::handle --> call OnlineCenterAdapter.getUsersJids error : " << e); MCE_WARN("NoticePipe::handle --> call TalkFunStateAdapter.getUsersJids error : " << e); } MessageSeq res; for (size_t i = 0; i < msgs.size(); ++i) { JidSeqMap::iterator it = jmap.find(msgs.at(i)->to->userId); if (it == jmap.end()) { continue; } for (size_t j = 0; j < it->second.size(); ++j) { if (it->second.at(j)->endpoint.size() > 1 && it->second.at(j)->endpoint[0] == 'T') { MessagePtr m = new Message(); m->from = new Jid(); m->from->userId = -1; m->from->endpoint = "appnotice.talk.xiaonei.com"; m->from->index = -1; m->to = it->second.at(j); m->type = msgs.at(i)->type; m->msg = msgs.at(i)->msg; res.push_back(m); } } } if (!res.empty()) { MCE_INFO("NoticePipe::handle --> Notice size:"<<res.size()); try{ TalkDeliverAdapter::instance().deliver(res); }catch(Ice::Exception& e){ MCE_WARN("NoticePipe::handle --> call TalkDeliverAdapter.deliver error : " << e); } } }
//-------------------------------------------------------------------------------- void PostPipe::handle(const ObjectSeq& seq) { if (seq.empty()) { return; } MessageSeq mseq; for (size_t i = 0; i < seq.size(); ++i) { mseq.push_back(MessagePtr::dynamicCast(seq.at(i))); } try { MucDeliverManagerI::instance().getProxyServerOneway(mseq.at(0)->to)->deliver(mseq); } catch(Ice::Exception& e) { MCE_WARN("PostPipe::handle --> deliver err:"<<e<<" to endpoint:"<< mseq.at(0)->to); } MCE_DEBUG(__FUNCTION__ << " --> deliver size="<<mseq.size()); }
void PostPipe::handle(const ObjectSeq& seq) { //MCE_INFO("PostPipe::handle --> thread_id = " << pthread_self()); if (seq.empty()) { return; } else { //MCE_DEBUG("PostPipe::handle --> objectseq size = " <<seq.size()); } //MCE_DEBUG("PostPipe::handle --> size:" << seq.size()); MessageSeq mseq; for (size_t i = 0; i < seq.size(); ++i) { mseq.push_back(MessagePtr::dynamicCast(seq.at(i))); } try { if((mseq.at(0)->to->endpoint[0] == 'T') || (mseq.at(0)->to->endpoint[0] == 'W') || (mseq.at(0)->to->endpoint[0] == 'P')){ DeliverManagerI::instance().getProxyServerOneway(mseq.at(0)->to)->deliver(mseq); } } catch(Ice::Exception& e) { MCE_WARN("PostPipe::handle -->ProxyAdapter::delivere-->"<<e<<" to endpoint:"<< mseq.at(0)->to); } }
void PostPipe::handle(const ObjectSeq& seq) { if (seq.empty()) { return; } else { MCE_DEBUG("PostPipe::handle --> objectseq size = " <<seq.size()); } MessageSeq mseq; for (size_t i = 0; i < seq.size(); ++i) { mseq.push_back(MessagePtr::dynamicCast(seq.at(i))); } try { MCE_DEBUG("start to deliver --> toid:"<<mseq.at(0)->to->userId); WTalkProxyManagerI::instance().getAccessServerOneway(getName())->deliver(mseq); MCE_DEBUG("end deliver --> toid:"<<mseq.at(0)->to->userId); } catch(Ice::Exception& e) { MCE_WARN("PostPipe::handle --> deliver err:"<<e<<" to endpoint:"<< mseq.at(0)->to); } }
void DeliverManagerI::deliver(const MessageSeq& seq, const Ice::Current& current) { //TaskManager::instance().execute(new MessageTask(seq)); //MCE_DEBUG("DeliverManagerI::deliver --> seq.size="<<seq.size()); if (!seq.empty()) { if (seq.at(0)->to->userId == 128487631 || seq.at(0)->to->userId == 200865373) { //MCE_DEBUG("DeliverManagerI::deliver --> msg:"<< seq.at(0)->msg); } } for(MessageSeq::const_iterator it = seq.begin(); it != seq.end(); ++it){ MessagePtr m = (*it); if(m->type == MESSAGE){ MCE_INFO("DeliverManagerI::deliver message-->from=" << jidToString(m->from) << " to=" << jidToString(m->to)); } if(m->type == NOTIFY2_MESSAGE){ MCE_INFO("DeliverManagerI::deliver notify2-->from=" << jidToString(m->from) << " to=" << jidToString(m->to)); } } for (size_t i = 0; i < seq.size(); ++i) { PipePool::instance().push("TalkRight", abs(seq.at(i)->to->userId)%10, seq.at(i)); } }
void MucDeliverManagerI::deliver(const MessageSeq& seq, const Ice::Current& current) { MCE_DEBUG(__FUNCTION__ << " --> seq.size="<<seq.size()); for (size_t i = 0; i < seq.size(); ++i) { PipePool::instance().push(seq.at(i)->to->endpoint, 0, seq.at(i)); } }
void MucDeliverAdapter::deliver(const MessageSeq& seq) { if(seq.empty()) { return; } getManagerOneway(seq.at(0)->to->userId)->deliver(seq); }
void ManagerI::deliver(const MessageSeq& mseq, const Ice::Current&) { //MCE_INFO("ManagerI::deliver --> deliver a message to jsclient size=" << mseq.size()); for (size_t i = 0; i < mseq.size(); ++i) { ClientPoolManager::instance().getClientPool(mseq.at(i)->to->index).pushMsg(mseq.at(i)->to->index, mseq.at(i)); } }
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); } } } }