コード例 #1
0
boost::optional<JID> CombinedOutgoingFileTransferManager::highestPriorityJIDSupportingJingle(const JID& bareJID) {
	JID fullReceipientJID;
	int priority = INT_MIN;
	
	//getAllPresence(bareJID) gives you all presences for the bare JID (i.e. all resources) Remko Tronçon @ 11:11
	std::vector<Presence::ref> presences = presenceOracle->getAllPresence(bareJID);

	//iterate over them
	foreach(Presence::ref pres, presences) {
		if (pres->getPriority() > priority) {
			// look up caps from the jid
			DiscoInfo::ref info = capsProvider->getCaps(pres->getFrom());
			if (info && info->hasFeature(DiscoInfo::JingleFeature) && info->hasFeature(DiscoInfo::JingleFTFeature) &&
				info->hasFeature(DiscoInfo::JingleTransportsIBBFeature)) {
			
				priority = pres->getPriority();
				fullReceipientJID = pres->getFrom();
			}
		}
	}
	
	return fullReceipientJID.isValid() ? boost::optional<JID>(fullReceipientJID) : boost::optional<JID>();
}
コード例 #2
0
JID WhiteboardSessionManager::getFullJID(const JID& bareJID) {
    JID fullReceipientJID;
    int priority = INT_MIN;

    //getAllPresence(bareJID) gives you all presences for the bare JID (i.e. all resources) Remko Tronçon @ 11:11
    std::vector<Presence::ref> presences = presenceOracle_->getAllPresence(bareJID);

    //iterate over them
    foreach(Presence::ref pres, presences) {
        if (pres->getPriority() > priority) {
            // look up caps from the jid
            DiscoInfo::ref info = capsProvider_->getCaps(pres->getFrom());
            if (info && info->hasFeature(DiscoInfo::WhiteboardFeature)) {
                priority = pres->getPriority();
                fullReceipientJID = pres->getFrom();
            }
        }
    }

    return fullReceipientJID;
}