aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--commands.c8
-rw-r--r--irc.c2
-rw-r--r--storage.c25
-rw-r--r--storage.h8
4 files changed, 38 insertions, 5 deletions
diff --git a/commands.c b/commands.c
index 2877aa4b..7695d679 100644
--- a/commands.c
+++ b/commands.c
@@ -85,7 +85,7 @@ int cmd_help( irc_t *irc, char **cmd )
int cmd_identify( irc_t *irc, char **cmd )
{
- storage_status_t status = global.storage->load( irc->nick, cmd[1], irc );
+ storage_status_t status = storage_load( irc->nick, cmd[1], irc );
switch (status) {
case STORAGE_INVALID_PASSWORD:
@@ -114,7 +114,7 @@ int cmd_register( irc_t *irc, char **cmd )
}
irc_setpass( irc, cmd[1] );
- switch( global.storage->save( irc, FALSE )) {
+ switch( storage_save( irc, FALSE )) {
case STORAGE_ALREADY_EXISTS:
irc_usermsg( irc, "Nick is already registered" );
break;
@@ -135,7 +135,7 @@ int cmd_drop( irc_t *irc, char **cmd )
{
storage_status_t status;
- status = global.storage->remove (irc->nick, cmd[1]);
+ status = storage_remove (irc->nick, cmd[1]);
switch (status) {
case STORAGE_NO_SUCH_USER:
irc_usermsg( irc, "That account does not exist" );
@@ -615,7 +615,7 @@ int cmd_set( irc_t *irc, char **cmd )
int cmd_save( irc_t *irc, char **cmd )
{
- if( global.storage->save( irc, TRUE ) == STORAGE_OK )
+ if( storage_save( irc, TRUE ) == STORAGE_OK )
irc_usermsg( irc, "Configuration saved" );
else
irc_usermsg( irc, "Configuration could not be saved!" );
diff --git a/irc.c b/irc.c
index 5601e314..998e7e51 100644
--- a/irc.c
+++ b/irc.c
@@ -160,7 +160,7 @@ void irc_free(irc_t * irc)
log_message( LOGLVL_INFO, "Destroying connection with fd %d", irc->fd );
if( irc->status >= USTATUS_IDENTIFIED && set_getint( irc, "save_on_quit" ) )
- if( !global.storage->save( irc, TRUE ) )
+ if( !storage_save( irc, TRUE ) )
irc_usermsg( irc, "Error while saving settings!" );
if( irc->ping_source_id > 0 )
diff --git a/storage.c b/storage.c
index 8738a58f..28ead8ac 100644
--- a/storage.c
+++ b/storage.c
@@ -56,3 +56,28 @@ storage_t *storage_init(const char *name)
return st;
}
+
+storage_status_t storage_check_pass (const char *nick, const char *password)
+{
+ return global.storage->check_pass(nick, password);
+}
+
+storage_status_t storage_load (const char *nick, const char *password, irc_t * irc)
+{
+ return global.storage->load(nick, password, irc);
+}
+
+storage_status_t storage_save (irc_t *irc, int overwrite)
+{
+ return global.storage->save(irc, overwrite);
+}
+
+storage_status_t storage_remove (const char *nick, const char *password)
+{
+ return global.storage->remove(nick, password);
+}
+
+storage_status_t storage_rename (const char *onick, const char *nnick, const char *password)
+{
+ return global.storage->rename(onick, nnick, password);
+}
diff --git a/storage.h b/storage.h
index 3139d63b..f799e3f9 100644
--- a/storage.h
+++ b/storage.h
@@ -52,6 +52,14 @@ typedef struct {
storage_status_t (*rename) (const char *onick, const char *nnick, const char *password);
} storage_t;
+storage_status_t storage_check_pass (const char *nick, const char *password);
+
+storage_status_t storage_load (const char *nick, const char *password, irc_t * irc);
+storage_status_t storage_save (irc_t *irc, int overwrite);
+storage_status_t storage_remove (const char *nick, const char *password);
+
+storage_status_t storage_rename (const char *onick, const char *nnick, const char *password);
+
void register_storage_backend(storage_t *);
storage_t *storage_init(const char *name);