/** * \brief Call this when you need to update vCard in cache. */ void VCardFactory::setVCard(const Jid &j, const VCard &v) { VCard *vcard = new VCard; *vcard = v; checkLimit(j.userHost(), vcard); emit vcardChanged(j); }
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); } }