]>
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
*qnick
) {
20 regop
*rolist
[LR_TOPX
], *ro
;
23 if (strlen(cp
->index
->name
->content
) > LR_MAXCHANLEN
) {
24 sendnoticetouser(svc
, np
, "Sorry, your 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
, "Sorry, your channel '%s' was created recently. "
35 "Please try again in an hour.", cp
->index
->name
->content
);
42 rocount
= cf_getsortedregops(cf
, LR_TOPX
, rolist
);
46 for (i
= 0; i
< min(LR_TOPX
, rocount
); i
++) {
47 if (cf_cmpregopnick(rolist
[i
], np
)) {
54 sendnoticetouser(svc
, np
, "Sorry, you must be one of the top %d ops "
55 "for the channel '%s'.", LR_TOPX
, cp
->index
->name
->content
);
62 /* treat blocked users as if their score is too low */
63 if (ro
->score
< LR_CFSCORE
|| rq_findblock(np
->authname
)) {
65 sendnoticetouser(svc
, np
, "Do not flood the request system. "
66 "Try again in %s.", rq_longtoduration(rq_blocktime(np
)));
73 sendnoticetouser(svc
, np
, "Sorry, you do not meet the "
74 "%s request requirements; please try again in an hour, "
75 "see http://www.quakenet.org/faq/faq.php?c=1&f=6#6", RQ_QNICK
);
83 sendmessagetouser(svc
, qnick
, "addchan %s #%s +jp upgrade %s", cp
->index
->name
->content
,
84 np
->authname
, np
->nick
);
86 sendnoticetouser(svc
, np
, "Success! %s has been added to '%s' "
87 "(contact #help if you require further assistance).",
88 RQ_QNICK
, cp
->index
->name
->content
);
93 void lr_requeststats(nick
*rqnick
, nick
*np
) {
94 sendnoticetouser(rqnick
, np
, "- No registered ops (Q): %d", lr_noregops
);
95 sendnoticetouser(rqnick
, np
, "- Score too low (Q): %d", lr_scoretoolow
);
96 sendnoticetouser(rqnick
, np
, "- Not in top%d (Q): %d", LR_TOPX
, lr_top5
);
97 sendnoticetouser(rqnick
, np
, "- Floods (Q): %d", lr_floodattempts
);