]>
jfr.im git - irc/quakenet/newserv.git/blob - trusts/data.c
3 #include "../lib/sstring.h"
4 #include "../nick/nick.h" /* NICKLEN */
9 void trusts_freeall ( void ) {
13 for ( tg
= tglist
; tg
; tg
= ntg
) {
15 for ( th
= tg
-> hosts
; th
; th
= nth
) {
27 trustgroup
* tg_getbyid ( unsigned int id
) {
30 for ( tg
= tglist
; tg
; tg
= tg
-> next
)
37 void th_free ( trusthost
* th
) {
38 freesstring ( th
-> host
);
42 int th_add ( trustgroup
* tg
, char * host
, unsigned int maxseen
, time_t lastseen
) {
43 trusthost
* th
= malloc ( sizeof ( trusthost
));
47 th
-> host
= getsstring ( host
, TRUSTHOSTLEN
);
52 th
-> maxseen
= maxseen
;
53 th
-> lastseen
= lastseen
;
61 void tg_free ( trustgroup
* tg
) {
62 freesstring ( tg
-> name
);
63 freesstring ( tg
-> createdby
);
64 freesstring ( tg
-> contact
);
65 freesstring ( tg
-> comment
);
69 int tg_add ( unsigned int id
, char * name
, unsigned int trustedfor
, int mode
, unsigned int maxperident
, unsigned int maxseen
, time_t expires
, time_t lastseen
, time_t lastmaxuserreset
, char * createdby
, char * contact
, char * comment
) {
70 trustgroup
* tg
= malloc ( sizeof ( trustgroup
));
74 tg
-> name
= getsstring ( name
, TRUSTNAMELEN
);
75 tg
-> createdby
= getsstring ( createdby
, NICKLEN
);
76 tg
-> contact
= getsstring ( contact
, CONTACTLEN
);
77 tg
-> comment
= getsstring ( comment
, COMMENTLEN
);
78 if (! tg
-> name
|| ! tg
-> createdby
|| ! tg
-> contact
|| ! tg
-> comment
) {
84 tg
-> trustedfor
= trustedfor
;
86 tg
-> maxperident
= maxperident
;
87 tg
-> maxseen
= maxseen
;
88 tg
-> expires
= expires
;
89 tg
-> lastseen
= lastseen
;
90 tg
-> lastmaxuserreset
= lastmaxuserreset
;