]> git.donarmstrong.com Git - infobot.git/blobdiff - src/UserExtra.pl
- added mkcrypt, fixed up "crypt" cmd.
[infobot.git] / src / UserExtra.pl
index 075e0c2703b8d4f19e2432efc69da1ee614fb4d8..e0c234a4cadc3580cb1e05503e77bc18af88b8ef 100644 (file)
@@ -462,13 +462,27 @@ sub userCommands {
     }
 
     # crypt.
-    if ($message =~ /^crypt\s+(\S+)\s*(?:,| )\s*(\S+)/) {
-       # word salt.
-       &pSReply(crypt($1, $2));
-       return;
-    }
+    if ($message =~ /^crypt(\s+(.*))?$/i) {
+       my @args        = split /\s+/, $2;
+
+       if (!scalar @args or scalar @args > 2) {
+           &help("crypt");
+           return;
+       }
+
+       if (scalar @args == 2) {
+           if (length $args[0] != 2) {
+               &msg($who, "invalid format...");
+               return;
+           }
 
+           &pSReply( crypt($args[1], $args[0]) );
+       } else {
+           &pSReply( &mkcrypt($args[0]) );
+       }
 
+       return;
+    }
 
     # cycle.
     if ($message =~ /^(cycle)(\s+(\S+))?$/i) {