]> jfr.im git - irc/evilnet/x3.git/commitdiff
added email option to oregister
authorsirvulcan <redacted>
Sat, 11 Feb 2006 23:12:22 +0000 (23:12 +0000)
committersirvulcan <redacted>
Sat, 11 Feb 2006 23:12:22 +0000 (23:12 +0000)
src/nickserv.c
src/nickserv.help

index d1f94cb9200bc483a2941c3a4f2be0bf7a2275b3..05445d55332ed904607edc020eb388fdc512b911 100644 (file)
@@ -1368,19 +1368,26 @@ static NICKSERV_FUNC(cmd_oregister)
     struct userNode *settee;
     struct handle_info *hi;
 
-    NICKSERV_MIN_PARMS(4);
+    NICKSERV_MIN_PARMS(nickserv_conf.email_required ? 5 : 4);
 
     if (!is_valid_handle(argv[1])) {
         reply("NSMSG_BAD_HANDLE", argv[1]);
         return 0;
     }
 
+    if (nickserv_conf.email_required) {
+        if (!is_valid_email_addr(argv[4])) {
+            reply("NSMSG_BAD_EMAIL_ADDR");
+            return 0;
+        }
+    }
+
     if (strchr(argv[3], '@')) {
        mask = canonicalize_hostmask(strdup(argv[3]));
        if (argc > 4) {
-           settee = GetUserH(argv[4]);
+           settee = GetUserH(nickserv_conf.email_required ? argv[5] : argv[4]);
            if (!settee) {
-               reply("MSG_NICK_UNKNOWN", argv[4]);
+               reply("MSG_NICK_UNKNOWN", nickserv_conf.email_required ? argv[5] : argv[4]);
                 free(mask);
                return 0;
            }
@@ -1399,6 +1406,11 @@ static NICKSERV_FUNC(cmd_oregister)
         return 0;
     }
     if (!(hi = nickserv_register(user, settee, argv[1], argv[2], 0))) {
+        if (nickserv_conf.email_required) {
+            nickserv_set_email_addr(hi, argv[4]);
+            if (nickserv_conf.sync_log)
+                SyncLog("REGISTER %s %s %s %s", hi->handle, hi->passwd, argv[4], user->info);
+        }
         free(mask);
         return 0;
     }
@@ -2110,7 +2122,8 @@ static NICKSERV_FUNC(cmd_cookie)
            * This should only happen if an OREGISTER was sent. Require
            * email must be enabled! - SiRVulcaN
            */
-          SyncLog("REGISTER %s %s %s %s", hi->handle, hi->passwd, hi->cookie->data, user->info);
+          if (nickserv_conf.sync_log)
+            SyncLog("REGISTER %s %s %s %s", hi->handle, hi->passwd, hi->cookie->data, user->info);
         }
         nickserv_set_email_addr(hi, hi->cookie->data);
         reply("NSMSG_EMAIL_CHANGED");
index ed25a92eead85964b25f9967d61ce926f4298a4e..cf2031d9f848a06d99d7c9ae80a2189a4048f813 100644 (file)
         "You may use *Account instead of Nick as the name argument; the * makes $N use the name of an account directly (useful if the user is not online).",
         "$uSee Also:$u oaddmask");
 "OREGISTER" {
-        "/services/nickserv/disable_nicks" (
-        "/msg $N@$s OREGISTER <account> <password> <user@host|nick>",
-        "Registers an account with $b$N$b using the specified account, password, and user@host. If the nick of an online user is specified, then that user's user@host is used.  If no nickname or hostmask is used, it uses a default hostmask the first time the user authenticates.",
-        "$uSee Also:$u ounregister"
-        );
-        "!/services/nickserv/disable_nicks" (
-        "/msg $N@$s OREGISTER <account> <password> <user@host|nick>",
-        "Registers an account with $b$N$b using the specified account, password, and user@host. If the nick of an online user is specified, then that user's user@host is used.  If no nickname or hostmask is used, it uses a default hostmask the first time the user authenticates.",
-        "$uSee Also:$u oregnick, ounregister, ounregnick"
-        );
+        "/services/nickserv/disable_nicks" {
+                "/services/nickserv/email_enabled" (
+                "/msg $N@$s OREGISTER <account> <password> <email> <user@host|nick>",
+                "Registers an account with $b$N$b using the specified account, password, email address and user@host. If the nick of an online user is specified, then that user's user@host is used.  If no nickname or hostmask is used, it uses a default hostmask the first time the user authenticates.",
+                "$uSee Also:$u ounregister"
+                );
+                "!/services/nickserv/email_enabled" (
+                "/msg $N@$s OREGISTER <account> <password> <user@host|nick>",
+                "Registers an account with $b$N$b using the specified account, password and user@host. If the nick of an online user is specified, then that user's user@host is used.  If no nickname or hostmask is used, it uses a default hostmask the first time the user authenticates.",
+                "$uSee Also:$u ounregister"
+                );
+        };
+        "!/services/nickserv/disable_nicks" {
+                "/services/nickserv/email_enabled" (
+                "/msg $N@$s OREGISTER <account> <password> <email> <user@host|nick>",
+                "Registers an account with $b$N$b using the specified account, password, email address and user@host. If the nick of an online user is specified, then that user's user@host is used.  If no nickname or hostmask is used, it uses a default hostmask the first time the user authenticates.",
+                "$uSee Also:$u oregnick, ounregister, ounregnick"
+                );
+                "!/services/nickserv/email_enabled" (
+                "/msg $N@$s OREGISTER <account> <password> <user@host|nick>",
+                "Registers an account with $b$N$b using the specified account, password and user@host. If the nick of an online user is specified, then that user's user@host is used.  If no nickname or hostmask is used, it uses a default hostmask the first time the user authenticates.",
+                "$uSee Also:$u oregnick, ounregister, ounregnick"
+                );
+        };
 };
 "OSET" (
           "/msg $N OSET <nick|*account> [<setting> <value>]",