コード例 #1
0
ファイル: channel-watcher.cpp プロジェクト: KDE/spacebar
ChannelWatcher::ChannelWatcher(const Tp::TextChannelPtr &channel, const QString &accountObjectPath, QObject *parent)
    : QObject(parent),
      m_channel(channel),
      m_accountObjectPath(accountObjectPath),
      m_db(QSqlDatabase::database()),
      m_contactDbId(0), //sqlite auto-increment starts at 1
      m_accountDbId(0)
{
    qDebug() << "Delivery reports support" << channel->deliveryReportingSupport();

    connect(channel.data(), &Tp::TextChannel::invalidated, this, &ChannelWatcher::invalidated);
    connect(channel.data(), &Tp::TextChannel::invalidated, this, [=]() {
        qDebug() << "Channel invalidated";
    });

    connect(channel.data(), &Tp::TextChannel::messageReceived, this, &ChannelWatcher::onMessageReceived);
    connect(channel.data(), &Tp::TextChannel::messageSent, this, &ChannelWatcher::onMessageSent);

    qDebug() << this << "New channel being watched" << channel.data();

    storeContactInfo();
    storeAccountInfo();

    Q_FOREACH (const Tp::ReceivedMessage &message, channel->messageQueue()) {
        onMessageReceived(message);
    }
}
コード例 #2
0
OtrProxyChannel::Adaptee::Adaptee(OtrProxyChannel *pc,
        const QDBusConnection &dbusConnection,
        const Tp::TextChannelPtr &channel,
        const OTR::SessionContext &context,
        ProxyService *ps)
    : QObject(pc),
    adaptor(new Tp::Service::ChannelProxyInterfaceOTRAdaptor(dbusConnection, this, pc->dbusObject())),
    pc(pc),
    chan(channel),
    isConnected(false),
    otrSes(this, context, ps->managerOTR()),
    ps(ps),
    isGenerating(false),
    aboutToInit(false)
{
    qCDebug(KTP_PROXY) << "Created OTR session for context: "
        << "Account id: " << context.accountId
        << " Account name: " << context.accountName
        << " recipient name: " << context.recipientName
        << " protocol: " << context.protocol;
    connect(chan.data(), SIGNAL(invalidated(Tp::DBusProxy*,const QString&,const QString&)), SLOT(onChannelClosed()));
    connect(&otrSes, SIGNAL(trustLevelChanged(TrustLevel)), SLOT(onTrustLevelChanged(TrustLevel)));
    connect(&otrSes, SIGNAL(sessionRefreshed()), SIGNAL(sessionRefreshed()));
    connect(&otrSes, SIGNAL(authenticationRequested(const QString&)), SIGNAL(peerAuthenticationRequested(const QString&)));
    connect(&otrSes, SIGNAL(authenticationInProgress()), SIGNAL(peerAuthenticationInProgress()));
    connect(&otrSes, SIGNAL(authenticationConcluded(bool)), SIGNAL(peerAuthenticationConcluded(bool)));
    connect(&otrSes, SIGNAL(authenticationAborted()), SIGNAL(peerAuthenticationAborted()));
    connect(&otrSes, SIGNAL(authenticationError()), SIGNAL(peerAuthenticationError()));
    connect(&otrSes, SIGNAL(authenticationCheated()), SIGNAL(peerAuthenticationCheated()));

    sender = channel->connection()->selfHandle();
}
コード例 #3
0
void ChannelContactModel::setTextChannel(const Tp::TextChannelPtr &channel)
{
    //remove existing contacts in list
    beginRemoveRows(QModelIndex(), 0, m_contacts.size());
    m_contacts.clear();
    endRemoveRows();

    //add existing contacts from channel
    addContacts(channel->groupContacts());

    //monitor for future changes
    connect(channel.data(),
            SIGNAL(groupMembersChanged(Tp::Contacts,Tp::Contacts,Tp::Contacts,
                                       Tp::Contacts,Tp::Channel::GroupMemberChangeDetails)),
            SLOT(onGroupMembersChanged(Tp::Contacts,Tp::Contacts,Tp::Contacts,
                                     Tp::Contacts,Tp::Channel::GroupMemberChangeDetails)));
}
コード例 #4
0
TpSessionChannel::TpSessionChannel(Tp::TextChannelPtr ch)
{
    QDEBUG_FUNCTION_BEGIN

    qDebug() << "TpSessionChannel::TpSessionChannel" << "path " << ch->objectPath();
    channel = ch;
    connect(channel->becomeReady(Tp::TextChannel::FeatureMessageQueue | Tp::TextChannel::FeatureMessageSentSignal),
            SIGNAL(finished(Tp::PendingOperation *)),
            SLOT(onChannelReady(Tp::PendingOperation *)));

    QDEBUG_FUNCTION_END
}
コード例 #5
0
ファイル: telepathy-chat-ui.cpp プロジェクト: KDE/ktp-text-ui
bool TelepathyChatUi::isHiddenChannel(const Tp::AccountPtr &account,
                                      const Tp::TextChannelPtr& channel,
                                      Tp::TextChannelPtr *oldChannel) const
{
    if (channel->targetHandleType() != Tp::HandleTypeRoom) {
        return false;
    }

    QHash<Tp::TextChannelPtr,Tp::AccountPtr>::const_iterator it = m_channelAccountMap.constBegin();
    for ( ; it != m_channelAccountMap.constEnd(); ++it) {
        if (channel->targetId() == it.key()->targetId()
            && channel->targetHandleType() == it.key()->targetHandleType()
            && account == it.value())
        {
            *oldChannel = it.key();
            return true;
        }
    }

    return false;
}