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


C++ JID::isBare方法代码示例

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


在下文中一共展示了JID::isBare方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: routeStanza

bool ServerStanzaRouter::routeStanza(boost::shared_ptr<Stanza> stanza) {
    JID to = stanza->getTo();
    assert(to.isValid());

    // For a full JID, first try to route to a session with the full JID
    if (!to.isBare()) {
        std::vector<ServerSession*>::const_iterator i = std::find_if(clientSessions_.begin(), clientSessions_.end(), HasJID(to));
        if (i != clientSessions_.end()) {
            (*i)->sendStanza(stanza);
            return true;
        }
    }

    // Look for candidate sessions
    to = to.toBare();
    std::vector<ServerSession*> candidateSessions;
    for (std::vector<ServerSession*>::const_iterator i = clientSessions_.begin(); i != clientSessions_.end(); ++i) {
        if ((*i)->getJID().equals(to, JID::WithoutResource) && (*i)->getPriority() >= 0) {
            candidateSessions.push_back(*i);
        }
    }
    if (candidateSessions.empty()) {
        return false;
    }

    // Find the session with the highest priority
    std::vector<ServerSession*>::const_iterator i = std::max_element(clientSessions_.begin(), clientSessions_.end(), PriorityLessThan());
    (*i)->sendStanza(stanza);
    return true;
}
开发者ID:smuralireddy,项目名称:swift,代码行数:30,代码来源:ServerStanzaRouter.cpp

示例2: send

void ServerStanzaChannel::send(SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<Stanza> stanza) {
	JID to = stanza->getTo();
	assert(to.isValid());

	if (!stanza->getFrom().isValid()) {
		stanza->setFrom(m_jid);
	}

	// For a full JID, first try to route to a session with the full JID
	if (!to.isBare()) {
		std::list<SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ServerFromClientSession> >::const_iterator i = std::find_if(sessions[stanza->getTo().toBare().toString()].begin(), sessions[stanza->getTo().toBare().toString()].end(), HasJID(to));
		if (i != sessions[stanza->getTo().toBare().toString()].end()) {
			(*i)->sendElement(stanza);
			return;
		}
	}

	// Look for candidate sessions
	to = to.toBare();
	std::vector<SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ServerFromClientSession> > candidateSessions;
	for (std::list<SWIFTEN_SHRPTR_NAMESPACE::shared_ptr<ServerFromClientSession> >::const_iterator i = sessions[stanza->getTo().toBare().toString()].begin(); i != sessions[stanza->getTo().toBare().toString()].end(); ++i) {
		if ((*i)->getRemoteJID().equals(to, JID::WithoutResource)) {
			candidateSessions.push_back(*i);
			(*i)->sendElement(stanza);
		}
	}
	if (candidateSessions.empty()) {
		return;
	}

	// Find the session with the highest priority
// 	std::vector<ServerSession*>::const_iterator i = std::max_element(sessions.begin(), sessions.end(), PriorityLessThan());
// 	(*i)->sendStanza(stanza);
	return;
}
开发者ID:hanzz,项目名称:spectrum2,代码行数:35,代码来源:ServerStanzaChannel.cpp

示例3: createOutgoingSession

OutgoingWhiteboardSession::ref WhiteboardSessionManager::createOutgoingSession(const JID& to) {
    JID fullJID = to;
    if (fullJID.isBare()) {
        fullJID = getFullJID(fullJID);
    }
    OutgoingWhiteboardSession::ref session = boost::make_shared<OutgoingWhiteboardSession>(fullJID, router_);
    sessions_[fullJID] = session;
    session->onSessionTerminated.connect(boost::bind(&WhiteboardSessionManager::deleteSessionEntry, this, _1));
    session->onRequestRejected.connect(boost::bind(&WhiteboardSessionManager::deleteSessionEntry, this, _1));
    return session;
}
开发者ID:scopeInfinity,项目名称:swift,代码行数:11,代码来源:WhiteboardSessionManager.cpp


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