Changeset e65039a for otr.c


Ignore:
Timestamp:
2013-08-03T12:49:03Z (6 years ago)
Author:
unknown <pesco@…>
Branches:
master
Children:
e4752a6
Parents:
fbcb481
Message:

persist instags (also works around "malformed message" bug)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • otr.c

    rfbcb481 re65039a  
    7777const char *op_account_name(void *opdata, const char *account, const char *protocol);
    7878
     79void op_create_instag(void *opdata, const char *account, const char *protocol);
     80
    7981void op_convert_msg(void *opdata, ConnContext *ctx, OtrlConvertType typ,
    8082        char **dst, const char *src);
     
    241243        otr_ops.handle_smp_event = &op_handle_smp_event;
    242244        otr_ops.handle_msg_event = &op_handle_msg_event;
    243         otr_ops.create_instag = NULL;    // XXX
     245        otr_ops.create_instag = &op_create_instag;
    244246        otr_ops.convert_msg = &op_convert_msg;
    245247        otr_ops.convert_free = &op_convert_free;
     
    314316                g_snprintf(s, 511, "%s%s.otr_fprints", global.conf->configdir, irc->user->nick);
    315317                e = otrl_privkey_read_fingerprints(irc->otr->us, s, NULL, NULL);
     318                if(e && e!=enoent) {
     319                        irc_rootmsg(irc, "otr load: %s: %s", s, gcry_strerror(e));
     320                }
     321                g_snprintf(s, 511, "%s%s.otr_instags", global.conf->configdir, irc->user->nick);
     322                e = otrl_instag_read(irc->otr->us, s);
    316323                if(e && e!=enoent) {
    317324                        irc_rootmsg(irc, "otr load: %s: %s", s, gcry_strerror(e));
     
    678685
    679686        return peernick(irc, account, protocol);
     687}
     688
     689void op_create_instag(void *opdata, const char *account, const char *protocol)
     690{
     691        struct im_connection *ic =
     692                check_imc(opdata, account, protocol);
     693        irc_t *irc = ic->bee->ui_data;
     694        gcry_error_t e;
     695        char s[512];
     696 
     697        g_snprintf(s, 511, "%s%s.otr_instags", global.conf->configdir,
     698                irc->user->nick);
     699        e = otrl_instag_generate(irc->otr->us, s, account, protocol);
     700        if(e) {
     701                irc_rootmsg(irc, "otr: %s/%s: otrl_instag_generate failed: %s",
     702                        account, protocol, gcry_strerror(e));
     703        }
    680704}
    681705
Note: See TracChangeset for help on using the changeset viewer.