Ejemplo n.º 1
0
void OtrInternal::startSession(const QString& account, const QString& contact)
{
    m_callback->stateChange(account, contact, psiotr::OTR_STATECHANGE_GOINGSECURE);

    if (!otrl_privkey_find(m_userstate, account.toUtf8().constData(),
                           OTR_PROTOCOL_STRING))
    {
        create_privkey(account.toUtf8().constData(), OTR_PROTOCOL_STRING);
    }

    //TODO: make allowed otr versions configureable
    char* msg = otrl_proto_default_query_msg(m_callback->humanAccountPublic(account).toUtf8().constData(),
                                             OTRL_POLICY_DEFAULT);

    m_callback->sendMessage(account, contact, QString::fromUtf8(msg));

    free(msg);
}
Ejemplo n.º 2
0
//-----------------------------------------------------------------------------
void OtrInternal::startSession(const QString& account, const QString& jid, TreeModelItem &item, int pol)
{
    Q_UNUSED(jid);
    OtrlPolicy policy = (OtrlPolicy)pol;
    char fingerprint[45];
    if (!otrl_privkey_fingerprint(m_userstate, fingerprint,
                                  account.toStdString().c_str(),
                                  item.m_protocol_name.toStdString().c_str()))
    {
        create_privkey(account.toStdString().c_str(), item.m_protocol_name.toStdString().c_str());
    }
    if (!otrl_privkey_fingerprint(m_userstate, fingerprint,
                                  account.toStdString().c_str(),
                                  item.m_protocol_name.toStdString().c_str()))
        return;

    //TODO: make allowed otr versions configureable
    char* msg = otrl_proto_default_query_msg(account.toStdString().c_str(),
                                             policy);

    m_plugin->sendCustomMessage(item,QString(msg),true);
}
Ejemplo n.º 3
0
void OtrInternal::generateKey(const QString& account)
{
    create_privkey(account.toUtf8().constData(), OTR_PROTOCOL_STRING);
}