bool StandardContactList::addContact(const ContactPtr& newContact) { ContactPtr c = contact(newContact->id()); if(c) return false; m_contacts.insert(newContact->id(), newContact); return true; }
/** * Create a new SimpleCallObserver object. * * Events will be signalled for all calls in \a account established with \a contact and * that respect \a direction. * * \param account The account used to listen to events. * \param contact The contact used to filter events. * \param direction The direction of the calls used to filter events. * \return An SimpleCallObserverPtr object pointing to the newly created * SimpleCallObserver object. */ SimpleCallObserverPtr SimpleCallObserver::create(const AccountPtr &account, const ContactPtr &contact, CallDirection direction) { if (contact) { return create(account, contact->id(), false, direction); } return create(account, QString(), false, direction); }
void ChannelAccepter::decrefCleanup () { QMutexLocker locker(&mutex); nRefCount--; if (0 != nRefCount) { return; } Q_DEBUG ("TpObserver: Everything ready. Cleaning up"); bool bCleanupLater = false; do { // Not a loop if (bFailure) { Q_WARN ("TpObserver: Failed while waiting for something"); break; } QString msg; msg = QString("TpObserver: Channel type = %1. isRequested = %2") .arg (currentChannel->channelType ()) .arg (currentChannel->isRequested ()); Q_DEBUG (msg); ContactPtr contact = currentChannel->initiatorContact (); msg = QString("TpObserver: Contact id = %1. alias = %2") .arg (contact->id ()) .arg (contact->alias ()); Q_DEBUG (msg); int interested = 0; if (0 == currentChannel->channelType().compare ( TPQT_CHANNEL_TYPE_STREAMED_MEDIA)) { interested++; } if (!currentChannel->isRequested ()) { interested++; } if (contact->id ().contains (strCheckNumber)) { interested++; } if (3 != interested) { Q_DEBUG ("TpObserver: Channel that we're not interested in"); break; } Q_DEBUG ("TpObserver: Incoming call from our number!"); emit callStarted (); } while (0); // Not a loop if (!bCleanupLater) { context->setFinished (); this->deleteLater (); } }//ChannelAccepter::decrefCleanup