Пример #1
0
void TelepathyClient::join(GameInfo *game) {
    TelepathyGameInfo *gameInfo = qobject_cast<TelepathyGameInfo *>(game);

    if (gameInfo == NULL) {
        qDebug() << "Unsupported game parameter.";
        return;
    }

    if (!gameInfo->contact || !gameInfo->account)
        return;

    setState(Connecting);

    // Subscribe to presence changes of the remote contact - we need to disconnect if its state changes to offline
    remoteContact = gameInfo->contact;
    connect(remoteContact.data(), SIGNAL(presenceChanged(Tp::Presence)),
            SLOT(onContactPresenceChanged(Tp::Presence)));

    Tp::PendingChannelRequest *request =
            gameInfo->account->createStreamTube(gameInfo->contact, "x-sudoku-united");
    connect(request, SIGNAL(finished(Tp::PendingOperation*)),
            SLOT(onCreateTubeFinished(Tp::PendingOperation*)));

    qDebug() << "Connecting...";
}
Пример #2
0
void ChannelContactModel::addContacts(const Tp::Contacts &contacts)
{
    QList<Tp::ContactPtr> newContacts = contacts.toList();

    Q_FOREACH(Tp::ContactPtr contact, newContacts) {
        connect(contact.data(), SIGNAL(aliasChanged(QString)), SLOT(onContactAliasChanged(QString)));
        connect(contact.data(), SIGNAL(presenceChanged(Tp::Presence)), SLOT(onContactPresenceChanged(Tp::Presence)));
        connect(contact.data(), SIGNAL(blockStatusChanged(bool)), SLOT(onContactBlockStatusChanged(bool)));
    }