63 #include "gw-config.h" 66 #include <sys/types.h> 111 while((ent = readdir(dir)) != NULL) {
113 if (*(ent->d_name) ==
'.')
122 }
else if (S_ISREG(stat.st_mode) && cb != NULL)
125 if (ret == -1 && ignore_err)
179 void(*receive_msg)(
Msg*) =
data;
206 if (receive_msg == NULL)
230 time(&
msg->sms.time);
247 error(0,
"Could not pack message.");
254 if (mkdir(
octstr_get_cstr(dir), S_IRUSR|S_IWUSR|S_IXUSR) == -1 && errno != EEXIST) {
319 nack->ack.time =
msg->sms.time;
350 if (store_dir == NULL)
int store_spool_init(const Octstr *store_dir)
void error(int err, const char *fmt,...)
void info(int err, const char *fmt,...)
void counter_destroy(Counter *counter)
static void store_spool_shutdown()
int(* store_save_ack)(Msg *msg, ack_status_t status)
long(* store_messages)(void)
static void dispatch(const Octstr *filename, void *data)
void uuid_unparse(const uuid_t uu, char *out)
void uuid_generate(uuid_t out)
unsigned long counter_decrease(Counter *counter)
Msg *(* store_msg_unpack)(Octstr *os)
#define octstr_get_cstr(ostr)
unsigned long counter_increase(Counter *counter)
void(* store_for_each_message)(void(*callback_fn)(Msg *msg, void *data), void *data)
static long store_spool_messages()
static int for_each_file(const Octstr *dir_s, int ignore_err, void(*cb)(const Octstr *, void *), void *data)
static void store_spool_for_each_message(void(*callback_fn)(Msg *msg, void *data), void *data)
Counter * counter_create(void)
void gwlist_remove_producer(List *list)
int uuid_is_null(const uuid_t uu)
static int store_spool_save(Msg *msg)
static int store_spool_dump()
#define octstr_duplicate(ostr)
void uuid_copy(uuid_t dst, const uuid_t src)
void msg_destroy(Msg *msg)
static int store_spool_save_ack(Msg *msg, ack_status_t status)
unsigned long octstr_hash_key(Octstr *ostr)
Octstr * octstr_format(const char *fmt,...)
void octstr_destroy(Octstr *ostr)
char filename[FILENAME_MAX+1]
#define octstr_create(cstr)
unsigned long counter_value(Counter *counter)
Octstr *(* store_msg_pack)(Msg *msg)
Octstr * octstr_read_file(const char *filename)
void(* store_shutdown)(void)
long octstr_len(const Octstr *ostr)
void * gwlist_consume(List *list)
static int store_spool_load(void(*receive_msg)(Msg *))
int(* store_load)(void(*receive_msg)(Msg *))
#define MSG_PARAM_UNDEFINED
void(* callback_fn)(Msg *msg, void *data)
int(* store_save)(Msg *msg)
void gwlist_add_producer(List *list)
static void status_cb(const Octstr *filename, void *d)
static XMLRPCDocument * msg
void gwlist_destroy(List *list, gwlist_item_destructor_t *destructor)