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


C++ Contact::getKey方法代码示例

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


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

示例1: makeContactCallThreadSafe

void CUserProfile::makeContactCallThreadSafe(std::string contactId) {
	Contact * contact = _cContactList.getContact(contactId);
	
	if (contact) 
	{
		//VOXOXCHANGE CJC CALL VOXOX NUMBERS
		if(contact->getIsIMAccountVoxox())
		{
			//We don't get the number if we already have it//TODO CHANGE THIS IF NUMBERS ARE CHANGED FREQUENTLY
			if(!contact->getVoxOxPhone().empty())
			{
				EnumMakeCallError::MakeCallError error = _userProfile.makeCall(*contact);
				if (error != EnumMakeCallError::NoError) 
				{
					makeCallErrorEvent(*this, error, contact->getVoxOxPhone());//VOXOX CHANGE by Rolando - 2009.05.29 - added parameter phonenumber to check what call failed
				}
			}
			else
			{
				if(_userProfile.getWsContactNumber())
				{
					WsContactNumber & wsContactNumber = *_userProfile.getWsContactNumber();
					wsContactNumber.setContactId(contact->getKey());
					wsContactNumber.contactNumberEvent +=	boost::bind(&CUserProfile::contactNumberEventHandler, this, _1, _2, _3);
					wsContactNumber.execute();
				}
			}	

		}else if(contact->getQtIMProtocol() == QtEnumIMProtocol::IMProtocolSkype){
			_userProfile.makeCall(*contact);
		}
		else
		{
			EnumMakeCallError::MakeCallError error = _userProfile.makeCall(*contact);
			if (error != EnumMakeCallError::NoError) 
			{
				makeCallErrorEvent(*this, error, contactId);//VOXOX CHANGE by Rolando - 2009.05.29 - added parameter contactId to check what call failed
			}
		}
	}
	else
	{
		makeCallErrorEvent(*this, EnumMakeCallError::ContactNotFound, contactId);//VOXOX CHANGE by Rolando - 2009.05.29 - added parameter contactId to check what call failed
	}
}
开发者ID:,项目名称:,代码行数:45,代码来源:

示例2: removeChatMementoSession

void History::removeChatMementoSession(IMChatSession * imchatSession) {
	int chatSessionID = imchatSession->getId();

	HistoryMementoCollection * collection = NULL;
	if((collection = _chatSessionsMementos[chatSessionID]) != NULL){
		//seek for history chat
		int nbhistory = 0;
		HistoryMap::iterator ithm;
		for (ithm = collection->begin(); ithm != collection->end(); ++ithm) {
			HistoryMemento* hm = ithm->second;

			// duration -1 means it is an history message
			if( hm->getDuration() != -1 ) {
				break;
			}
			++nbhistory;
		}
		////

		// don't save empty chat history
		int size = collection->size() - nbhistory;
		if(size>0) {
			//save chat log
			Date saveDate;
			Time saveTime;
			std::string peer = "";
			std::string filechat =	String::fromNumber(saveDate.getYear(), 2) + String::fromNumber(saveDate.getMonth(), 2) + 
									String::fromNumber(saveDate.getDay(), 2) + String::fromNumber(saveTime.getHour(), 2) + 
									String::fromNumber(saveTime.getMinute(), 2) + String::fromNumber(saveTime.getSecond(), 2)+
									"_" + String::fromNumber(chatSessionID);
			Config & config = ConfigManager::getInstance().getCurrentConfig();
			std::string saverep = File::convertPathSeparators( 
				config.getConfigDir() + "chatlogs" + File::getPathSeparator() 
				+ _userProfile.getName() + File::getPathSeparator() 
			);
			File::createPath(saverep);
			//save file should be unique
			while(File::exists(saverep + filechat + ".xml")) {
				filechat += "_f";
			}
			////
			FileWriter file(saverep + filechat+".xml");
			std::stringstream ss;
			bool serializedSuccessfully = false;
			try {
				boost::archive::xml_oarchive oa(ss);

				//constructs list of login per peer
				std::map<std::string, std::vector<std::string>*> aliasMap;
				IMContactSet contactSet = imchatSession->getIMContactSet();
				for (IMContactSet::const_iterator itc = contactSet.begin(); itc != contactSet.end(); ++itc) {
					Contact * thecontact = _userProfile.getContactList().findContactThatOwns(*itc);
					std::string cuuid = "unrecognized";
					if(thecontact) {
//						cuuid = thecontact->getUUID();
						cuuid = thecontact->getKey();	//VOXOX - JRT - 2009.04.28 
					}	

					if(aliasMap[cuuid] == NULL) {
						aliasMap[cuuid] = new std::vector<std::string>;
					}
//					aliasMap[cuuid]->push_back(itc->cleanContactId());	//VOXOX - JRT - 2009.04.10 
					aliasMap[cuuid]->push_back(itc->getCleanContactId());
				}
				////

				// saves number of peer in this chat
				int nbcontact = aliasMap.size();
				oa << BOOST_SERIALIZATION_NVP(nbcontact);
				////

				//links all peers to this chat
				for(std::map<std::string, std::vector<std::string>*>::const_iterator itam = aliasMap.begin();
					itam != aliasMap.end(); ++itam) {
				
					/** links peer -> chat */

					//filechat
					std::string tobewritten = "<chat>\n\t<id>"+filechat+"</id>\n";

					//different login used by this peer during this chat
					for(std::vector<std::string>::const_iterator itv = itam->second->begin(); itv != itam->second->end(); ++itv) {
						tobewritten += "\t<alias>" + (*itv) + "</alias>\n";
						
						peer += "," + (*itv);
					}
					
					////

					tobewritten += "</chat>\n";
					/////
	
					std::string cuuid = itam->first;
					FileWriter contactFile( saverep + cuuid + ".xml" );
					contactFile.setAppendMode(true);
					contactFile.write(tobewritten);

					/** links chat -> peer */
					oa << BOOST_SERIALIZATION_NVP(cuuid);
				}
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


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