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); } }
void JabberPersonalInfoService::fetchingVCardFinished() { XMPP::VCard vcard; XMPP::JT_VCard *task = (XMPP::JT_VCard *)sender(); if (task && task->success()) { vcard = task->vcard(); CurrentBuddy.setNickName(vcard.nickName()); CurrentBuddy.setFirstName(vcard.fullName()); CurrentBuddy.setFamilyName(vcard.familyName()); QDate bday = QDate::fromString(vcard.bdayStr(), "yyyy-MM-dd"); if (bday.isValid() && !bday.isNull()) CurrentBuddy.setBirthYear(bday.year()); if (vcard.addressList().count() > 0) CurrentBuddy.setCity(vcard.addressList().at(0).locality); if (vcard.emailList().count() > 0) CurrentBuddy.setEmail(vcard.emailList().at(0).userid); CurrentBuddy.setWebsite(vcard.url()); emit personalInfoAvailable(CurrentBuddy); } }