예제 #1
0
파일: adduserdlg.cpp 프로젝트: DiGMi/psi
void AddUserDlg::resolveNickFinished()
{
	JT_VCard *jt = (JT_VCard *)sender();

	if(jt->success()) {
		if ( !jt->vcard().nickName().isEmpty() )
			le_nick->setText( jt->vcard().nickName() );
		else if( !jt->vcard().fullName().isEmpty() )
			le_nick->setText( jt->vcard().fullName() );
	}
}
예제 #2
0
void AddUserDlg::resolveNickFinished()
{
	JT_VCard *jt = (JT_VCard *)sender();

	if(jt->success()) {
		QString nickname;
		const XMPP::VCard vcard = jt->vcard();
		if ( !vcard.nickName().isEmpty() ) {
			nickname = vcard.nickName();
		} else if ( !vcard.fullName().isEmpty() ) {
			nickname = vcard.fullName();
		} else {
			nickname = vcard.givenName();
			if ( nickname.isEmpty() ) {
				nickname = vcard.middleName();
			} else if ( !vcard.middleName().isEmpty() ) {
				nickname += " " + vcard.middleName();
			}
			if ( nickname.isEmpty() ) {
				nickname = vcard.familyName();
			} else if ( !vcard.familyName().isEmpty() ) {
				nickname += " " + vcard.familyName();
			}
		}

		if ( nickname.isEmpty() ) {
			nickname = jt->jid().bare();
		}
		le_nick->setText(nickname);
	}
}
예제 #3
0
void VCardFactory::selfVCardTaskFinished()
{
	JT_VCard *task = (JT_VCard *)sender();
	
	isFetchingMyVCard_ = false;
	hasFetchedMyVCard_ = true;
	
	myVCard_ = (task->success() ? task->vcard() : VCard());
	emit selfVCardChanged();
}
예제 #4
0
void VCardFactory::taskFinished()
{
	JT_VCard *task = (JT_VCard *)sender();
	if ( task->success() ) {
		Jid j = task->jid();

		VCard *vcard = new VCard;
		*vcard = task->vcard();
		checkLimit(j.userHost(), vcard);

		// save vCard to disk
		QFile file ( vCardsDir_ + "/" + JIDUtil::encode(j.userHost()).lower() + ".xml" );
		file.open ( QIODevice::WriteOnly );
		QTextStream out ( &file );
		out.setEncoding ( QTextStream::UnicodeUTF8 );
		QDomDocument doc;
		doc.appendChild( vcard->toXml ( &doc ) );
		out << doc.toString(4);

		emit vcardChanged(j);
	}
}