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


C++ ref::setFrom方法代码示例

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


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

示例1: handleIncomingPresence

void PresenceOracle::handleIncomingPresence(Presence::ref presence) {
	// ignore presences for some contact, we're checking only presences for the transport itself here.
	// filter out login/logout presence spam
	if (!presence->getTo().getNode().empty())
		return;

	JID bareJID(presence->getFrom().toBare());
	if (presence->getType() == Presence::Subscribe || presence->getType() == Presence::Subscribed) {
	}
	else {
		Presence::ref passedPresence = presence;
		if (presence->getType() == Presence::Unsubscribe || presence->getType() == Presence::Unsubscribed) {
			/* 3921bis says that we don't follow up with an unavailable, so simulate this ourselves */
			passedPresence = Presence::ref(new Presence());
			passedPresence->setType(Presence::Unavailable);
			passedPresence->setFrom(bareJID);
			passedPresence->setStatus(presence->getStatus());
		}
		std::map<JID, boost::shared_ptr<Presence> > jidMap = entries_[bareJID];
		if (passedPresence->getFrom().isBare() && presence->getType() == Presence::Unavailable) {
			/* Have a bare-JID only presence of offline */
			jidMap.clear();
		} else if (passedPresence->getType() == Presence::Available) {
			/* Don't have a bare-JID only offline presence once there are available presences */
			jidMap.erase(bareJID);
		}
		if (passedPresence->getType() == Presence::Unavailable && jidMap.size() > 1) {
			jidMap.erase(passedPresence->getFrom());
		} else {
			jidMap[passedPresence->getFrom()] = passedPresence;
		}
		entries_[bareJID] = jidMap;
		onPresenceChange(passedPresence);
	}
}
开发者ID:HazWard,项目名称:spectrum2,代码行数:35,代码来源:PresenceOracle.cpp

示例2: handleIncomingPresence

void PresenceOracle::handleIncomingPresence(Presence::ref presence) {
	JID bareJID(presence->getFrom().toBare());
	if (presence->getType() == Presence::Subscribe) {
	}
	else {
		Presence::ref passedPresence = presence;
		if (presence->getType() == Presence::Unsubscribe) {
			/* 3921bis says that we don't follow up with an unavailable, so simulate this ourselves */
			passedPresence = Presence::ref(new Presence());
			passedPresence->setType(Presence::Unavailable);
			passedPresence->setFrom(bareJID);
			passedPresence->setStatus(presence->getStatus());
		}
		std::map<JID, boost::shared_ptr<Presence> > jidMap = entries_[bareJID];
		if (passedPresence->getFrom().isBare() && presence->getType() == Presence::Unavailable) {
			/* Have a bare-JID only presence of offline */
			jidMap.clear();
		} else if (passedPresence->getType() == Presence::Available) {
			/* Don't have a bare-JID only offline presence once there are available presences */
			jidMap.erase(bareJID);
		}
		if (passedPresence->getType() == Presence::Unavailable && jidMap.size() > 1) {
			jidMap.erase(passedPresence->getFrom());
		} else {
			jidMap[passedPresence->getFrom()] = passedPresence;
		}
		entries_[bareJID] = jidMap;
		onPresenceChange(passedPresence);
	}
}
开发者ID:pedrosorren,项目名称:swift,代码行数:30,代码来源:PresenceOracle.cpp

示例3: createPresence

		Presence::ref createPresence(const JID &jid, int priority, Presence::Type type, const StatusShow::Type& statusShow) {
			Presence::ref presence = boost::make_shared<Presence>();
			presence->setFrom(jid);
			presence->setPriority(priority);
			presence->setType(type);
			presence->setShow(statusShow);
			return presence;
		}
开发者ID:scopeInfinity,项目名称:swift,代码行数:8,代码来源:PresenceOracleTest.cpp

示例4: handleJIDRemoved

void PresenceOracle::handleJIDRemoved(const JID& removedJID) {
    /* 3921bis says that we don't follow up with an unavailable, so simulate this ourselves */
    Presence::ref unavailablePresence = Presence::ref(new Presence());
    unavailablePresence->setType(Presence::Unavailable);
    unavailablePresence->setFrom(removedJID);

    if (entries_.find(removedJID) != entries_.end()) {
        entries_[removedJID].clear();
        entries_[removedJID][removedJID] = unavailablePresence;
    }

    onPresenceChange(unavailablePresence);
}
开发者ID:swift,项目名称:swift,代码行数:13,代码来源:PresenceOracle.cpp


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