]> jfr.im git - irc/quakenet/newserv.git/blobdiff - request/lrequest.c
TRUSTS: require sqlite
[irc/quakenet/newserv.git] / request / lrequest.c
index ac1d53a074601ae053233e8cb1f026f5158f1a7f..feed150ac033790cd7925e2fdc4dbc4e360651cb 100644 (file)
@@ -5,23 +5,22 @@
 #include "request.h"
 #include "lrequest.h"
 #include "request_block.h"
+#include "request_fasttrack.h"
 #include "../localuser/localuser.h"
 
 /* stats counters */
-int lr_noregops = 0;
-int lr_scoretoolow = 0;
 int lr_top5 = 0;
-int lr_floodattempts = 0;
+int lr_notargets = 0;
 
 #define min(a,b) ((a > b) ? b : a)
 
-int lr_requestl(nick *svc, nick *np, channel *cp, nick *lnick) {
+int lr_requestl(nick *svc, nick *np, channel *cp, nick *qnick) {
   chanfix *cf;
   regop *rolist[LR_TOPX], *ro;
   int i, rocount;
 
   if (strlen(cp->index->name->content) > LR_MAXCHANLEN) {
-    sendnoticetouser(svc, np, "Channel name is too long. You will have to "
+    sendnoticetouser(svc, np, "Sorry, your channel name is too long. You will have to "
           "create a channel with a name less than %d characters long.",
           LR_MAXCHANLEN + 1);
 
@@ -30,66 +29,49 @@ int lr_requestl(nick *svc, nick *np, channel *cp, nick *lnick) {
 
   cf = cf_findchanfix(cp->index);
 
-  if (cf == NULL) {
-    sendnoticetouser(svc, np, "Error: Sorry, Your channel '%s' was created recently. Please Try again in an hour.", cp->index->name->content);
+  if(cf) {
+    rocount = cf_getsortedregops(cf, LR_TOPX, rolist);
 
-    lr_noregops++;
+    ro = NULL;
 
-    return RQ_ERROR;
-  }
-
-  rocount = cf_getsortedregops(cf, LR_TOPX, rolist);
-
-  ro = NULL;
-
-  for (i = 0; i < min(LR_TOPX, rocount); i++) {
-    if (cf_cmpregopnick(rolist[i], np)) {
-      ro = rolist[i];
-      break;
+    for (i = 0; i < min(LR_TOPX, rocount); i++) {
+      if (cf_cmpregopnick(rolist[i], np)) {
+        ro = rolist[i];
+        break;
+      }
     }
-  }
 
-  if (ro == NULL) {
-    sendnoticetouser(svc, np, "Error: Sorry, You must be one of the top %d ops "
-          "for the channel %s.", LR_TOPX, cp->index->name->content);
+    if (ro == NULL) {
+      sendnoticetouser(svc, np, "Sorry, you must be one of the top %d ops "
+            "for the channel '%s'.", LR_TOPX, cp->index->name->content);
 
-    lr_top5++;
-
-    return RQ_ERROR;
-  }
-
-  /* treat blocked users as if their score is too low */
-  if (ro->score < LR_CFSCORE || rq_findblock(np->authname)) {
-    if (rq_isspam(np)) {
-      sendnoticetouser(svc, np, "Error: Do not flood the request system. "
-            "Try again in %s.", rq_longtoduration(rq_blocktime(np)));
-
-      lr_floodattempts++;
+      lr_top5++;
 
       return RQ_ERROR;
     }
+  }
 
-    sendnoticetouser(svc, np, "Sorry You do not meet the "
-          "requirements to request L. Please Try again in an hour. "
-          "(see http://www.quakenet.org/faq/faq.php?c=3&f=112 )");
+  /* treat blocked users as if they're out of targets */
+  if(rq_findblock(np->authname) || !rq_tryfasttrack(np)) {
+    sendnoticetouser(svc, np, "Sorry, you may not request %s for another "
+      "channel at this time. Please try again in an hour.", rq_qnick->content);
 
-    lr_scoretoolow++;
+    lr_notargets++;
 
     return RQ_ERROR;
   }
 
-  sendmessagetouser(svc, lnick, "addchan %s #%s %s", cp->index->name->content,
+  sendmessagetouser(svc, qnick, "addchan %s #%s +jp upgrade %s", cp->index->name->content,
         np->authname, np->nick);
 
-  sendnoticetouser(svc, np, "Requirements met, L should be added. Contact #help"
-        " should further assistance be required.");
+  sendnoticetouser(svc, np, "Success! %s has been added to '%s' "
+        "(contact #help if you require further assistance).", 
+        rq_qnick->content, cp->index->name->content);
 
   return RQ_OK;
 }
 
 void lr_requeststats(nick *rqnick, nick *np) {
-  sendnoticetouser(rqnick, np, "- No registered ops (L):          %d", lr_noregops);
-  sendnoticetouser(rqnick, np, "- Score too low (L):              %d", lr_scoretoolow);
-  sendnoticetouser(rqnick, np, "- Not in top%d (L):                %d", LR_TOPX, lr_top5);
-  sendnoticetouser(rqnick, np, "- Floods (L):                     %d", lr_floodattempts);
+  sendnoticetouser(rqnick, np, "- Too many requests (Q):          %d", lr_notargets);
+  sendnoticetouser(rqnick, np, "- Not in top%d (Q):                %d", LR_TOPX, lr_top5);
 }