]>
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"
15 #define min(a,b) ((a > b) ? b : a)
17 int lr_requestl(nick
*svc
, nick
*np
, channel
*cp
, nick
*qnick
) {
19 regop
*rolist
[LR_TOPX
], *ro
;
22 if (strlen(cp
->index
->name
->content
) > LR_MAXCHANLEN
) {
23 sendnoticetouser(svc
, np
, "Sorry, your channel name is too long. You will have to "
24 "create a channel with a name less than %d characters long.",
30 cf
= cf_findchanfix(cp
->index
);
33 rocount
= cf_getsortedregops(cf
, LR_TOPX
, rolist
);
37 for (i
= 0; i
< min(LR_TOPX
, rocount
); i
++) {
38 if (cf_cmpregopnick(rolist
[i
], np
)) {
45 sendnoticetouser(svc
, np
, "Sorry, you must be one of the top %d ops "
46 "for the channel '%s'.", LR_TOPX
, cp
->index
->name
->content
);
54 /* treat blocked users as if they're out of targets */
55 if(rq_findblock(np
->authname
) || !rq_tryfasttrack(np
)) {
56 sendnoticetouser(svc
, np
, "Sorry, you may not request %s for another "
57 "channel at this time. Please try again in an hour.", RQ_QNICK
);
64 sendmessagetouser(svc
, qnick
, "addchan %s #%s +jp upgrade %s", cp
->index
->name
->content
,
65 np
->authname
, np
->nick
);
67 sendnoticetouser(svc
, np
, "Success! %s has been added to '%s' "
68 "(contact #help if you require further assistance).",
69 RQ_QNICK
, cp
->index
->name
->content
);
74 void lr_requeststats(nick
*rqnick
, nick
*np
) {
75 sendnoticetouser(rqnick
, np
, "- Too many requests (Q): %d", lr_notargets
);
76 sendnoticetouser(rqnick
, np
, "- Not in top%d (Q): %d", LR_TOPX
, lr_top5
);