diff --git a/include/phoned.h b/include/phoned.h index 201256f..c68e3b2 100644 --- a/include/phoned.h +++ b/include/phoned.h @@ -3,7 +3,7 @@ * (C)2005, Dan Ponte * BSDL w/ advert. */ -/* $Amigan: phoned/include/phoned.h,v 1.5 2005/06/12 16:30:53 dcp1990 Exp $ */ +/* $Amigan: phoned/include/phoned.h,v 1.6 2005/06/12 18:51:06 dcp1990 Exp $ */ #include /* fugly, I know... */ #define VERSION "0.1" #define LOGFILE "/var/log/phoned.log" @@ -66,6 +66,13 @@ typedef struct c_t { #define CTACT_ANS 0x10 #define CTACT_PLAY 0x20 #define CTACT_REC 0x40 +#define SCTACT_IGN "\1" +#define SCTACT_HUP "\2" +#define SCTACT_RNOT "\3" +#define SCTACT_ANS "\4" +#define SCTACT_PLAY "\5" +#define SCTACT_REC "\6" + struct af { char* not_email; char* play_file; @@ -118,3 +125,4 @@ void addtoaddrs(const char* par); void modem_hread(char* cbuf); void cid_log(cid_t* c); cond_t* add_condition(char* filtname, char* nameregex, char* numregex, int action); +void free_condition(cond_t* h, short traverse); diff --git a/phoned/filters.c b/phoned/filters.c index 48bc001..46ce0fa 100644 --- a/phoned/filters.c +++ b/phoned/filters.c @@ -27,7 +27,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ -/* $Amigan: phoned/phoned/filters.c,v 1.4 2005/06/12 18:35:44 dcp1990 Exp $ */ +/* $Amigan: phoned/phoned/filters.c,v 1.5 2005/06/12 18:51:07 dcp1990 Exp $ */ #include #include #include @@ -37,8 +37,35 @@ cond_t* topcond = 0x0; pthread_mutex_t condmx = PTHREAD_MUTEX_INITIALIZER; +void free_cond_elms(cond) + cond_t* cond; +{ + free(cond->name); + free(cond->number); + free(cond->filtname); + free(cond->namex.prex); +} +void free_condition(h, traverse) + cond_t* h; + short traverse; +{ + cond_t *ls, *c, *tp; + tp = h; + if(tp == 0x0) return; + if(traverse) { + c = tp; + while(c > 0x0) { + free_cond_elms(c); + ls = c; + c = c->next; + free(ls); + } + } else { + free_cond_elms(tp); + free(tp); + } +} -/* BROKEN! Do not use! */ cond_t* add_condition(filtname, nameregex, numregex, action) char* filtname; char* nameregex; diff --git a/phoned/init.c b/phoned/init.c index afbd163..e4a4d9a 100644 --- a/phoned/init.c +++ b/phoned/init.c @@ -13,12 +13,14 @@ extern FILE* logf; extern short difflog; extern struct conf cf; +extern cond_t* topcond; void shutd(void) { lprintf(fatal, "phoned shutting down...\n"); close_modem(cf.modemdev); flush_lists(); + free_condition(topcond, 0x1); fclose(logf); unlink(SOCKETFILE); }