]>
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
) {
44 derefnode(iptree
,st
->node
);
45 if (st
->reason_public
) {
46 freesstring(st
->reason_public
);
48 if (st
->reason_private
) {
49 freesstring(st
->reason_private
);
55 void trustblock_expire( trustblock_t
*tb
) {
56 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
));
57 trustsdb_deletetrustblock(tb
->node
->exts
[tgb_ext
]);
58 trustblock_free(tb
->node
->exts
[tgb_ext
]);
59 tb
->node
->exts
[tgb_ext
] = NULL
;
62 void trustblock_freeall() {
63 trustblock_t
*tb
, *ptb
=NULL
;
68 derefnode(iptree
,ptb
->node
);
69 if (ptb
->reason_public
) {
70 freesstring(ptb
->reason_public
);
72 if (ptb
->reason_private
) {
73 freesstring(ptb
->reason_private
);