aboutsummaryrefslogtreecommitdiffstats
path: root/storage.c
diff options
context:
space:
mode:
Diffstat (limited to 'storage.c')
-rw-r--r--storage.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/storage.c b/storage.c
index f011ade2..2788ba2a 100644
--- a/storage.c
+++ b/storage.c
@@ -28,6 +28,7 @@
#define BITLBEE_CORE
#include "bitlbee.h"
#include "crypting.h"
+#include "otr.h"
extern storage_t storage_text;
extern storage_t storage_xml;
@@ -115,9 +116,10 @@ storage_status_t storage_load (irc_t * irc, const char *password)
storage_status_t status;
status = st->load(irc, password);
- if (status == STORAGE_OK)
+ if (status == STORAGE_OK) {
+ otr_load(irc);
return status;
-
+ }
if (status != STORAGE_NO_SUCH_USER)
return status;
}
@@ -138,7 +140,8 @@ storage_status_t storage_save (irc_t *irc, char *password, int overwrite)
} else if ((irc->status & USTATUS_IDENTIFIED) == 0) {
return STORAGE_NO_SUCH_USER;
}
-
+
+ otr_save(irc);
st = ((storage_t *)global.storage->data)->save(irc, overwrite);
if (password != NULL) {
@@ -164,6 +167,9 @@ storage_status_t storage_remove (const char *nick, const char *password)
if (status != STORAGE_NO_SUCH_USER && status != STORAGE_OK)
ret = status;
}
+ if (ret == STORAGE_OK) {
+ otr_remove(nick);
+ }
return ret;
}
@@ -177,12 +183,14 @@ storage_status_t storage_rename (const char *onick, const char *nnick, const cha
GList *gl = global.storage;
storage_t *primary_storage = gl->data;
irc_t *irc;
-
+
/* First, try to rename in the current write backend, assuming onick
* is stored there */
status = primary_storage->rename(onick, nnick, password);
- if (status != STORAGE_NO_SUCH_USER)
+ if (status != STORAGE_NO_SUCH_USER) {
+ otr_rename(onick, nnick);
return status;
+ }
/* Try to load from a migration backend and save to the current backend.
* Explicitly remove the account from the migration backend as otherwise
@@ -206,6 +214,7 @@ storage_status_t storage_rename (const char *onick, const char *nnick, const cha
irc_free(irc);
storage_remove(onick, password);
+ otr_rename(onick, nnick);
return STORAGE_OK;
}