Free conditions
This commit is contained in:
parent
fc1f25abf7
commit
7395fd9f23
@ -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 <pcre.h> /* 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);
|
||||
|
@ -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 <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user