]> git.donarmstrong.com Git - infobot.git/blobdiff - src/IRC/IrcHooks.pl
* Try updating Debian.pl again
[infobot.git] / src / IRC / IrcHooks.pl
index eba34ae51a1118e562c0044ace26e0cd60aec25e..d105d8e366b8e981f28c55ce16a3fcb7c9eb49db 100644 (file)
@@ -160,7 +160,7 @@ sub on_endofmotd {
     # first time run.
     if (!exists $users{_default}) {
        &status("!!! First time run... adding _default user.");
-       $users{_default}{FLAGS} = "mrt";
+       $users{_default}{FLAGS} = "amrt";
        $users{_default}{HOSTS}{"*!*@*"} = 1;
     }
 
@@ -171,7 +171,7 @@ sub on_endofmotd {
     }
     # end of first time run.
 
-    if (&IsChanConf('Wingate')) {
+    if (&IsChanConf('Wingate') > 0) {
        my $file = "$bot_base_dir/$param{'ircUser'}.wingate";
        open(IN, $file);
        while (<IN>) {
@@ -231,6 +231,8 @@ sub on_dcc {
     my $type = uc( ($event->args)[1] );
     my $nick = lc $event->nick();
 
+    &status("on_dcc type=$type nick=$nick sock=$sock");
+
     # pity Net::IRC doesn't store nuh. Here's a hack :)
     if (!exists $nuh{lc $nick}) {
        $conn->whois($nick);
@@ -241,12 +243,16 @@ sub on_dcc {
     if ($type eq 'SEND') {     # GET for us.
        # incoming DCC SEND. we're receiving a file.
        my $get = ($event->args)[2];
-       open(DCCGET,">$get");
-
-       $conn->new_get($event, \*DCCGET);
+       &status("DCC: not Initializing GET from $nick to '$param{tempDir}/$get'");
+       # FIXME: do we want to get anything?
+       return;
+       #open(DCCGET,">$param{tempDir}/$get");
+       #$conn->new_get($event, \*DCCGET);
 
     } elsif ($type eq 'GET') { # SEND for us?
-       &status("DCC: Initializing SEND for $nick.");
+       &status("DCC: not Initializing SEND for $nick.");
+       # FIXME: do we want to do anything?
+       return;
        $conn->new_send($event->args);
 
     } elsif ($type eq 'CHAT') {
@@ -274,7 +280,7 @@ sub on_dcc_close {
     if (exists $dcc{'SEND'}{$nick} and -f "$param{tempDir}/$nick.txt") {
        &status("${b_green}DCC SEND$ob close from $b_cyan$nick$ob");
 
-       &status("dcc_close: purging $nick.txt from Debian.pl");
+       &status("dcc_close: purging DCC send $nick.txt");
        unlink "$param{tempDir}/$nick.txt";
 
        delete $dcc{'SEND'}{$nick};
@@ -294,6 +300,8 @@ sub on_dcc_open {
     my $nick = lc $event->nick();
     my $sock = ($event->to)[0];
 
+    &status("on_dcc_open type=$type nick=$nick sock=$sock");
+
     $msgType = 'chat';
     $type ||= "???";
     ### BUG: who is set to bot's nick?
@@ -313,9 +321,9 @@ sub on_dcc_open {
        }
 
     } elsif ($type eq 'SEND') {
-       &DEBUG("Starting DCC receive.");
+       &status("Starting DCC receive.");
        foreach ($event->args) {
-           &DEBUG("  => '$_'.");
+           &status("  => '$_'.");
        }
 
     } else {
@@ -338,7 +346,7 @@ sub on_dcc_open_chat {
     &verifyUser($nick, $nuh{lc $nick});
 
     if (!exists $users{$userHandle}{HOSTS}) {
-       &pSReply("you have no hosts defined in my user file; rejecting.");
+       &performStrictReply("you have no hosts defined in my user file; rejecting.");
        $sock->close();
        return;
     }
@@ -572,12 +580,15 @@ sub on_join {
 
     ### ROOTWARN:
     &rootWarn($who,$user,$host,$chan) if (
-               &IsChanConf('RootWarn') &&
+               &IsChanConf('RootWarn') > 0 &&
                $user =~ /^~?r(oo|ew|00)t$/i
     );
 
+    ### emit a message based on who just joined
+        &onjoin($who,$user,$host,$chan) if (&IsChanConf('OnJoin') > 0);
+
     ### NEWS:
-    if (&IsChanConf('News') && &IsChanConf('newsKeepRead')) {
+    if (&IsChanConf('News') > 0 && &IsChanConf('newsKeepRead') > 0) {
        if (!&loadMyModule('News')) {   # just in case.
            &DEBUG('could not load news.');
        } else {
@@ -586,7 +597,7 @@ sub on_join {
     }
 
     ### botmail:
-    if (&IsChanConf('botmail')) {
+    if (&IsChanConf('botmail') > 0) {
        &botmail::check(lc $who);
     }
 
@@ -711,9 +722,10 @@ sub on_nick {
     $nuh{lc $newnick} = $nuh{lc $nick};
     delete $nuh{lc $nick};
 
-    if ($nick eq $ident) {
+    if ($nick eq $conn->nick()) {
        &status(">>> I materialized into $b_green$newnick$ob from $nick");
-       $ident  = $newnick;
+       $ident = $newnick;
+       $conn->nick($newnick);
     } else {
        &status(">>> $b_cyan$nick$ob materializes into $b_green$newnick$ob");
        my $mynick=$conn->nick();
@@ -862,7 +874,7 @@ sub on_ping_reply {
 sub on_public {
     $conn = shift(@_);
     my ($event) = @_;
-    my $msg    = ($event->args)[0];
+    my $msg    = ($event->args)[0];
     $chan      = lc( ($event->to)[0] );        # CASING.
     my $nick   = $event->nick;
     $who       = $nick;
@@ -962,7 +974,7 @@ sub on_quit {
 
        # chanlimit code.
        foreach $chan ( &getNickInChans($nick) ) {
-           next unless ( &IsChanConf("chanlimitcheck") );
+           next unless ( &IsChanConf("chanlimitcheck") > 0);
            next unless ( exists $channels{$_}{'l'} );
 
            &DEBUG("on_quit: netsplit detected on $_; disabling chan limit.");
@@ -1058,7 +1070,7 @@ sub on_topic {
        &status(">>> topic/$b_blue$chan$ob by $b_cyan$nick$ob -> $topic");
     } else {                                           # join.
        my ($nick, $chan, $topic) = $event->args;
-       if (&IsChanConf('Topic')) {
+       if (&IsChanConf('Topic') > 0) {
            $topic{$chan}{'Current'}    = $topic;
            &topicAddHistory($chan,$topic);
        }