Protocol-OTR

 view release on metacpan or  search on metacpan

OTR.xs  view on Meta::CPAN

        unsigned char fingerprint[20] = {0};
        int with_fingerprint = 0;
        int is_verified = 0;

        ConnContext *context;
        Fingerprint *fprint;
        int context_created = 0;
        int fprint_added = 0;
        char * account_name;
        char * account_protocol;
    PPCODE:
    {
        ctx = ACCOUNT2CTX(account);

        if ( SvOK(sv_fprint) ) {
            STRLEN flen;
            unsigned char *fingerprint_hex = (unsigned char*)SvPV(sv_fprint, flen);

            if (
                ( /* human readable string */
                    flen == 44

OTR.xs  view on Meta::CPAN

_active_fingerprint(contact)
    SV * contact
    PROTOTYPE: \%
    PREINIT:
        ConnContext *context;
        Fingerprint *fingerprint;
        OTRctx *ctx;
        char *contact_name;
        char *account_name;
        char *account_protocol;
    PPCODE:
    {
        HV *account = (HV*)HASHGET(contact, "act", 3);

        ctx = ACCOUNT2CTX(account);

        contact_name = SvPV_nolen(HASHGET(contact, "name", 4));
        account_name = SvPV_nolen(HASHGET(account, "name", 4));
        account_protocol = SvPV_nolen(HASHGET(account, "protocol", 8));

        context = otrl_context_find(

OTR.xs  view on Meta::CPAN


MODULE = Protocol::OTR        PACKAGE = Protocol::OTR::Fingerprint

void
hash(fprint)
    SV *fprint
    PROTOTYPE: $
    PREINIT:
        char *hex_fingerprint;
        unsigned char *fprint_bytes;
    PPCODE:
    {
        fprint_bytes = (unsigned char*)SvPVbyte_nolen(HASHGET(fprint, "fingerprint", 11));

        Newx(hex_fingerprint, OTRL_PRIVKEY_FPRINT_HUMAN_LEN, char);

        otrl_privkey_hash_to_human(hex_fingerprint, fprint_bytes);

        XPUSHs( sv_2mortal( newSVpvn( hex_fingerprint, OTRL_PRIVKEY_FPRINT_HUMAN_LEN - 1)));

        Safefree(hex_fingerprint);

OTR.xs  view on Meta::CPAN

    SV * verified
    PROTOTYPE: $$
    PREINIT:
        OTRctx * ctx;
        ConnContext * context;
        Fingerprint * fingerprint;
        int is_verified;
        char *contact_name;
        char *account_name;
        char *account_protocol;
    PPCODE:
    {
        HV *contact = (HV*)HASHGET(fprint, "cnt", 3);
        HV *account = (HV*)HASHGET(contact, "act", 3);
        ctx = ACCOUNT2CTX(account);

        is_verified = SvOK(verified) && SvTRUE(verified) ? 1 : 0;

        contact_name = SvPV_nolen(HASHGET(contact, "name", 4));
        account_name = SvPV_nolen(HASHGET(account, "name", 4));
        account_protocol = SvPV_nolen(HASHGET(account, "protocol", 8));

OTR.xs  view on Meta::CPAN



MODULE = Protocol::OTR        PACKAGE = Protocol::OTR::Channel

void
init(channel)
    SV * channel
    ALIAS:
        refresh = 1
    PROTOTYPE: $
    PPCODE:
    {
        send_default_query_msg(channel);

        XSRETURN_YES;
    }

void
create_symkey(channel, use, use_for)
    SV * channel
    unsigned int use
    SV * use_for
    PROTOTYPE: $$$
    PREINIT:
        ConnContext *context;
        int context_created = 0;
        OTRctx * ctx;
        char *contact_name;
        char * account_name;
        char * account_protocol;
    PPCODE:
    {
        HV * contact = (HV*)CHANNEL2CONTACT(channel);
        HV * account = (HV*)CONTACT2ACCOUNT(contact);

        ctx = CHANNEL2CTX(channel);

        contact_name = SvPV_nolen(HASHGET(contact, "name", 4));
        account_name = SvPV_nolen(HASHGET(account, "name", 4)); 
        account_protocol = SvPV_nolen(HASHGET(account, "protocol", 8)); 

OTR.xs  view on Meta::CPAN


void
finish(channel)
    SV * channel
    PROTOTYPE: $
    PREINIT:
        OTRctx * ctx;
        char *contact_name;
        char *account_name;
        char *account_protocol;
    PPCODE:
    {
        HV * contact = (HV*)CHANNEL2CONTACT(channel);
        HV * account = (HV*)CONTACT2ACCOUNT(contact);
        ctx = ACCOUNT2CTX(account);

        contact_name = SvPV_nolen(HASHGET(contact, "name", 4));
        account_name = SvPV_nolen(HASHGET(account, "name", 4));
        account_protocol = SvPV_nolen(HASHGET(account, "protocol", 8));

        (void)hv_store((HV*)SvRV(channel), "gone_secure", 11, &PL_sv_no, 0);

OTR.xs  view on Meta::CPAN

void
write(channel, plain_text)
    SV * channel
    char * plain_text
    PROTOTYPE: $$
    PREINIT:
        OTRctx * ctx;
        char *contact_name;
        char *account_name;
        char *account_protocol;
    PPCODE:
    {
        ConnContext *context;
        int context_created = 0;
        gcry_error_t err;
        char *newmessage = NULL;
        unsigned int selected_instag;
        HV * contact = (HV*)CHANNEL2CONTACT(channel);
        HV * account = (HV*)CONTACT2ACCOUNT(contact);
        ctx = ACCOUNT2CTX(account);

OTR.xs  view on Meta::CPAN


        otrl_message_free(newmessage);

        XSRETURN_YES;
    }

void
ping(channel)
    SV * channel
    PROTOTYPE: $
    PPCODE:
    {
        OTRctx * ctx = CHANNEL2CTX(channel);

        otrl_message_poll(ctx->userstate, &callbacks, channel);
        XSRETURN_YES;
    }

void
smp_verify(channel, answer, ...)
    SV * channel
    SV * answer
    PROTOTYPE: $$;$
    PPCODE:
    {
        ConnContext *context;
        int context_created = 0;
        char * question = NULL;
        STRLEN slen;
        unsigned char * secret;
        OTRctx * ctx;
        char *contact_name;
        char * account_name;
        char * account_protocol;

OTR.xs  view on Meta::CPAN

        }

        XSRETURN_YES;
    }

void
smp_respond(channel, response)
    SV * channel
    unsigned char *response
    PROTOTYPE: $$
    PPCODE:
    {
        ConnContext *context;
        int context_created = 0;
        OTRctx * ctx;
        char *contact_name;
        char * account_name;
        char * account_protocol;

        HV * contact = (HV*)CHANNEL2CONTACT(channel);
        HV * account = (HV*)CONTACT2ACCOUNT(contact);

OTR.xs  view on Meta::CPAN

            context, response, strlen((char*)response));

        XSRETURN_YES;
    }


void
smp_abort(channel)
    SV * channel
    PROTOTYPE: $
    PPCODE:
    {
        ConnContext *context;
        int context_created = 0;
        OTRctx * ctx;
        char *contact_name;
        char * account_name;
        char * account_protocol;

        HV * contact = (HV*)CHANNEL2CONTACT(channel);
        HV * account = (HV*)CONTACT2ACCOUNT(contact);

OTR.xs  view on Meta::CPAN


        XSRETURN_YES;
    }


void
read(channel, input)
    SV * channel
    char * input
    PROTOTYPE: $$
    PPCODE:
    {
        int res;
        char *newmessage = NULL;
        OtrlTLV *tlvs = NULL;
        OtrlTLV *tlv = NULL;
        OtrlMessageType msgtype;
        ConnContext *context;
        HV * contact = (HV*)CHANNEL2CONTACT(channel);
        HV * account = (HV*)CONTACT2ACCOUNT(contact);
        OTRctx *ctx = ACCOUNT2CTX(account);

OTR.xs  view on Meta::CPAN

    }

void
sessions(channel)
    SV * channel
    PROTOTYPE: $
    PREINIT:
        HV * sessions;
        HE * entry;
        I32 count;
    PPCODE:
    {
        sessions = (HV*)SvRV(HASHGET(channel, "known_sessions", 14));
        count = hv_iterinit(sessions);

        EXTEND(SP, count);

        while ( (entry = hv_iternext(sessions)) ) {
            I32 klen;
            char *key = hv_iterkey( entry, &klen );

OTR.xs  view on Meta::CPAN

void
current_session(channel)
    SV * channel
    PROTOTYPE: $
    PREINIT:
        ConnContext *context;
        OTRctx * ctx;
        char *contact_name;
        char * account_name;
        char * account_protocol;
    PPCODE:
    {
        HV * contact = (HV*)CHANNEL2CONTACT(channel);
        HV * account = (HV*)CONTACT2ACCOUNT(contact);

        ctx = CHANNEL2CTX(channel);

        contact_name = SvPV_nolen(HASHGET(contact, "name", 4));
        account_name = SvPV_nolen(HASHGET(account, "name", 4)); 
        account_protocol = SvPV_nolen(HASHGET(account, "protocol", 8)); 

OTR.xs  view on Meta::CPAN

    SV * channel
    SV * session
    PROTOTYPE: $$
    PREINIT:
        otrl_instag_t instag;
        ConnContext *context;
        OTRctx * ctx;
        char *contact_name;
        char *account_name;
        char *account_protocol;
    PPCODE:
    {
        HV * contact = (HV*)CHANNEL2CONTACT(channel);
        HV * account = (HV*)CONTACT2ACCOUNT(contact);
        ctx = ACCOUNT2CTX(account);

        instag = SvUV(session);

        contact_name = SvPV_nolen(HASHGET(contact, "name", 4));
        account_name = SvPV_nolen(HASHGET(account, "name", 4));
        account_protocol = SvPV_nolen(HASHGET(account, "protocol", 8));

OTR.xs  view on Meta::CPAN

status(channel)
    SV * channel
    PROTOTYPE: $ 
    PREINIT:
        ConnContext *context;
        Fingerprint *fingerprint;
        OTRctx *ctx;
        char *contact_name;
        char *account_name;
        char *account_protocol;
    PPCODE:
    {
        HV * contact = (HV*)CHANNEL2CONTACT(channel);
        HV * account = (HV*)CONTACT2ACCOUNT(contact);
        ctx = ACCOUNT2CTX(account);

        contact_name = SvPV_nolen(HASHGET(contact, "name", 4));
        account_name = SvPV_nolen(HASHGET(account, "name", 4));
        account_protocol = SvPV_nolen(HASHGET(account, "protocol", 8));

        context = otrl_context_find(



( run in 0.602 second using v1.01-cache-2.11-cpan-5511b514fd6 )