aboutsummaryrefslogtreecommitdiffstats
path: root/storage.c
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2010-08-24 00:12:24 +0100
committerWilmer van der Gaast <wilmer@gaast.net>2010-08-24 00:12:24 +0100
commitbe999a5385ff4e9ac7416de4cca3288f18cee85c (patch)
treeddd6a6e256719c378e9748e0d96791e11844f659 /storage.c
parent237eadd361a7ed1d2a49180056d12b57f6f3cc0a (diff)
parenteb6df6a280c458546ebc57126e63a828674b4cd8 (diff)
First step in this merge. Mostly a bzr merge and then a cleanup of conflicts
and parts I want to/have to redo (because of ui-fix).
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 ad1833fc..0c534858 100644
--- a/storage.c
+++ b/storage.c
@@ -27,6 +27,7 @@
#define BITLBEE_CORE
#include "bitlbee.h"
+#include "otr.h"
extern storage_t storage_text;
extern storage_t storage_xml;
@@ -113,9 +114,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;
}
@@ -136,7 +138,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) {
@@ -162,6 +165,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;
}
@@ -175,12 +181,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
@@ -204,6 +212,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;
}