]> jfr.im git - irc/SurrealServices/srsv.git/commitdiff
Cleanup of SpamServ, added a timer to stop avoid indefinite
authormusashix90 <redacted>
Sun, 14 Mar 2010 15:05:16 +0000 (15:05 +0000)
committermusashix90 <redacted>
Sun, 14 Mar 2010 15:05:16 +0000 (15:05 +0000)
loops, use gen_uuid() for ident generation

git-svn-id: http://svn.tabris.net/repos/srsv@3403 70d4eda1-72e9-0310-a436-91e5bd24443c

branches/0.4.3/modules/spamserv.pm

index 26a2cb103a7adf990fe9466be4a4fd08b49146ec..927642060dcdab5367908cdbb996dedb3026cce8 100644 (file)
@@ -35,22 +35,19 @@ sub ss_newclient {
        unless (!module::is_loaded('services')) {
                open (SSNICKFILE, main::PREFIX()."/config/spamserv/nicklist.txt");
                my ($nick, $ident, $hostmask) = ('','','');
-               my @aznum = ('a'..'z','0'..'9');
                my @hexset = ('A'..'F','0'..'9');
                srand;
                rand($.) < 1 and ($nick=$_) while <SSNICKFILE>;
                chomp $nick;
                close SSNICKFILE;
                if (!nickserv::is_registered($nick) && !nickserv::is_online($nick)) {
-                       $ident = "htIRC-";
-                       for (my $i = 1;$i <= 5;$i++) { $ident .= $aznum[rand @aznum]; }
+                       $ident = "htIRC-".lc(misc::gen_uuid(1,4));
                        for (my $i = 1;$i <= 3;$i++) {
                                for (my $x = 1;$x <= 8;$x++) {
                                        $hostmask .= $hexset[rand @hexset];
                                }
                                $hostmask .= ".";
                        }
-
                        $hostmask .= "IP";
                        $fakehost = $nick."!".$ident."@".$hostmask;
 
@@ -60,12 +57,12 @@ sub ss_newclient {
 
                        $idlelength = int(rand($conf{'idlemax'} - $conf{'idlemin'})) + $conf{'idlemin'};
 
-                       add_timer($fakehost, $idlelength , __PACKAGE__, 'spamserv::ss_respawn');
+                       add_timer($fakehost, $idlelength, __PACKAGE__, 'spamserv::ss_respawn');
 
                        join_chans();
                }
                else {
-                       ss_newclient();
+                       add_timer('', 30, __PACKAGE__, 'spamserv::ss_newclient');
                }
        }
 }