]>
Commit | Line | Data |
---|---|---|
e2527cba P |
1 | #include "trusts.h" |
2 | ||
3 | trustgroupidentcount_t *getnewtrustgroupidentcount(trustgroup_t *tg, char *ident) { | |
4 | trustgroupidentcount_t *tgic = newtrustgroupidentcount(); | |
5 | tgic->ident = getsstring(ident,USERLEN); | |
6 | tgic->currenton = 1; | |
7 | tgic->trustgroup = tg; | |
8 | ||
9 | trusts_addtrustgroupidenttohash(tgic); | |
10 | return tgic; | |
11 | } | |
12 | ||
13 | void increment_ident_count(nick *np, trustgroup_t *tg) { | |
14 | trustgroupidentcount_t* identcnt; | |
15 | identcnt = findtrustgroupcountbyident(np->ident,tg); | |
16 | if(identcnt) { | |
17 | /* ident exists */ | |
18 | if( tg->maxperident && (identcnt->currenton+1) > tg->maxperident) { | |
9a8ffb84 | 19 | controlwall(NO_OPER, NL_TRUSTS, "TG %lu: Exceeded Ident Limit (%d/%d) for %s!%s@%s (%s)",tg->id, identcnt->currenton+1, tg->maxperident, np->nick, np->ident, np->host->name->content, removeusers == 1 ? "disconnected": "ignored"); |
e2527cba P |
20 | //killuser(NULL, np, "USER: Exceeding User Ident Limit."); |
21 | } | |
22 | identcnt->currenton++; | |
23 | } else { | |
24 | /* we have a new user to add */ | |
25 | getnewtrustgroupidentcount( tg, np->ident ); | |
26 | } | |
27 | } | |
28 | ||
29 | void decrement_ident_count(nick *np, trustgroup_t *tg) { | |
30 | trustgroupidentcount_t* identcnt; | |
31 | identcnt = findtrustgroupcountbyident(np->ident,tg); | |
32 | if(identcnt) { | |
33 | identcnt->currenton--; | |
34 | if(identcnt->currenton == 0) { | |
35 | trusts_removetrustgroupidentfromhash(identcnt); | |
36 | if (identcnt->ident) { | |
37 | freesstring(identcnt->ident); | |
38 | } | |
39 | freetrustgroupidentcount(identcnt); | |
40 | } | |
41 | } | |
42 | } | |
43 |