]>
jfr.im git - irc/quakenet/newserv.git/blob - request/lrequest.c
1 /* required modules: splitlist, chanfix(3) */
7 #include "request_block.h"
8 #include "request_fasttrack.h"
9 #include "../localuser/localuser.h"
13 int lr_scoretoolow
= 0;
15 int lr_floodattempts
= 0;
17 #define min(a,b) ((a > b) ? b : a)
19 int lr_requestl(nick
*svc
, nick
*np
, channel
*cp
, nick
*qnick
) {
21 regop
*rolist
[LR_TOPX
], *ro
;
24 if (strlen(cp
->index
->name
->content
) > LR_MAXCHANLEN
) {
25 sendnoticetouser(svc
, np
, "Sorry, your channel name is too long. You will have to "
26 "create a channel with a name less than %d characters long.",
32 cf
= cf_findchanfix(cp
->index
);
35 rocount
= cf_getsortedregops(cf
, LR_TOPX
, rolist
);
39 for (i
= 0; i
< min(LR_TOPX
, rocount
); i
++) {
40 if (cf_cmpregopnick(rolist
[i
], np
)) {
47 sendnoticetouser(svc
, np
, "Sorry, you must be one of the top %d ops "
48 "for the channel '%s'.", LR_TOPX
, cp
->index
->name
->content
);
56 if(!rq_tryfasttrack(np
)) {
58 sendnoticetouser(svc
, np
, "Sorry, your channel '%s' was created recently. "
59 "Please try again in an hour.", cp
->index
->name
->content
);
66 /* treat blocked users as if their score is too low */
67 if (ro
->score
< LR_CFSCORE
|| rq_findblock(np
->authname
)) {
68 sendnoticetouser(svc
, np
, "Sorry, you do not meet the "
69 "%s request requirements; please try again in an hour, "
70 "see http://www.quakenet.org/faq/faq.php?c=1&f=6#6", RQ_QNICK
);
78 sendmessagetouser(svc
, qnick
, "addchan %s #%s +jp upgrade %s", cp
->index
->name
->content
,
79 np
->authname
, np
->nick
);
81 sendnoticetouser(svc
, np
, "Success! %s has been added to '%s' "
82 "(contact #help if you require further assistance).",
83 RQ_QNICK
, cp
->index
->name
->content
);
88 void lr_requeststats(nick
*rqnick
, nick
*np
) {
89 sendnoticetouser(rqnick
, np
, "- No registered ops (Q): %d", lr_noregops
);
90 sendnoticetouser(rqnick
, np
, "- Score too low (Q): %d", lr_scoretoolow
);
91 sendnoticetouser(rqnick
, np
, "- Not in top%d (Q): %d", LR_TOPX
, lr_top5
);
92 sendnoticetouser(rqnick
, np
, "- Floods (Q): %d", lr_floodattempts
);