]>
jfr.im git - irc/quakenet/newserv.git/blob - helpmod2/hticket.c
9 hticket
*hticket_get(const char *authname
, struct hchannel_struct
*hchan
)
14 for (tmp
= hchan
->htickets
;tmp
;tmp
= tmp
->next
)
15 if (!ci_strcmp(authname
, tmp
->authname
))
20 hticket
*hticket_del(hticket
*htick
, struct hchannel_struct
*hchan
)
23 for (ptr
= &hchan
->htickets
;*ptr
;ptr
= &(*ptr
)->next
)
26 hticket
*tmp
= (*ptr
)->next
;
28 freesstring((*ptr
)->message
);
37 hticket
*hticket_add(const char *authname
, time_t expiration
, struct hchannel_struct
*hchan
, const char *message
)
39 hticket
*tmp
= hticket_get(authname
, hchan
), **ptr
;
47 tmp
= (hticket
*)malloc(sizeof(struct hticket_struct
));
49 strcpy(tmp
->authname
, authname
);
50 tmp
->time_expiration
= expiration
;
55 tmp
->message
= getsstring(message
, strlen(message
));
57 /* find the correct position */
58 for (ptr
= &hchan
->htickets
;*ptr
&& (*ptr
)->time_expiration
>= expiration
;ptr
= &(*ptr
)->next
);
66 int hticket_count(void)
72 for (hchan
= hchannels
;hchan
;hchan
= hchan
->next
)
73 for (htick
= hchan
->htickets
;htick
;htick
= htick
->next
)
79 void hticket_remove_expired(void)
83 for (hchan
= hchannels
;hchan
;hchan
= hchan
->next
)
85 tmp
= &hchan
->htickets
;
87 if ((*tmp
)->time_expiration
< time(NULL
))
88 hticket_del(*tmp
, hchan
);