void Client::updateSelfPresence(const Jid &j, const Status &s) { ResourceList::Iterator rit = d->resourceList.find(j.resource()); bool found = (rit == d->resourceList.end()) ? false: true; // unavailable? remove the resource if(!s.isAvailable()) { if(found) { debug(QString("Client: Removing self resource: name=[%1]\n").arg(j.resource())); (*rit).setStatus(s); resourceUnavailable(j, *rit); d->resourceList.remove(rit); } } // available? add/update the resource else { Resource r; if(!found) { r = Resource(j.resource(), s); d->resourceList += r; debug(QString("Client: Adding self resource: name=[%1]\n").arg(j.resource())); } else { (*rit).setStatus(s); r = *rit; debug(QString("Client: Updating self resource: name=[%1]\n").arg(j.resource())); } resourceAvailable(j, r); } }
void Client::updatePresence(LiveRosterItem *i, const Jid &j, const Status &s) { ResourceList::Iterator rit = i->resourceList().find(j.resource()); bool found = (rit == i->resourceList().end()) ? false: true; // unavailable? remove the resource if(!s.isAvailable()) { if(found) { (*rit).setStatus(s); debug(QString("Client: Removing resource from [%1]: name=[%2]\n").arg(i->jid().full()).arg(j.resource())); resourceUnavailable(j, *rit); i->resourceList().remove(rit); i->setLastUnavailableStatus(s); } } // available? add/update the resource else { Resource r; if(!found) { r = Resource(j.resource(), s); i->resourceList() += r; debug(QString("Client: Adding resource to [%1]: name=[%2]\n").arg(i->jid().full()).arg(j.resource())); } else { (*rit).setStatus(s); r = *rit; debug(QString("Client: Updating resource to [%1]: name=[%2]\n").arg(i->jid().full()).arg(j.resource())); } resourceAvailable(j, r); } }
static void processResourceAndDeliver(DISPATCH_PTR dispatch) { #ifndef NMP_IPC if (!dispatch->treeNode) { tapBeforeHandling(dispatch); } #endif if (resourceAvailable(dispatch)) processResAttendDeliver(dispatch); else { resourcePending(dispatch); #ifndef NMP_IPC PendingConstraints(dispatch); #endif dispatchUpdateAndDisplay(PendingDispatch, dispatch); } }