diff options
| author | Jelmer Vernooij <jelmer@samba.org> | 2005-12-08 15:14:28 +0100 | 
|---|---|---|
| committer | Jelmer Vernooij <jelmer@samba.org> | 2005-12-08 15:14:28 +0100 | 
| commit | a1f17d45fae99428c8024168b55b4279c59ac867 (patch) | |
| tree | f30a2c00e52ec03da9ac8154baee1da3ad8fd090 /storage.h | |
| parent | 1ee6c18cfb5eb03f33a5938b37e357dd3fd2c164 (diff) | |
Simplify storage API a bit
Diffstat (limited to 'storage.h')
| -rw-r--r-- | storage.h | 20 | 
1 files changed, 14 insertions, 6 deletions
| @@ -26,20 +26,28 @@  #ifndef __STORAGE_H__  #define __STORAGE_H__ +typedef enum { +	STORAGE_OK = 0, +	STORAGE_NO_SUCH_USER, +	STORAGE_INVALID_PASSWORD, +	STORAGE_ALREADY_EXISTS, +	STORAGE_OTHER_ERROR /* Error that isn't caused by user input, such as  +						   a database that is unreachable. log() will be  +						   used for the exact error message */ +} storage_status_t; +  typedef struct {  	const char *name;  	/* May be set to NULL if not required */  	void (*init) (void); -	int (*load) (const char *nick, const char *password, irc_t * irc); -	int (*exists) (const char *nick); -	int (*save) (irc_t *irc); -	int (*remove) (const char *nick); -	int (*check_pass) (const char *nick, const char *pass); +	storage_status_t (*load) (const char *nick, const char *password, irc_t * irc); +	storage_status_t (*save) (irc_t *irc, int overwrite); +	storage_status_t (*remove) (const char *nick, const char *password);  	/* May be NULL if not supported by backend */ -	int (*rename) (const char *onick, const char *nnick, const char *password); +	storage_status_t (*rename) (const char *onick, const char *nnick, const char *password);  } storage_t;  void register_storage_backend(storage_t *); | 
