Changeset 764c7d1 for storage.c


Ignore:
Timestamp:
2008-02-03T21:30:03Z (16 years ago)
Author:
Sven Moritz Hallberg <sm@…>
Branches:
master
Children:
3c80a9d
Parents:
b5c8a34
Message:

OTR support, first checkin

File:
1 edited

Legend:

Unmodified
Added
Removed
  • storage.c

    rb5c8a34 r764c7d1  
    2929#include "bitlbee.h"
    3030#include "crypting.h"
     31#include "otr.h"
    3132
    3233extern storage_t storage_text;
     
    115116                if (status == STORAGE_OK) {
    116117                        irc_setpass(irc, password);
     118                        otr_load(irc);          /* load our OTR userstate */
    117119                        return status;
    118120                }
    119121               
    120                 if (status != STORAGE_NO_SUCH_USER)
     122                if (status != STORAGE_NO_SUCH_USER) {
    121123                        return status;
     124                }
    122125        }
    123126       
     
    127130storage_status_t storage_save (irc_t *irc, int overwrite)
    128131{
    129         return ((storage_t *)global.storage->data)->save(irc, overwrite);
     132        storage_status_t st;
     133       
     134        otr_save(irc);
     135        st = ((storage_t *)global.storage->data)->save(irc, overwrite);
     136        return st;
    130137}
    131138
     
    147154                        ret = status;
    148155        }
     156        if (ret == STORAGE_OK) {
     157                otr_remove(nick);
     158        }
    149159       
    150160        return ret;
     
    157167        storage_t *primary_storage = gl->data;
    158168        irc_t *irc;
    159 
     169       
    160170        /* First, try to rename in the current write backend, assuming onick
    161171         * is stored there */
    162172        status = primary_storage->rename(onick, nnick, password);
    163         if (status != STORAGE_NO_SUCH_USER)
     173        if (status != STORAGE_NO_SUCH_USER) {
     174                otr_rename(onick, nnick);
    164175                return status;
     176        }
    165177
    166178        /* Try to load from a migration backend and save to the current backend.
     
    186198
    187199        storage_remove(onick, password);
     200        otr_rename(onick, nnick);
    188201
    189202        return STORAGE_OK;
Note: See TracChangeset for help on using the changeset viewer.