diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2010-10-09 11:41:19 -0700 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2010-10-09 11:41:19 -0700 |
commit | 619770237590e4a760346f2e12681d7e2220dda4 (patch) | |
tree | 8d0d391407280ab74e1fc876d6f272110b474897 /storage.c | |
parent | 23b29c67968f3dd39e7d6970acc5669556f4c8b9 (diff) | |
parent | 27b407fde1844a0e03f1a9d92d2a1c4a40435f9b (diff) |
Merging OTR branch. It's more or less a plugin if you enable it, and
otherwise a no-op. DO NOT INSTALL THIS ON PUBLIC SERVERS.
Diffstat (limited to 'storage.c')
-rw-r--r-- | storage.c | 29 |
1 files changed, 29 insertions, 0 deletions
@@ -114,7 +114,16 @@ storage_status_t storage_load (irc_t * irc, const char *password) status = st->load(irc, password); if (status == STORAGE_OK) + { + GSList *l; + for( l = irc_plugins; l; l = l->next ) + { + irc_plugin_t *p = l->data; + if( p->storage_load ) + p->storage_load( irc ); + } return status; + } if (status != STORAGE_NO_SUCH_USER) return status; @@ -126,6 +135,7 @@ storage_status_t storage_load (irc_t * irc, const char *password) storage_status_t storage_save (irc_t *irc, char *password, int overwrite) { storage_status_t st; + GSList *l; if (password != NULL) { /* Should only use this in the "register" command. */ @@ -139,6 +149,13 @@ storage_status_t storage_save (irc_t *irc, char *password, int overwrite) st = ((storage_t *)global.storage->data)->save(irc, overwrite); + for( l = irc_plugins; l; l = l->next ) + { + irc_plugin_t *p = l->data; + if( p->storage_save ) + p->storage_save( irc ); + } + if (password != NULL) { irc_setpass(irc, NULL); } @@ -150,6 +167,8 @@ storage_status_t storage_remove (const char *nick, const char *password) { GList *gl; storage_status_t ret = STORAGE_OK; + gboolean ok = FALSE; + GSList *l; /* Remove this account from all storage backends. If this isn't * done, the account will still be usable, it'd just be @@ -159,10 +178,20 @@ storage_status_t storage_remove (const char *nick, const char *password) storage_status_t status; status = st->remove(nick, password); + ok |= status == STORAGE_OK; if (status != STORAGE_NO_SUCH_USER && status != STORAGE_OK) ret = status; } + /* If at least one succeeded, remove plugin data. */ + if( ok ) + for( l = irc_plugins; l; l = l->next ) + { + irc_plugin_t *p = l->data; + if( p->storage_remove ) + p->storage_remove( nick ); + } + return ret; } |