本文整理汇总了C++中QXmppVCardIq::lastName方法的典型用法代码示例。如果您正苦于以下问题:C++ QXmppVCardIq::lastName方法的具体用法?C++ QXmppVCardIq::lastName怎么用?C++ QXmppVCardIq::lastName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QXmppVCardIq
的用法示例。
在下文中一共展示了QXmppVCardIq::lastName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initVCard
void MyXmppClient::initVCard(const QXmppVCardIq &vCard)
{
QString bareJid = vCard.from();
RosterItemModel *item = (RosterItemModel*)cachedRoster->find( bareJid );
vCardData dataVCard;
if( item != 0 )
{
/* set nickname */
QXmppRosterIq::Item itemRoster = rosterManager->getRosterEntry( bareJid );
QString nickName = vCard.nickName();
if( (!nickName.isEmpty()) && (!nickName.isNull()) && (itemRoster.name().isEmpty()) ) {
qDebug() << "MyXmppClient::initPresence: updating name for"<< bareJid;
item->setContactName( nickName );
}
/* avatar */
bool isAvatarCreated = true;
QString avatarFile = cacheIM->getAvatarCache( bareJid );
if( (avatarFile.isEmpty() || avatarFile == "qrc:/avatar" || (flVCardRequest != "")) && vCard.photo() != "" ) {
isAvatarCreated = cacheIM->setAvatarCache( bareJid, vCard.photo() );
}
item->setAvatar(cacheIM->getAvatarCache(bareJid));
dataVCard.nickName = nickName;
dataVCard.firstName = vCard.firstName();
dataVCard.fullName = vCard.fullName();;
dataVCard.middleName = vCard.middleName();
dataVCard.lastName = vCard.lastName();
dataVCard.url = vCard.url();
dataVCard.eMail = vCard.email();
if( flVCardRequest == bareJid ) {
qmlVCard->setPhoto( avatarFile );
qmlVCard->setNickName( vCard.nickName() );
qmlVCard->setMiddleName( vCard.middleName() );
qmlVCard->setLastName( vCard.lastName() );
qmlVCard->setFullName( vCard.fullName() );
qmlVCard->setName( vCard.firstName() );
qmlVCard->setBirthday( vCard.birthday().toString("dd.MM.yyyy") );
qmlVCard->setEMail( vCard.email() );
qmlVCard->setUrl( vCard.url() );
qmlVCard->setJid( bareJid );
flVCardRequest = "";
emit vCardChanged();
}
cacheIM->setVCard( bareJid, dataVCard );
}
}
示例2: SetNickFromVCard
void EntryBase::SetNickFromVCard (const QXmppVCardIq& vcard)
{
if (!vcard.nickName ().isEmpty ())
{
SetEntryName (vcard.nickName ());
return;
}
if (!vcard.fullName ().isEmpty ())
{
SetEntryName (vcard.fullName ());
return;
}
const QString& fn = vcard.firstName ();
const QString& mn = vcard.middleName ();
const QString& ln = vcard.lastName ();
QString name = fn;
if (!fn.isEmpty ())
name += " ";
name += mn;
if (!mn.isEmpty ())
name += " ";
name += ln;
name = name.trimmed ();
if (!name.isEmpty ())
SetEntryName (name);
}
示例3: initVCard
void MyXmppClient::initVCard(const QXmppVCardIq &vCard)
{
QString bareJid = vCard.from();
RosterItemModel *item = (RosterItemModel*)cachedRoster->find( bareJid );
vCardData dataVCard;
if( item != 0 )
{
/* set nickname */
QXmppRosterIq::Item itemRoster = rosterManager->getRosterEntry( bareJid );
QString nickName = vCard.nickName();
if( (!nickName.isEmpty()) && (!nickName.isNull()) && (itemRoster.name().isEmpty()) ) {
qDebug() << "MyXmppClient::initPresence: updating name for"<< bareJid;
item->setContactName( nickName );
}
/* avatar */
bool isAvatarCreated = true;
QString avatarFile = cacheIM->getAvatarCache( bareJid );
if( (avatarFile.isEmpty() || avatarFile == "qrc:/avatar") && vCard.photo() != "" && !disableAvatarCaching) {
isAvatarCreated = cacheIM->setAvatarCache( bareJid, vCard.photo() );
}
item->setAvatar(cacheIM->getAvatarCache(bareJid));
dataVCard.nickName = nickName;
dataVCard.firstName = vCard.firstName();
dataVCard.fullName = vCard.fullName();;
dataVCard.middleName = vCard.middleName();
dataVCard.lastName = vCard.lastName();
dataVCard.url = vCard.url();
dataVCard.eMail = vCard.email();
cacheIM->setVCard( bareJid, dataVCard );
}
}
示例4: testVCard
void TestPackets::testVCard()
{
const QByteArray xml(
"<iq id=\"vcard1\" type=\"set\">"
"<vCard xmlns=\"vcard-temp\">"
"<BDAY>1983-09-14</BDAY>"
"<EMAIL><INTERNET/><USERID>[email protected]</USERID></EMAIL>"
"<FN>Foo Bar!</FN>"
"<NICKNAME>FooBar</NICKNAME>"
"<N><GIVEN>Foo</GIVEN><FAMILY>Wiz</FAMILY><MIDDLE>Baz</MIDDLE></N>"
"<PHOTO>"
"<TYPE>image/png</TYPE>"
"<BINVAL>"
"iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAIAAABLbSncAAAAAXNSR0IArs4c6QAAAAlwSFlzAAA"
"UIgAAFCIBjw1HyAAAAAd0SU1FB9oIHQInNvuJovgAAAAiSURBVAjXY2TQ+s/AwMDAwPD/GiMDlP"
"WfgYGBiQEHGJwSAK2BBQ1f3uvpAAAAAElFTkSuQmCC"
"</BINVAL>"
"</PHOTO>"
"</vCard>"
"</iq>");
QXmppVCardIq vcard;
parsePacket(vcard, xml);
QCOMPARE(vcard.birthday(), QDate(1983, 9, 14));
QCOMPARE(vcard.email(), QLatin1String("[email protected]"));
QCOMPARE(vcard.nickName(), QLatin1String("FooBar"));
QCOMPARE(vcard.fullName(), QLatin1String("Foo Bar!"));
QCOMPARE(vcard.firstName(), QLatin1String("Foo"));
QCOMPARE(vcard.middleName(), QLatin1String("Baz"));
QCOMPARE(vcard.lastName(), QLatin1String("Wiz"));
QCOMPARE(vcard.photo(), QByteArray::fromBase64(
"iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAIAAABLbSncAAAAAXNSR0IArs4c6QAAAAlwSFlzAAA"
"UIgAAFCIBjw1HyAAAAAd0SU1FB9oIHQInNvuJovgAAAAiSURBVAjXY2TQ+s/AwMDAwPD/GiMDlP"
"WfgYGBiQEHGJwSAK2BBQ1f3uvpAAAAAElFTkSuQmCC"));
QCOMPARE(vcard.photoType(), QLatin1String("image/png"));
serializePacket(vcard, xml);
}
示例5: testVCard
void tst_QXmppVCardIq::testVCard()
{
const QByteArray xml(
"<iq id=\"vcard1\" type=\"set\">"
"<vCard xmlns=\"vcard-temp\">"
"<ADR><CTRY>France</CTRY></ADR>"
"<BDAY>1983-09-14</BDAY>"
"<DESC>I like XMPP.</DESC>"
"<EMAIL><INTERNET/><USERID>[email protected]</USERID></EMAIL>"
"<FN>Foo Bar!</FN>"
"<NICKNAME>FooBar</NICKNAME>"
"<N><GIVEN>Foo</GIVEN><FAMILY>Wiz</FAMILY><MIDDLE>Baz</MIDDLE></N>"
"<TEL><HOME/><NUMBER>12345</NUMBER></TEL>"
"<TEL><WORK/><NUMBER>67890</NUMBER></TEL>"
"<PHOTO>"
"<TYPE>image/png</TYPE>"
"<BINVAL>"
"iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAIAAABLbSncAAAAAXNSR0IArs4c6QAAAAlwSFlzAAA"
"UIgAAFCIBjw1HyAAAAAd0SU1FB9oIHQInNvuJovgAAAAiSURBVAjXY2TQ+s/AwMDAwPD/GiMDlP"
"WfgYGBiQEHGJwSAK2BBQ1f3uvpAAAAAElFTkSuQmCC"
"</BINVAL>"
"</PHOTO>"
"<URL>https://github.com/qxmpp-project/qxmpp/</URL>"
"<ORG>"
"<ORGNAME>QXmpp foundation</ORGNAME>"
"<ORGUNIT>Main QXmpp dev unit</ORGUNIT>"
"</ORG>"
"<TITLE>Executive Director</TITLE>"
"<ROLE>Patron Saint</ROLE>"
"</vCard>"
"</iq>");
QXmppVCardIq vcard;
parsePacket(vcard, xml);
QCOMPARE(vcard.addresses().size(), 1);
QCOMPARE(vcard.addresses()[0].country(), QLatin1String("France"));
QCOMPARE(int(vcard.addresses()[0].type()), int(QXmppVCardEmail::None));
QCOMPARE(vcard.birthday(), QDate(1983, 9, 14));
QCOMPARE(vcard.description(), QLatin1String("I like XMPP."));
QCOMPARE(vcard.email(), QLatin1String("[email protected]"));
QCOMPARE(vcard.emails().size(), 1);
QCOMPARE(vcard.emails()[0].address(), QLatin1String("[email protected]"));
QCOMPARE(int(vcard.emails()[0].type()), int(QXmppVCardEmail::Internet));
QCOMPARE(vcard.nickName(), QLatin1String("FooBar"));
QCOMPARE(vcard.fullName(), QLatin1String("Foo Bar!"));
QCOMPARE(vcard.firstName(), QLatin1String("Foo"));
QCOMPARE(vcard.middleName(), QLatin1String("Baz"));
QCOMPARE(vcard.lastName(), QLatin1String("Wiz"));
QCOMPARE(vcard.phones().size(), 2);
QCOMPARE(vcard.phones()[0].number(), QLatin1String("12345"));
QCOMPARE(int(vcard.phones()[0].type()), int(QXmppVCardEmail::Home));
QCOMPARE(vcard.phones()[1].number(), QLatin1String("67890"));
QCOMPARE(int(vcard.phones()[1].type()), int(QXmppVCardEmail::Work));
QCOMPARE(vcard.photo(), QByteArray::fromBase64(
"iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAIAAABLbSncAAAAAXNSR0IArs4c6QAAAAlwSFlzAAA"
"UIgAAFCIBjw1HyAAAAAd0SU1FB9oIHQInNvuJovgAAAAiSURBVAjXY2TQ+s/AwMDAwPD/GiMDlP"
"WfgYGBiQEHGJwSAK2BBQ1f3uvpAAAAAElFTkSuQmCC"));
QCOMPARE(vcard.photoType(), QLatin1String("image/png"));
QCOMPARE(vcard.url(), QLatin1String("https://github.com/qxmpp-project/qxmpp/"));
const QXmppVCardOrganization &orgInfo = vcard.organization();
QCOMPARE(orgInfo.organization(), QLatin1String("QXmpp foundation"));
QCOMPARE(orgInfo.unit(), QLatin1String("Main QXmpp dev unit"));
QCOMPARE(orgInfo.title(), QLatin1String("Executive Director"));
QCOMPARE(orgInfo.role(), QLatin1String("Patron Saint"));
serializePacket(vcard, xml);
}