]> jfr.im git - irc/quakenet/newserv.git/blobdiff - helpmod2/hhooks.c
gline playground
[irc/quakenet/newserv.git] / helpmod2 / hhooks.c
index 42043cd2e0e9aba22fa69da488a54cad1c5647bb..546e1ceafa3e88ab0685effc5050b3dab8c3e7bf 100644 (file)
@@ -1,9 +1,6 @@
 #include <string.h>
 #include <assert.h>
 
-#include "../core/hooks.h"
-#include "../localuser/localuser.h"
-
 #include "helpmod.h"
 #include "hchannel.h"
 #include "haccount.h"
@@ -55,7 +52,7 @@ static void helpmod_hook_join(int unused, void *args)
        else
            hchan->jf_control++;
 
-       if (hchan->jf_control - time(NULL) > 20 && !IsRegOnly(hchan))
+       if (hchan->jf_control - time(NULL) > 12 && !IsRegOnly(hchan))
        {
            if (hchan->flags & H_REPORT && hchannel_is_valid(hchan->report_to))
                helpmod_message_channel(hchan->report_to, "Warning: Possible join flood on %s, setting +r", hchannel_get_name(hchan));
@@ -75,10 +72,10 @@ static void helpmod_hook_join(int unused, void *args)
         return;
     }
 
-    if (huser_get_level(husr) > H_PEON && (huser_get_account_flags(husr) & H_AUTO_OP) && hchannel_authority(hchan, husr))
+    if (huser_get_level(husr) >= H_STAFF && (huser_get_account_flags(husr) & H_AUTO_OP) && hchannel_authority(hchan, husr))
         helpmod_channick_modes(husr, hchan ,MC_OP,HNOW);
 
-    if (huser_get_level(husr) > H_PEON && (huser_get_account_flags(husr) & H_AUTO_VOICE) && hchannel_authority(hchan, husr))
+    if (huser_get_level(husr) >= H_TRIAL && (huser_get_account_flags(husr) & H_AUTO_VOICE) && hchannel_authority(hchan, husr))
         helpmod_channick_modes(husr, hchan, MC_VOICE,HNOW);
 
     if (hchan->flags & H_WELCOME && *hchan->real_channel->index->name->content)
@@ -120,7 +117,9 @@ static void helpmod_hook_channel_newnick(int unused, void *args)
     if (hchan->flags & H_PASSIVE)
         return;
 
-    if (huser_get_level(husr) == H_LAMER || (huser_get_level(husr) == H_PEON && hban_check(nck)))
+    huser_activity(husr, NULL);
+
+    if (huser_get_level(husr) == H_LAMER || (huser_get_level(husr) <= H_TRIAL && hban_check(nck)))
     {
         hban *hb = hban_check(nck);
 
@@ -128,7 +127,7 @@ static void helpmod_hook_channel_newnick(int unused, void *args)
        helpmod_setban(hchan, banmask, time(NULL) + 1 * HDEF_d, MCB_ADD, HNOW);
 
        if (hb)
-           helpmod_kick(hchan, husr,hban_get_reason(hb));
+           helpmod_kick(hchan, husr, "%s", hban_get_reason(hb));
        else
            helpmod_kick(hchan, husr, "Your presence on channel %s is not wanted", hchannel_get_name(hchan));
 
@@ -252,7 +251,6 @@ static void helpmod_hook_channel_deopped(int unused, void *args)
     assert(huserchan != NULL);
 
     huserchan->flags &= ~HCUMODE_OP;
-
 }
 
 static void helpmod_hook_channel_voiced(int unused, void *args)
@@ -339,16 +337,24 @@ static void helpmod_hook_nick_account(int unused, void *args)
 {
     nick *nck = (nick*)args;
     huser *husr = huser_get(nck);
+    huser_channel *huserchan, *huserchannext;
     if (husr == NULL)
         return;
     else
-        husr->account = haccount_get_by_name(nck->authname);
+       husr->account = haccount_get_by_name(nck->authname);
+
+    if (huser_get_level(husr) == H_LAMER) {
+        for (huserchan = husr->hchannels; huserchan; huserchan = huserchannext) {
+            huserchannext = huserchan->next;
+            helpmod_kick(huserchan->hchan, husr, "Your presence on channel %s is not wanted", hchannel_get_name(huserchan->hchan));
+        }
+    }
 }
 
 static void helpmod_hook_server_newserver(int unused, void *args)
 {
     hchannel *hchan;
-    int numeric = (int)args;
+    long numeric = (long)args;
     server srv = serverlist[numeric];
 
     /* check linkstate to prevent spam */