示例#1
0
void ParticipantList::populate( const Contacts& rContacts, IMChatSession& imChatSession )
{
	Participant participant;
	IMContact*  imContact = NULL;
	bool		bAlreadyInChat = false;

	for ( Contacts::const_iterator it = rContacts.begin(); it != rContacts.end(); it++ )
	{
		if ( includeInCandidateList( (*it).second, imChatSession, bAlreadyInChat ) )
		{
			Contact c = (*it).second;
			imContact = c.getPreferredIMContact();

			participant.setIMContact      ( *imContact			 );
			participant.setDisplayName	  ( c.getDisplayName()   );
			participant.setIsAlreadyInChat( bAlreadyInChat		 );
			participant.setPixmap		  ( determineStatus( c ) );

			Add( &participant );
		}
	}
}
示例#2
0
int
Read::run(int, char*[])
{
    ConnectionPtr connection = createConnection(communicator(), "db");
    const Contacts contacts(connection, "contacts", false);
    
    Contacts::const_iterator p;

    cout << "All contacts (default order)" << endl;
    for(p = contacts.begin(); p != contacts.end(); ++p)
    {
        cout << p->first << ":\t\t" << p->second.phoneNumber << endl;
    }

    cout << endl << "All contacts (ordered by phone number)" << endl;
    for(p = contacts.beginForPhoneNumber(); p != contacts.endForPhoneNumber(); ++p)
    {
        cout << p->first << ":\t\t" << p->second.phoneNumber << endl;
    }
    
    return 0;
}