]>
jfr.im git - irc/quakenet/newserv.git/blob - trusts2/trusts_blocks.c
3 static trustblock_t
*trustblocklist
= NULL
;
5 trustblock_t
*createtrustblock(unsigned long id
, patricia_node_t
* node
, unsigned long ownerid
, time_t expire
, char *reason_private
, char *reason_public
) {
6 trustblock_t
*tb
= newtrustblock();
7 memset(tb
, 0, sizeof(trustblock_t
));
9 tb
->startdate
= getnettime();
13 tb
->ownerid
= ownerid
;
15 tb
->reason_private
= getsstring(reason_private
,512);
16 tb
->reason_public
= getsstring(reason_public
,512);
18 tb
->next
=trustblocklist
;
23 trustblock_t
*createtrustblockfromdb(unsigned long id
, patricia_node_t
* node
, unsigned long ownerid
, time_t expire
, time_t startdate
, char *reason_private
, char *reason_public
) {
24 trustblock_t
*tb
= createtrustblock(id
,node
,ownerid
, expire
, reason_private
, reason_public
);
26 tb
->startdate
= startdate
;
30 void trustblock_free(trustblock_t
* t
)
32 trustblock_t
*st
, *pst
=NULL
;
33 for (st
= trustblocklist
; st
; st
=st
->next
) {
45 derefnode(iptree
,st
->node
);
46 if (st
->reason_public
) {
47 freesstring(st
->reason_public
);
49 if (st
->reason_private
) {
50 freesstring(st
->reason_private
);
56 void trustblock_expire( trustblock_t
*tb
) {
57 controlwall(NO_OPER
, NL_TRUSTS
, "trustblock on %s/%d expired",IPtostr(tb
->node
->prefix
->sin
),irc_bitlen(&(tb
->node
->prefix
->sin
),tb
->node
->prefix
->bitlen
));
58 trustsdb_deletetrustblock(tb
->node
->exts
[tgb_ext
]);
59 trustblock_free(tb
->node
->exts
[tgb_ext
]);
60 tb
->node
->exts
[tgb_ext
] = NULL
;
63 void trustblock_freeall() {
64 trustblock_t
*tb
, *ptb
=NULL
;
70 derefnode(iptree
,ptb
->node
);
71 if (ptb
->reason_public
) {
72 freesstring(ptb
->reason_public
);
74 if (ptb
->reason_private
) {
75 freesstring(ptb
->reason_private
);
77 ptb
->node
->exts
[tgb_ext
] = NULL
;