]>
jfr.im git - irc/quakenet/newserv.git/blob - request/lrequest.c
1 /* required modules: splitlist, chanfix(3) */
7 #include "request_block.h"
8 #include "../localuser/localuser.h"
12 int lr_scoretoolow
= 0;
14 int lr_floodattempts
= 0;
16 #define min(a,b) ((a > b) ? b : a)
18 int lr_requestl(nick
*svc
, nick
*np
, channel
*cp
, nick
*lnick
) {
20 regop
*rolist
[LR_TOPX
], *ro
;
23 if (strlen(cp
->index
->name
->content
) > LR_MAXCHANLEN
) {
24 sendnoticetouser(svc
, np
, "Channel name is too long. You will have to "
25 "create a channel with a name less than %d characters long.",
31 cf
= cf_findchanfix(cp
->index
);
34 sendnoticetouser(svc
, np
, "Error: Sorry, Your channel '%s' was created recently. Please Try again in an hour.", cp
->index
->name
->content
);
41 rocount
= cf_getsortedregops(cf
, LR_TOPX
, rolist
);
45 for (i
= 0; i
< min(LR_TOPX
, rocount
); i
++) {
46 if (cf_cmpregopnick(rolist
[i
], np
)) {
53 sendnoticetouser(svc
, np
, "Error: Sorry, You must be one of the top %d ops "
54 "for the channel %s.", LR_TOPX
, cp
->index
->name
->content
);
61 /* treat blocked users as if their score is too low */
62 if (ro
->score
< LR_CFSCORE
|| rq_findblock(np
->authname
)) {
64 sendnoticetouser(svc
, np
, "Error: Do not flood the request system. "
65 "Try again in %s.", rq_longtoduration(rq_blocktime(np
)));
72 sendnoticetouser(svc
, np
, "Sorry You do not meet the "
73 "requirements to request L. Please Try again in an hour. "
74 "(see http://www.quakenet.org/faq/faq.php?c=3&f=112 )");
81 sendmessagetouser(svc
, lnick
, "addchan %s #%s %s", cp
->index
->name
->content
,
82 np
->authname
, np
->nick
);
84 sendnoticetouser(svc
, np
, "Requirements met, L should be added. Contact #help"
85 " should further assistance be required.");
90 void lr_requeststats(nick
*rqnick
, nick
*np
) {
91 sendnoticetouser(rqnick
, np
, "- No registered ops (L): %d", lr_noregops
);
92 sendnoticetouser(rqnick
, np
, "- Score too low (L): %d", lr_scoretoolow
);
93 sendnoticetouser(rqnick
, np
, "- Not in top%d (L): %d", LR_TOPX
, lr_top5
);
94 sendnoticetouser(rqnick
, np
, "- Floods (L): %d", lr_floodattempts
);