本文整理汇总了C++中JidSeq::empty方法的典型用法代码示例。如果您正苦于以下问题:C++ JidSeq::empty方法的具体用法?C++ JidSeq::empty怎么用?C++ JidSeq::empty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JidSeq
的用法示例。
在下文中一共展示了JidSeq::empty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
}
示例2: 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;
}
示例3: 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();
}
示例4: 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());
}
}
示例5: NotifyBuddyApplyChange
void IqHandlerI::NotifyBuddyApplyChange(int userId, const Ice::Current&){
JidSeq jids;
MCE_DEBUG("IqHandlerI::NotifyBuddyApplyChange --> userId : "<< userId);
try {
//jids = OnlineCenterAdapter::instance().getUserJids(userId, 4);
jids = TalkFunStateAdapter::instance().getUserJids(userId, 4);
}catch(Ice::Exception & e){
MCE_WARN("IqHandlerI::NotifyBuddyApplyChange-->OnlineCenterAdapter::getUserJids-->"<<e);
}
if(!jids.empty()){
for (JidSeq::iterator it = jids.begin(); it != jids.end() ; ++it){
GetBuddyApply(*it);
}
}
}
示例6: RemoveNotifyBySource
void IqHandlerI::RemoveNotifyBySource(int userId, int type, Ice::Long resource, const Ice::Current&){
JidSeq jids;
if(type > 0){
type = -type;
}
MCE_DEBUG("IqHandlerI::RemoveNotifyBySource --> userId : "<< userId << " type = " << type << " source = " << resource);
try {
//jids = OnlineCenterAdapter::instance().getUserJids(userId, 4);
jids = TalkFunStateAdapter::instance().getUserJids(userId, 4);
}catch(Ice::Exception & e){
MCE_WARN("IqHandlerI::RemoveNotifyBySource-->OnlineCenterAdapter::getUserJids-->"<<e);
}
if(!jids.empty()){
for (JidSeq::iterator it = jids.begin(); it != jids.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);
xml_node queryNode = iqNode.append_child();
queryNode.set_name("query");
queryNode.append_attribute("xmlns") = "http://talk.renren.com/removenotify";
queryNode.append_attribute("type") = "removebysource";
xml_node type_node = queryNode.append_child();
type_node.set_name("stype");
string str_type = boost::lexical_cast<string>(type);
type_node.append_child(node_pcdata).set_value(str_type.c_str());
xml_node resource_node = queryNode.append_child();
resource_node.set_name("resource");
string str_resource = boost::lexical_cast<string>(resource);
resource_node.append_child(node_pcdata).set_value(str_resource.c_str());
MessagePtr mPtr = new Message();
mPtr->to = *it;
mPtr->type = IQ_SET;
mPtr->msg = doc.xml();
MCE_DEBUG("IqHandlerI::RemoveNotifyBySource --> to : "<< (*it)->userId <<" xml:"<<doc.xml());
try {
TalkDeliverAdapter::instance().deliver(mPtr);
}catch(Ice::Exception & e){
MCE_WARN("IqHandlerI::RemoveNotifyBySource-->TalkDeliverAdapter::deliver-->"<<e);
}
}
}
}
示例7: 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);
}
}
示例8: 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)));
}
}
}
}
示例9: 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);
}
}
}
}
示例10: AwayRoom
void RoomPool::AwayRoom(const JidPtr& opuser, const MucRoomIdPtr& roomid){
//如果一个用户的副本进入了在线中心,那么这个用户退出在线中心的行为是下线。
//第三方副本可以awayroom
RoomInfoPtr riptr;
MucActiveUserPtr opaptr;
//MucActiveUserSeq presenceUsers;
JidSeq presenceUsers;
bool awayok = false;
bool kickroomok = false;
int mucstatus = 0;
{
IceUtil::RWRecMutex::WLock lock(_rwmutex);
riptr = GetRoom(roomid);
if(!riptr){
return;
}
opaptr = riptr->GetActiveUser(opuser);
awayok = riptr->AwayRoom(opuser);
if(awayok && !riptr->GetUserCount()){
MCE_DEBUG("RoomPool::AwayRoom --> user away ok and room is empty so kick it");
kickroomok = KickRoom(roomid);
}
}
if(awayok){
if(!kickroomok){
IceUtil::RWRecMutex::RLock lock(_rwmutex);
presenceUsers = riptr->GetAllActiveJids();
mucstatus = riptr->GetUserMucStatus(opuser->userId);
}
if(opaptr){
presenceUsers.push_back(opaptr->jid);
}
}
if(awayok && opaptr && !presenceUsers.empty()){
MucGateAdapter::instance().NotifyUserAwayRoom(opaptr, presenceUsers, mucstatus);
}
MCE_DEBUG("RoomPool::AwayRoom --> jid = " << jidToString(opuser) << " roomname = " << roomid->roomname << " awayok = " << awayok << " mucstatus = " << mucstatus);
}
示例11: 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;
}
示例12: EnterRoom
void RoomPool::EnterRoom(const MucActiveUserPtr& activeuser){
MCE_DEBUG("RoomPool::EnterRoom --> activeuser info : jid = " << jidToString(activeuser->jid) << " roomname = " << activeuser->identity->roomid->roomname << " domain = " << activeuser->identity->roomid->domain);
RoomInfoPtr riptr;
MucActiveUserPtr opaptr;
MucActiveUserSeq presenceUsers;
bool hasroom = true;
int mucstatus = 0;
bool enterok = false;
if(TEMPORARY == activeuser->identity->roomid->domain){
//临时房间
{
MCE_DEBUG("RoomPool::EnterRoom --> domain == " << TEMPORARY);
IceUtil::RWRecMutex::WLock lock(_rwmutex);
riptr = JoinRoom(activeuser);
if(riptr){
//临时房间用户可能会改变他的权限。
opaptr = riptr->GetActiveUser(activeuser->jid);
if(opaptr){
enterok = true;
}
}
}
if(!enterok){
try{
MCE_DEBUG("RoomPool::EnterRoom --> CALL MucGate.NotifyNicknameError jid:" << jidToString(activeuser->jid) << " room:" << mucRoomIdToString(activeuser->identity->roomid));
MucGateAdapter::instance().NotifyNicknameError(activeuser->identity->roomid, activeuser->jid);
}
catch(Ice::Exception& e){
MCE_WARN("RoomPool::EnterRoom --> call MucGate.NotifyNicknameError ERR line:"<<__LINE__<<" err:"<<e);
}
catch(std::exception& e){
MCE_WARN("RoomPool::EnterRoom --> call MucGate.NotifyNicknameError ERR line:"<<__LINE__<<" err:"<<e.what());
}
return;
}
/*
//临时房间聊天发起者多副本同步,要向其他副本发送邀请
JidSeq imjids;
try{
MCE_DEBUG("RoomPool::EnterRoom --> CALL OnlineCenter.getUserJids for invite the other jids. userid = " << activeuser->jid->userId);
imjids = OnlineCenterAdapter::instance().getUserJids(activeuser->jid->userId, 4);
}
catch(Ice::Exception& e){
MCE_WARN("RoomPool::EnterRoom --> call OnlineCenter.getUserJids ERR line:"<<__LINE__<<" err:"<<e);
}
catch(std::exception& e){
MCE_WARN("RoomPool::EnterRoom --> call OnlineCenter.getUserJids ERR line:"<<__LINE__<<" err:"<<e.what());
}
if(imjids.empty()){
return;
}
for(JidSeq::iterator jit = imjids.begin(); jit != imjids.end(); ++jit){
if(equal((*jit), activeuser->jid)){
imjids.erase(jit);
MCE_DEBUG("RoomPool::EnterRoom --> erase the activeuser->jid from want to invite");
break;
}
}
if(!imjids.empty()){
MCE_DEBUG("RoomPool::EnterRoom --> invite the user : " << activeuser->jid->userId << "'s other avatar into the room");
try{
MucGateAdapter::instance().InviteIMusers(activeuser->identity->roomid, imjids);
}
catch(Ice::Exception& e){
MCE_WARN("RoomPool::EnterRoom --> call MucGate.InviteImUsers ERR line:"<<__LINE__<<" err:"<<e);
}
catch(std::exception& e){
MCE_WARN("RoomPool::EnterRoom --> call OnlineCenter.InviteImUsers ERR line:"<<__LINE__<<" err:"<<e.what());
}
}
*/
}
else if(PERMANENT == activeuser->identity->roomid->domain){
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());
}
//.........这里部分代码省略.........
示例13: offlineBatch
void OnlineStatSyncAdapter::offlineBatch(const JidSeq& seq) {
if (!seq.empty()) {
getManagerOneway(seq.size())->offlineBatch(seq);
}
}
示例14: 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);
}
}
示例15: getAvatars
AvatarSeq OnlineCenterAdapter::getAvatars(const JidSeq& jids) {
if(jids.empty()){
return AvatarSeq();
}
return getManager(jids.at(0)->userId)->getAvatars(jids);
}