[Bug 23284] Add support for ContactCapabilities interface

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Tue Oct 6 18:42:33 CEST 2009


http://bugs.freedesktop.org/show_bug.cgi?id=23284





--- Comment #6 from Andre Moreira Magalhaes <andrunko at gmail.com>  2009-10-06 09:42:32 PST ---
Example code snippet

void UIContactManager::getContactsCaps()
{
    ContactManager *cm = m_connection->contactManager();
    if (cm->supportedFeatures().contains(Contact::FeatureCapabilities)) {
        PendingContacts *pc = cm->upgradeContacts(cm->allKnownContacts(),
Contact::FeatureCapabilities);
        connect(pc,
                SIGNAL(finished(...)),
                SLOT(onContactUpgraded(...)));
    } else {
        for (uiContact, uiContacts) {
            uiContact->useConnectionCaps();
        }
    }
}

void UIContactManager::onContactUpgraded(PendingOperation *op)
{
    PendingContacts *pc = cast<>(op);
    QList<ContactPtr> contacts = op->contacts();

    for (contact, contacts) {
        uiTpContact = findUITpContactForContact(contact);
        // wathever
        uiTpContact->checkCapabilities();
    }
}

void UITpContact::UITpContact(ContactPtr contact)
    : internalContact(contact)
{
    // we can always connect here, even if Capabilities is not supported
    connect(contact,
            SIGNAL(capabilitiesChanged(...)),
            SLOT(checkCapabilities());
}

void UITpContact::checkCapabilities()
{
    if (!internalContact->capabilities()) {
        return;
    }

    // check caps and update UI
}

void UITpContact::useConnectionCaps()
{
    // connection FeatureCaps is already enabled
    // connection caps has not change notification, so just do it once

    // check caps and update UI
}


-- 
Configure bugmail: http://bugs.freedesktop.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the telepathy-bugs mailing list