示例#1
0
ChatSession::ChatSession(const QString &room_id, Tp::ConnectionPtr tp_connection): state_(STATE_INITIALIZING), self_participant_(NULL)
{
    QVariantMap params;
    params.insert(QLatin1String(TELEPATHY_INTERFACE_CHANNEL ".ChannelType"), QLatin1String(TELEPATHY_INTERFACE_CHANNEL_TYPE_TEXT));
    params.insert(QLatin1String(TELEPATHY_INTERFACE_CHANNEL ".TargetHandleType"), Tp::HandleTypeRoom);
    params.insert(QLatin1String(TELEPATHY_INTERFACE_CHANNEL ".TargetID"), room_id);

    Tp::PendingChannel* pending_channel = tp_connection->ensureChannel(params);
    connect(pending_channel,
            SIGNAL( finished(Tp::PendingOperation*) ),
            SLOT( OnTextChannelCreated(Tp::PendingOperation*) ));
}
示例#2
0
ChatSession::ChatSession(Contact& self_contact, Contact& contact, Tp::ConnectionPtr tp_connection) : state_(STATE_INITIALIZING), self_participant_(&self_contact)
{
    ChatSessionParticipant* p = new ChatSessionParticipant(&contact);
    participants_.push_back(p);

    QVariantMap params;
    params.insert(QLatin1String(TELEPATHY_INTERFACE_CHANNEL ".ChannelType"), QLatin1String(TELEPATHY_INTERFACE_CHANNEL_TYPE_TEXT));
    params.insert(QLatin1String(TELEPATHY_INTERFACE_CHANNEL ".TargetHandleType"), Tp::HandleTypeContact);
    params.insert(QLatin1String(TELEPATHY_INTERFACE_CHANNEL ".TargetHandle"), contact.GetTpContact()->handle().at(0));

    Tp::PendingChannel* pending_channel = tp_connection->ensureChannel(params);
    connect(pending_channel,
            SIGNAL( finished(Tp::PendingOperation*) ),
            SLOT( OnTextChannelCreated(Tp::PendingOperation*) ));
}
TpSessionChannel::TpSessionChannel(Tp::ConnectionPtr conn, const Tp::ContactPtr &contact)
{
    QDEBUG_FUNCTION_BEGIN
    QVariantMap request;
    qDebug() << "TpSessionChannel::TpSessionChannel" << "contact.id() " << contact->id();

    request.insert(QLatin1String(TELEPATHY_INTERFACE_CHANNEL ".ChannelType"),
                   TELEPATHY_INTERFACE_CHANNEL_TYPE_TEXT);
    request.insert(QLatin1String(TELEPATHY_INTERFACE_CHANNEL ".TargetHandleType"),
                   (uint) Tp::HandleTypeContact);
    request.insert(QLatin1String(TELEPATHY_INTERFACE_CHANNEL ".TargetHandle"),
                   contact->handle()[0]);

    connect(conn->ensureChannel(request),
            SIGNAL(finished(Tp::PendingOperation*)),
            SLOT(onChannelCreated(Tp::PendingOperation*)));

    peerContact = contact;

    QDEBUG_FUNCTION_END
}