]> jfr.im git - irc/quakenet/newserv.git/blobdiff - chanserv/chanservnetevents.c
CHANSERV: lastactive is now only updated for +o and above joins (changes how often...
[irc/quakenet/newserv.git] / chanserv / chanservnetevents.c
index 32cadf43ab05be824bdc5aff006acbaa1d0e6d0b..7989f90664f690bc7e9aea5b973bc90163936931 100644 (file)
@@ -147,7 +147,7 @@ void cs_handlejoin(int hooknum, void *arg) {
   if (rup && (rup->status & QUSTAT_DEAD))
     rup=NULL;
   
-  if (rup && (rcup=findreguseronchannel(rcp,rup)) && CUKnown(rcup) && cp->users->totalusers >= 3)
+  if (rup && (rcup=findreguseronchannel(rcp,rup)) && CUHasOpPriv(rcup) && cp->users->totalusers >= 3)
     rcp->lastactive=time(NULL);
 
   /* Update last use time */
@@ -175,37 +175,41 @@ void cs_handlejoin(int hooknum, void *arg) {
     isopped=iscreate=0;
   }  
 
-  /* Check for "Q ban" */
-  if (!IsService(np) && cs_bancheck(np,cp)) {
-    /* They got kicked.. */
-    return;
-  }
+  /* Various things that can ban the user on join.  Don't apply these to anyone
+   * with one of +k, +X, +o */
+  if (!IsService(np) && !IsOper(np) && !IsXOper(np)) {
+    /* Check for "Q ban" */
+    if (cs_bancheck(np,cp)) {
+      /* They got kicked.. */
+      return;
+    }
 
-  /* Check for other ban lurking on channel which we are enforcing */
-  if (!IsService(np) && CIsEnforce(rcp) && nickbanned_visible(np,cp)) {
-    localkickuser(chanservnick,cp,np,"Banned.");
-    return;
-  }
+    /* Check for other ban lurking on channel which we are enforcing */
+    if (CIsEnforce(rcp) && nickbanned(np,cp,1)) {
+      localkickuser(chanservnick,cp,np,"Banned.");
+      return;
+    }
 
-  /* Check for +b chanlev flag */
-  if (!IsService(np) && rcup && CUIsBanned(rcup)) {
-    cs_banuser(NULL, cip, np, NULL);
-    cs_timerfunc(cip);
-    return;
-  } 
-
-  /* Check for +k chan flag */
-  if (!IsService(np) && CIsKnownOnly(rcp) && !(rcup && CUKnown(rcup))) {
-    /* Don't ban if they are already "visibly" banned for some reason. */
-    if (IsInviteOnly(cp) || (IsRegOnly(cp) && !IsAccount(np))) {
-      localkickuser(chanservnick,cp,np,"Authorised users only.");
-    } else {      
-      cs_banuser(NULL, cip, np, "Authorised users only.");
+    /* Check for +b chanlev flag */
+    if (rcup && CUIsBanned(rcup)) {
+      cs_banuser(NULL, cip, np, NULL);
       cs_timerfunc(cip);
+      return;
+    } 
+
+    /* Check for +k chan flag */
+    if (CIsKnownOnly(rcp) && !(rcup && CUKnown(rcup))) {
+      /* Don't ban if they are already "visibly" banned for some reason. */
+      if (IsInviteOnly(cp) || (IsRegOnly(cp) && !IsAccount(np))) {
+        localkickuser(chanservnick,cp,np,"Authorised users only.");
+      } else {      
+        cs_banuser(NULL, cip, np, "Authorised users only.");
+        cs_timerfunc(cip);
+      }
+      return;
     }
-    return;
   }
-
+  
   if (!rup || !rcup) {
     /* They're not a registered user, so deop if it is a create */
     if (isopped && !IsService(np)) {
@@ -405,7 +409,7 @@ void cs_handlenewban(int hooknum, void *arg) {
          Error("chanserv",ERR_WARNING,"Found user on channel %s who doesn't exist!",cp->index->name->content);
          continue;
        }
-       if (!IsService(np) && nickmatchban_visible(np,cbp)) {
+       if (!IsService(np) && nickmatchban(np,cbp,1)) {
          localkickuser(chanservnick,cp,np,"Banned.");
        }
       }
@@ -426,10 +430,8 @@ void cs_handletopicchange(int hooknum, void *arg) {
     return;
  
   if (CIsForceTopic(rcp)) {
-    if (rcp->topic) {
-      /* Forced topic: change it back */
-      localsettopic(chanservnick, cp, rcp->topic->content);
-    }
+    /* Forced topic: change it back even if blank */
+    localsettopic(chanservnick, cp, (rcp->topic)?rcp->topic->content:"");
   } else if (CIsTopicSave(rcp)) {
     if (rcp->topic) {
       freesstring(rcp->topic);