]> git.donarmstrong.com Git - infobot.git/commitdiff
- moved read-only stuff from DynaConfig to here.
authordms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Tue, 13 Feb 2001 14:06:20 +0000 (14:06 +0000)
committerdms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Tue, 13 Feb 2001 14:06:20 +0000 (14:06 +0000)
- added newpass
- .chpass didn't use arg[0] for user.

git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@386 c11ca15a-4712-0410-83d8-924469b57eb5

src/Modules/UserDCC.pl

index 2960e2958686bed1d3a1f61b6317db1f3808956f..71a9c585fcb53d803bb436cc5c04934236a2a073 100644 (file)
@@ -17,7 +17,7 @@ sub userDCC {
        # do ircII clients support remote close? if so, cool!
        &status("userDCC: quit called. FIXME");
        &dcc_close($who);
-       &status("hrmm....");
+       &status("userDCC: after dcc_close!");
 
        return;
     }
@@ -504,6 +504,29 @@ sub userDCC {
            return;
        }
 
+       ### TODO: move to UserDCC again.
+       if ($cmd eq "chanset" and !defined $what) {
+           &DEBUG("showing channel conf.");
+
+           foreach $chan ($chan, "_default") {
+               &pSReply("chan: $chan");
+               ### TODO: merge 2 or 3 per line.
+               my @items;
+               my $str = "";
+               foreach (sort keys %{ $chanconf{$chan} }) {
+                   my $newstr = join(', ', @items);
+                   if (length $newstr > 60) {
+                       &pSReply("    $str");
+                       @items = ();
+                   }
+                   $str = $newstr;
+                   push(@items, "$_ => $chanconf{$chan}{$_}");
+               }
+               &pSReply("    $str") if (@items);
+           }
+           return;
+       }
+
        foreach (@chans) {
            &chanSet($cmd, $_, $what, $val);
        }
@@ -593,6 +616,26 @@ sub userDCC {
        return;
     }
 
+    if ($message =~ /^newpass(\s+(.*))?$/) {
+       my(@args) = split /[\s\t]+/, $2 || '';
+
+       if (scalar @args != 1) {
+           &help("newpass");
+           return;
+       }
+
+       my $u = &getUser($who);
+
+       my $salt = join '',('.','/',0..9,'A'..'Z','a'..'z')[rand 64, rand 64];
+       my $crypt = crypt($args[0], $salt);
+       &pSReply("Set your passwd to '$crypt'");
+       $users{$u}{PASS} = $crypt;
+
+       $utime_userfile = time();
+       $ucount_userfile++;
+
+       return;
+    }
 
     if ($message =~ /^chpass(\s+(.*))?$/) {
        my(@args) = split /[\s\t]+/, $2 || '';
@@ -607,7 +650,11 @@ sub userDCC {
            return;
        }
 
-       my $u = &getUser($who);
+       my $u = &getUser($args[0]);
+       if (!defined $u) {
+           &pSReply("Internal error, u = NULL.");
+           return;
+       }
 
        if (scalar @args == 1) {        # del pass.
            if (!&IsFlag("m") and $who !~ /^\Q$verifyUser\E$/i) {