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


C++ ContactList类代码示例

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


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

示例1: newResults

void GaduSearchService::handleEventPubdir50SearchReply(struct gg_event *e)
{
	gg_pubdir50_t res = e->event.pubdir50;

	ContactList results;

	int count = gg_pubdir50_count(res);
	kdebugmf(KDEBUG_NETWORK|KDEBUG_INFO, "found %d results\n", count);

	for (int i = 0; i < count; i++)
	{
		Contact result;

		GaduContactAccountData *gcad = new GaduContactAccountData(result, Protocol->account(),
				gg_pubdir50_get(res, i, GG_PUBDIR50_UIN));

		result.addAccountData(gcad);
		result.setFirstName(cp2unicode(gg_pubdir50_get(res, i, GG_PUBDIR50_FIRSTNAME)));
		result.setLastName(cp2unicode(gg_pubdir50_get(res, i, GG_PUBDIR50_LASTNAME)));
		result.setNickName(cp2unicode(gg_pubdir50_get(res, i, GG_PUBDIR50_NICKNAME)));
		result.setBirthYear(QString::fromAscii(gg_pubdir50_get(res, i, GG_PUBDIR50_BIRTHYEAR)).toUShort());
		result.setCity(cp2unicode(gg_pubdir50_get(res, i, GG_PUBDIR50_CITY)));
		result.setFamilyName(cp2unicode(gg_pubdir50_get(res, i, GG_PUBDIR50_FAMILYNAME)));
		result.setFamilyCity(cp2unicode(gg_pubdir50_get(res, i, GG_PUBDIR50_FAMILYCITY)));
		result.setGender((ContactData::ContactGender)QString::fromAscii(gg_pubdir50_get(res, i, GG_PUBDIR50_GENDER)).toUShort());
		// TODO: 0.6.6
		// result.setStatus(gg_pubdir50_get(res, 0, GG_PUBDIR50_STATUS));

		results.append(result);
	}

	From = gg_pubdir50_next(res);

	emit newResults(results);
}
开发者ID:ziemniak,项目名称:kadu,代码行数:35,代码来源:gadu-search-service.cpp

示例2: ASSERT

uint32 CRoutingZone::GetBootstrapContacts(ContactList *plistResult, uint32 uMaxRequired)
{
	ASSERT(m_pSuperZone == NULL);
	plistResult->clear();
	uint32 uRetVal = 0;
	try
	{
		ContactList top;
		TopDepth(LOG_BASE_EXPONENT, &top);
		if (top.size() > 0)
		{
			for (ContactList::const_iterator itContactList = top.begin(); itContactList != top.end(); ++itContactList)
			{
				plistResult->push_back(*itContactList);
				uRetVal++;
				if (uRetVal == uMaxRequired)
					break;
			}
		}
	}
	catch (...)
	{
		AddDebugLogLine(false, _T("Exception in CRoutingZone::getBoostStrapContacts"));
	}
	return uRetVal;
}
开发者ID:tempbottle,项目名称:TestSet,代码行数:26,代码来源:RoutingZone.cpp

示例3: getFormedNativeContacts

ContactList* ContactTools::getFormedNativeContacts(ContactList* nativeContacts, Structure* comparisonStructure, double maxDistanceDeviation)
{
    // Get the sequence distance for each formed native contact.
    ContactList* formedNativeContacts = new ContactList;
    int i;
    for (i=0; i<nativeContacts->getNumberContacts(); i++)
    {
        Contact* nativeContact = nativeContacts->getContact(i);
        double nativeDistance = nativeContact->getContactDistance();
        
        // Find the contact in the comparison structure.
        Contact* comparisonContact = new Contact(comparisonStructure, nativeContact->getResidue1Index(), nativeContact->getAtom1Index(), nativeContact->getResidue2Index(), nativeContact->getAtom2Index());
        double comparisonDistance = comparisonContact->getContactDistance();
        
        if (nativeDistance-maxDistanceDeviation <= comparisonDistance && comparisonDistance <= nativeDistance+maxDistanceDeviation)
        {
            formedNativeContacts->addContact(comparisonContact);
        }
        else
        {
            // Otherwise delete the contact.
            delete comparisonContact;
            comparisonContact = NULL;
        }
    }
    
    return formedNativeContacts;
}
开发者ID:Eigenstate,项目名称:vmd-python,代码行数:28,代码来源:ContactTools.cpp

示例4: removeNonVoicemailContacts

void SipRedirectorPresenceRouting::removeNonVoicemailContacts( ContactList& contactList )
{
   // walk the list to find the contact entry for voicemail
   size_t index;
   Url contactUrl;
   bool bVoicemailContactFound = false;
   for( index = 0; index < contactList.entries(); index++ )
   {
      if( contactList.get( index, contactUrl ) )
      {
         UtlString userPart;
         contactUrl.getUserId( userPart );
         if( userPart.index( VOICEMAIL_CONTACT_PREFIX ) == 0 )
         {
            bVoicemailContactFound = true;
            break;
         }
      }
   }

   // if vm contact found, remove all and put vm contact back in.
   if( bVoicemailContactFound )
   {
      contactList.removeAll( *this );
      contactList.add( contactUrl, *this );
   }
}
开发者ID:astubbs,项目名称:sipxecs,代码行数:27,代码来源:SipRedirectorPresenceRouting.cpp

示例5: main

int main(int argc, char *argv[]) {
    QApplication app(argc, argv);
    ConfigurationStorage *config = ConfigurationStorage::instance();

    RSAKeyPair hostPair;

    QString keyName = config->getKeyName();

    if(!QFile::exists(keyName)) {
        if(!hostPair.generate(1024))
            Log::fatal("cannot generate new RSA keypair");

        if(!hostPair.writeToFile(keyName))
            Log::fatal("cannot write new RSA keypair");
    } else {
        if(!hostPair.readFromFile(keyName))
            Log::fatal("cannot read RSA keypair");
    }

    Router router;
    UdpPacketTransport transport(QHostAddress::Any, config->port());
    LinkLayer linkLayer(router, transport, hostPair);

    linkLayer.connect(&app, SIGNAL(aboutToQuit()), SLOT(exitNetwork()));

    ContactList contactList;
    MessagingApplicationLayer appLayer(contactList, linkLayer);
    Roster roster(contactList, linkLayer, appLayer);

    contactList.load();
    roster.show();

    return app.exec();
}
开发者ID:whitequark,项目名称:sparkle,代码行数:34,代码来源:main.cpp

示例6: ContactList

ContactList* ContactList::getSubsetExcluding(ContactList* excludeList)
{
   int i, j;
    ContactList* newList = new ContactList();
    for (i=0; i<getNumberContacts(); i++)
    {
        bool include = true;
        Contact* contact = getContact(i);
        for (j=0; j<excludeList->getNumberContacts(); j++)
        {
            if (*contact == *excludeList->getContact(j))
            {
                include = false;
                break;
            }
        }
        
        // If this contact should be included, add it to the list.
        if (include)
        {
            newList->addContact(new Contact(*contact));
        }
    }
    
    return newList;
}
开发者ID:Eigenstate,项目名称:vmd-python,代码行数:26,代码来源:ContactList.cpp

示例7: lookUp

 virtual RedirectPlugin::LookUpStatus lookUp(
    const SipMessage& message,
    const UtlString& requestString,
    const Url& requestUri,
    const UtlString& method,
    ContactList& contactList,
    RequestSeqNo requestSeqNo,
    int redirectorNo,
    SipRedirectorPrivateStorage*& privateStorage,
    ErrorDescriptor& errorDescriptor)
 {
    char diagMessage[100];
    sprintf( diagMessage, "%s::lookUp: contactList Size=%d", mLogName.data(), contactList.entries() );
    globalList.push_back( diagMessage );
    if( mBehavior.compareTo("ADD_SELF_AS_CONTACT") == 0 )
    {
       contactList.add( mLogName, *this );
       return RedirectPlugin::SUCCESS;
    }
    else if( mBehavior.compareTo("DONT_ADD_CONTACT") == 0 )
    {
       return RedirectPlugin::SUCCESS;
    }
    else if( mBehavior.compareTo("RETURN_ERROR") == 0 )
    {
       return RedirectPlugin::ERROR;
    }
    return RedirectPlugin::SUCCESS;
 }
开发者ID:astubbs,项目名称:sipxecs,代码行数:29,代码来源:DummyRedirectPlugin.cpp

示例8: getContacts

/**
 * Calculates thecontacts in a structure.
 *
 * @param structure The structure.
 * @param distanceCutoff The maximum distance between two residues from them to be considered in contact.
 * @param minSequenceDistance The minimum separation in the sequence for two residues to be considered contacts.
 * @param maxSequenceDistance The maximum separation in the sequence for two residues to be considered contacts.
 * @return The contacts present in the structure.
 */
ContactList* ContactTools::getContacts(Structure* structure, double distanceCutoff, int minSequenceDistance, int maxSequenceDistance)
{
    // Find all of the contacts within the cutoff distance.
    ContactList* contacts = new ContactList;
    int length = structure->getSize();
    int i, j, k, l;
    for (i=0; i<length-minSequenceDistance; i++)
    {
        int maxJ = length;
        if (maxSequenceDistance >= 0)
        {
            maxJ = i+maxSequenceDistance+1;
            if (maxJ > length) maxJ = length;
        }
            
        for (j=i+minSequenceDistance; j<maxJ; j++)
        {
            Residue* residue1 = structure->getResidue(i);
            Residue* residue2 = structure->getResidue(j);
            
            // If this is the same residue, process each atom pair only once.
            if (i == j)
            {
                for (k=0; k<residue1->getNumberAtoms()-1; k++)
                {
                    Atom* atom1 = residue1->getAtom(k);
                    for (l=k+1; l<residue2->getNumberAtoms(); l++)
                    {
                        Atom* atom2 = residue2->getAtom(l);
                        if (atom1->getDistanceTo(*atom2) <= distanceCutoff)
                        {
                            contacts->addContact(new Contact(structure, i, k, j, l));
                        }
                    }
                }
            }
            
            // Otherwise, process each atom pair.
            else
            {
                for (k=0; k<residue1->getNumberAtoms(); k++)
                {
                    Atom* atom1 = residue1->getAtom(k);
                    for (l=0; l<residue2->getNumberAtoms(); l++)
                    {
                        Atom* atom2 = residue2->getAtom(l);
                        if (atom1->getDistanceTo(*atom2) <= distanceCutoff)
                        {
                            contacts->addContact(new Contact(structure, i, k, j, l));
                        }
                    }
                }
            }
        }
    }
    
    return contacts;
}
开发者ID:Eigenstate,项目名称:vmd-python,代码行数:67,代码来源:ContactTools.cpp

示例9: GetEntries

void RoutingBin::GetEntries(ContactList &outList, bool bEmptyFirst)
{
	if(bEmptyFirst)
		outList.clear();
	if(nodeList.size() > 0)
	{
		outList.insert(outList.end(),nodeList.begin(),nodeList.end());
	}
}
开发者ID:NanYoMy,项目名称:KadCrawler,代码行数:9,代码来源:RoutingBin.cpp

示例10: importContacts

ContactList CsvXXPort::importContacts() const
{
    ContactList contactList;
    QPointer<CSVImportDialog> dlg = new CSVImportDialog(parentWidget());
    if (dlg->exec() && dlg) {
        contactList.setAddressList(dlg->contacts());
    }

    delete dlg;
    return contactList;
}
开发者ID:KDE,项目名称:kdepim,代码行数:11,代码来源:csv_xxport.cpp

示例11: importContacts

ContactList LDAPXXPort::importContacts() const
{
    ContactList contactList;
    QPointer<KLDAP::LdapSearchDialog> dlg = new KLDAP::LdapSearchDialog(parentWidget());

    if (dlg->exec() && dlg) {
        contactList.setAddressList(dlg->selectedContacts());
    }

    delete dlg;
    return contactList;
}
开发者ID:KDE,项目名称:kdepim,代码行数:12,代码来源:ldap_xxport.cpp

示例12: DebugLogWarning

void CRoutingZone::WriteFile()
{
	// don't overwrite a bootstrap nodes.dat with an empty one, if we didn't finished probing
	if (!CKademlia::s_liBootstapList.IsEmpty() && GetNumContacts() == 0){
		DebugLogWarning(_T("Skipped storing nodes.dat, because we have an unfinished bootstrap of the nodes.dat version and no contacts in our routing table"));
		return;
	}
	try
	{
		// Write a saved contact list.
		CUInt128 uID;
		CSafeBufferedFile file;
		CFileException fexp;
		if (file.Open(m_sFilename, CFile::modeWrite | CFile::modeCreate | CFile::typeBinary|CFile::shareDenyWrite, &fexp))
		{
			setvbuf(file.m_pStream, NULL, _IOFBF, 32768);

			// The bootstrap method gets a very nice sample of contacts to save.
			ContactList listContacts;
			GetBootstrapContacts(&listContacts, 200);
			// Start file with 0 to prevent older clients from reading it.
			file.WriteUInt32(0);
			// Now tag it with a version which happens to be 2 (1 till 0.48a).
			file.WriteUInt32(2);
			// file.WriteUInt32(0) // if we would use version >=3, this would mean that this is a normal nodes.dat
			file.WriteUInt32((uint32_t)listContacts.size());
			for (ContactList::const_iterator itContactList = listContacts.begin(); itContactList != listContacts.end(); ++itContactList)
			{
				CContact* pContact = *itContactList;
				pContact->GetClientID(&uID);
				file.WriteUInt128(&uID);
				file.WriteUInt32(pContact->GetIPAddress());
				file.WriteUInt16(pContact->GetUDPPort());
				file.WriteUInt16(pContact->GetTCPPort());
				file.WriteUInt8(pContact->GetVersion());
				pContact->GetUDPKey().StoreToFile(file);
				file.WriteUInt8(pContact->IsIpVerified() ? 1 : 0);
			}
			file.Close();
			AddDebugLogLine( false, _T("Wrote %ld contact%s to file."), listContacts.size(), ((listContacts.size() == 1) ? _T("") : _T("s")));
		}
		else
			DebugLogError(_T("Unable to store Kad file: %s"), m_sFilename);
	}
	catch (CFileException* e)
	{
		e->Delete();
		AddDebugLogLine(false, _T("CFileException in CRoutingZone::writeFile"));
	}
}
开发者ID:HackLinux,项目名称:eMule-IS-Mod,代码行数:50,代码来源:RoutingZone.cpp

示例13: ContactList

void ContactCluster::sList()
{
    ContactList* newdlg = new ContactList(this);
    if (newdlg)
    {
	int id = newdlg->exec();
	setId(id);
    }
    else
	QMessageBox::critical(this, tr("A System Error Occurred at %1::%2.")
				      .arg(__FILE__)
				      .arg(__LINE__),
			      tr("Could not instantiate a List Dialog"));
}
开发者ID:,项目名称:,代码行数:14,代码来源:

示例14: exportContacts

bool CsvXXPort::exportContacts(const ContactList &contacts, VCardExportSelectionWidget::ExportFields) const
{
    QUrl url = QFileDialog::getSaveFileUrl(parentWidget(), QString(), QUrl::fromLocalFile(QStringLiteral("addressbook.csv")));
    if (url.isEmpty()) {
        return true;
    }

    if (QFileInfo(url.isLocalFile() ? url.toLocalFile() : url.path()).exists()) {
        if (url.isLocalFile() && QFileInfo(url.toLocalFile()).exists()) {
            PimCommon::RenameFileDialog::RenameFileDialogResult result = PimCommon::RenameFileDialog::RENAMEFILE_IGNORE;
            PimCommon::RenameFileDialog *dialog = new PimCommon::RenameFileDialog(url, false, parentWidget());
            result = static_cast<PimCommon::RenameFileDialog::RenameFileDialogResult>(dialog->exec());
            if (result == PimCommon::RenameFileDialog::RENAMEFILE_RENAME) {
                url = dialog->newName();
            } else if (result == PimCommon::RenameFileDialog::RENAMEFILE_IGNORE) {
                delete dialog;
                return true;
            }
            delete dialog;
        }
    }

    if (!url.isLocalFile()) {
        QTemporaryFile tmpFile;
        if (!tmpFile.open()) {
            const QString msg = i18n("<qt>Unable to open file <b>%1</b></qt>", url.url());
            KMessageBox::error(parentWidget(), msg);
            return false;
        }

        exportToFile(&tmpFile, contacts.addressList());
        tmpFile.flush();
        auto job = KIO::file_copy(QUrl::fromLocalFile(tmpFile.fileName()), url, -1, KIO::Overwrite);
        KJobWidgets::setWindow(job, parentWidget());
        return job->exec();
    } else {
        QFile file(url.toLocalFile());
        if (!file.open(QIODevice::WriteOnly)) {
            const QString msg = i18n("<qt>Unable to open file <b>%1</b>.</qt>", url.toLocalFile());
            KMessageBox::error(parentWidget(), msg);
            return false;
        }

        exportToFile(&file, contacts.addressList());
        file.close();

        return true;
    }
}
开发者ID:KDE,项目名称:kdepim,代码行数:49,代码来源:csv_xxport.cpp

示例15: loadAvatars

void ContactsTreeWidget::loadAvatars() {
  appInstance->logEvent("ContactsTreeWidget::loadAvatars()", SEVERITY_DEBUG);
  GroupList *gl = appInstance->mUser->getGroupList();
  ContactList *cl;
  ContactList::iterator clIt;
  GroupList::iterator glIt;
  for(glIt = gl->begin(); glIt != gl->end(); glIt++) {
    cl = glIt->second.contacts();
    for(clIt = cl->begin(); clIt != cl->end(); clIt++) {
      if (addedContacts[clIt->getIndex()]) {
        clIt->setAvatar(MrimUtils::prepareAvatar(clIt->getAddress()));
        addedContacts[clIt->getIndex()][columns.contactAvatar] = resizeAvatar(clIt->getAvatar());
      }
    }
  }
}
开发者ID:hamzehpourahmad,项目名称:swift-im,代码行数:16,代码来源:ContactsTreeWidget.cpp


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