Changeset 6738a67 for otr.c


Ignore:
Timestamp:
2008-07-16T23:22:52Z (12 years ago)
Author:
Sven Moritz Hallberg <pesco@…>
Branches:
master
Children:
9b55485
Parents:
9730d72 (diff), 6a78c0e (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

merge in latest trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • otr.c

    r9730d72 r6738a67  
    4646#include <unistd.h>
    4747#include <assert.h>
     48#include <signal.h>
    4849
    4950
     
    102103};
    103104
     105typedef struct {
     106        void *fst;
     107        void *snd;
     108} pair_t;       
     109
    104110
    105111/** misc. helpers/subroutines: **/
     
    124130
    125131/* some yes/no handlers */
    126 void yes_keygen(gpointer w, void *data);
    127 void yes_forget_fingerprint(gpointer w, void *data);
    128 void yes_forget_context(gpointer w, void *data);
    129 void yes_forget_key(gpointer w, void *data);
     132void yes_keygen(void *data);
     133void yes_forget_fingerprint(void *data);
     134void yes_forget_context(void *data);
     135void yes_forget_key(void *data);
    130136
    131137/* helper to make sure accountname and protocol match the incoming "opdata" */
     
    841847}
    842848
    843 void yes_forget_fingerprint(gpointer w, void *data)
    844 {
    845         irc_t *irc = (irc_t *)w;
    846         Fingerprint *fp = (Fingerprint *)data;
     849void yes_forget_fingerprint(void *data)
     850{
     851        pair_t *p = (pair_t *)data;
     852        irc_t *irc = (irc_t *)p->fst;
     853        Fingerprint *fp = (Fingerprint *)p->snd;
     854
     855        g_free(p);
    847856       
    848857        if(fp == fp->context->active_fingerprint) {
     
    854863}
    855864
    856 void yes_forget_context(gpointer w, void *data)
    857 {
    858         irc_t *irc = (irc_t *)w;
    859         ConnContext *ctx = (ConnContext *)data;
     865void yes_forget_context(void *data)
     866{
     867        pair_t *p = (pair_t *)data;
     868        irc_t *irc = (irc_t *)p->fst;
     869        ConnContext *ctx = (ConnContext *)p->snd;
     870
     871        g_free(p);
    860872       
    861873        if(ctx->msgstate == OTRL_MSGSTATE_ENCRYPTED) {
     
    870882}
    871883
    872 void yes_forget_key(gpointer w, void *data)
     884void yes_forget_key(void *data)
    873885{
    874886        OtrlPrivKey *key = (OtrlPrivKey *)data;
     
    889901                char human[54];
    890902                char *s;
     903                pair_t *p;
    891904               
    892905                if(!args[3]) {
     
    922935                otrl_privkey_hash_to_human(human, fp->fingerprint);
    923936                s = g_strdup_printf("about to forget fingerprint %s, are you sure?", human);
    924                 query_add(irc, NULL, s, yes_forget_fingerprint, NULL, fp);
     937                p = g_malloc(sizeof(pair_t));
     938                if(!p)
     939                        return;
     940                p->fst = irc;
     941                p->snd = fp;
     942                query_add(irc, NULL, s, yes_forget_fingerprint, NULL, p);
    925943                g_free(s);
    926944        }
     
    931949                ConnContext *ctx;
    932950                char *s;
     951                pair_t *p;
    933952               
    934953                /* TODO: allow context specs ("user/proto/account") in 'otr forget contex'? */
     
    952971               
    953972                s = g_strdup_printf("about to forget otr data about %s, are you sure?", args[2]);
    954                 query_add(irc, NULL, s, yes_forget_context, NULL, ctx);
     973                p = g_malloc(sizeof(pair_t));
     974                if(!p)
     975                        return;
     976                p->fst = irc;
     977                p->snd = ctx;
     978                query_add(irc, NULL, s, yes_forget_context, NULL, p);
    955979                g_free(s);
    956980        }
     
    16601684}
    16611685
    1662 void yes_keygen(gpointer w, void *data)
     1686void yes_keygen(void *data)
    16631687{
    16641688        account_t *acc = (account_t *)data;
Note: See TracChangeset for help on using the changeset viewer.