29 lines
820 B
C
29 lines
820 B
C
|
|
/* subscribers.h - Subscriber pool & persistence management */
|
||
|
|
#ifndef __SUBSCRIBERS_H__
|
||
|
|
#define __SUBSCRIBERS_H__
|
||
|
|
|
||
|
|
#include <ilib/splay.h>
|
||
|
|
|
||
|
|
typedef struct subscriber_entry {
|
||
|
|
splay_node_t node;
|
||
|
|
char *email;
|
||
|
|
} subscriber_entry_t;
|
||
|
|
|
||
|
|
/* Global state wrapper */
|
||
|
|
typedef struct subscriber_pool {
|
||
|
|
splay_t tree;
|
||
|
|
char *filepath;
|
||
|
|
} subscriber_pool_t;
|
||
|
|
|
||
|
|
int subscriber_pool_init(subscriber_pool_t *pool, const char *filepath);
|
||
|
|
void subscriber_pool_destroy(subscriber_pool_t *pool);
|
||
|
|
|
||
|
|
int subscriber_add(subscriber_pool_t *pool, const char *email);
|
||
|
|
int subscriber_remove(subscriber_pool_t *pool, const char *email);
|
||
|
|
int subscriber_exists(subscriber_pool_t *pool, const char *email);
|
||
|
|
|
||
|
|
int subscriber_load_file(subscriber_pool_t *pool);
|
||
|
|
int subscriber_save_file(subscriber_pool_t *pool);
|
||
|
|
|
||
|
|
#endif /* __SUBSCRIBERS_H__ */
|