/** * \brief Call this when you need to retrieve fresh vCard from server (and store it in cache afterwards) */ JT_VCard* VCardFactory::getVCard(const Jid &jid, Task *rootTask, const QObject *obj, const char *slot, bool cacheVCard) { JT_VCard *task = new JT_VCard( rootTask ); if ( cacheVCard ) task->connect(task, SIGNAL(finished()), this, SLOT(taskFinished())); task->connect(task, SIGNAL(finished()), obj, slot); task->get(Jid(jid.full())); task->go(true); return task; }
void VCardFactory::setSelfVCard(const VCard &myVCard) { // Prevent startSelfVCardUpdate from starting tasks if we're setting the avatar isFetchingMyVCard_ = true; JT_VCard *myVCardSetter = new JT_VCard(client_->rootTask()); connect(myVCardSetter, SIGNAL(finished()), SLOT(selfVCardTaskFinished())); myVCardSetter->set(myVCard); myVCardSetter->go(true); }
void VCardFactory::startSelfVCardUpdate() { if (!isFetchingMyVCard_) { isFetchingMyVCard_ = true; // Fetch our own vCard JT_VCard *myVCardFetchTask = new JT_VCard(client_->rootTask()); connect(myVCardFetchTask, SIGNAL(finished()), SLOT(selfVCardTaskFinished())); myVCardFetchTask->getSelfVCard(); myVCardFetchTask->go(true); } }