本文整理汇总了C++中JidSeq类的典型用法代码示例。如果您正苦于以下问题:C++ JidSeq类的具体用法?C++ JidSeq怎么用?C++ JidSeq使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JidSeq类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MCE_DEBUG
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());
}
}
示例2: Jid
bool RoomInfo::AwayRoom(int userid){
bool awayok = false;
JidPtr jid = new Jid();
jid->userId = userid;
jid->index = 0;
JidSeq offlinejids;
Jid2ActiveUserMap::iterator nit = _jid2activeuser.lower_bound(jid);
for(; nit != _jid2activeuser.end(); ++nit){
if(nit->second->jid->userId == userid){
offlinejids.push_back(nit->second->jid);
//TaskManager::instance().execute(new PageCacheNotifyTask("offline", userid, nit->second->identity->roomid));
awayok = true;
}
else{
break;
}
}
for(JidSeq::iterator jit = offlinejids.begin(); jit != offlinejids.end(); ++jit){
AwayRoom((*jit));
}
//MCE_DEBUG("RoomInfo::AwayRoom --> userid = " << userid << " awayok = " << awayok);
return awayok;
}
示例3: 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;
}
示例4: 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();
}
示例5: MCE_DEBUG
/*
void WebSession::handle() {
MCE_DEBUG("WebSession::handle --> " << jidToString(_sessionJid));
if (::time(NULL) - _timestamp >= MAX_DURATION) {
WTalkProxyManagerI::instance().destroySession(this->_sessionJid);
} else {
if (_jidMap.empty()) {
TaskManager::instance().schedule(this);
}
}
}
*/
JidSeq WebSession::getAccessJid() {
JidSeq seq;
for (map<Ice::Long,JidPtr>::iterator it = _jidMap.begin(); it
!= _jidMap.end(); ++it) {
seq.push_back(it->second);
}
return seq;
}
示例6: 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;
}
示例7: MCE_DEBUG
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);
}
}
}
示例8: mucUserIdentityToString
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());
}
}
示例9: catch
void IqHandlerI::SendClientFocuslist(int uid,const Ice::Current& ic) {
string xml = "<presence ";
int res = 0;
MyUtil::IntSeq ans;
try {
ans = FeedFocusAdapter::instance().GetFocuses(uid);
res = 1;
} catch (Ice::Exception& e) {
MCE_WARN("IqGetTask::getfocuslist-->FeedFocusAdapter::GetFocuses error!"<<e.what());
res = 0;
} catch(...) {
MCE_WARN("IqGetTask::getfocuslist-->FeedFocusAdapter::GetFocuses error!");
res = 0;
}
if (res==0) {
xml += "res='0'><x xmlns='http://talk.xiaonei.com/focuslist'/>";
} else {
xml += "res='1'><x xmlns='http://talk.xiaonei.com/focuslist'>";
for (int i=0;i<ans.size();++i) {
ostringstream os;
os << ans[i];
xml += "<uid>";
xml += os.str();
xml += "</uid>";
}
xml += "</x>";
}
xml += "</presence>";
MCE_DEBUG(xml);
JidSeq jseq;
try {
jseq = TalkFunStateAdapter::instance().getUserJids(uid,4);
} catch(Ice::Exception& e) {
MCE_WARN("IqHandlerI::SendClientFocuslist-->TalkFunState::getUserJids error!"<<e.what());
return ;
}
for (JidSeq::iterator it = jseq.begin();it != jseq.end() ;++it) {
try {
TalkProxyAdapter::instance().express((*it), xml);
} catch(Ice::Exception& e) {
MCE_WARN("IqHandlerI::SendClientFocuslist-->TalkProxyAdapter::express error!"<<e.what());
}
}
return ;
}
示例10: MCE_DEBUG
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);
}
}
示例11: 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);
}
示例12: lock
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);
}
}
}
}
}
示例13: while
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)));
}
}
}
}
示例14: statF
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);
}