[IRCServices] New NickServ Command...

Jason at GCN jasonatgcn at hotmail.com
Wed Jun 21 14:34:17 PDT 2000


I am suggesting a new command like /NickServ TAKE <nick> <passoword>

Services, after making sure that no one is on that nick and that the nick 
and password are correct will do a SVSNICK and identify the the user for 
that nick.  I have the following code, but I want to ask everyone if thay 
know of any potential side effects that the command would cause on services 
if it were to be implemented.  I have tested it and it seems to work fine, 
the follow code is below:

static void do_take(User *u)
{
    char *nick = strtok(NULL, " ");
    char *pass = strtok(NULL, " ");
    NickInfo *ni;
    User *u2;

    if (!nick) {
        syntax_error(s_NickServ, u, "TAKE", NICK_TAKE_SYNTAX);
    } else if ((u2 = finduser(nick))) {
        notice_lang(s_NickServ, u, NICK_X_IN_USE, nick);
    } else if (!(ni = findnick(nick))) {
        notice_lang(s_NickServ, u, NICK_X_NOT_REGISTERED, nick);
    } else if (stricmp(nick, u->nick) == 0) {
        notice_lang(s_NickServ, u, NICK_NO_GHOST_SELF);
    } else if (pass) {
       int res = check_password(pass, ni->pass);
        if (res == 1) {
            send_cmd(NULL, "SVSNICK %s %s :%ld", u->nick, ni->nick, 
time(NULL));
        ni->status |= NS_IDENTIFIED;
        ni->id_timestamp = u->signon;
        if (!(ni->status & NS_RECOGNIZED)) {
            ni->last_seen = time(NULL);
            if (ni->last_usermask)
                free(ni->last_usermask);
            ni->last_usermask = 
smalloc(strlen(u->username)+strlen(u->host)+2);
            sprintf(ni->last_usermask, "%s@%s", u->username, u->host);
            if (ni->last_realname)
                free(ni->last_realname);
            ni->last_realname = sstrdup(u->realname);
        }
        } else {
            if (res == 0) {
                log("%s: RELEASE: invalid password for %s by %s!%s@%s",
                        s_NickServ, nick, u->nick, u->username, u->host);
                bad_password(u);
            }
        }
    } else {
        if (!(ni->flags & NI_SECURE) && is_on_access(u, ni)) {
            char buf[NICKMAX+32];
            snprintf(buf, sizeof(buf), "TAKE command used by %s", u->nick);
            kill_user(s_NickServ, nick, buf);
            notice_lang(s_NickServ, u, NICK_TAKE_KILLED, nick);
        } else {
        }
    }
}

Please tell me what you think, and if you like it, perhaps it  will be 
implemented in future versions of services.
________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com


---------------------------------------------------------------
To unsubscribe, send email to majordomo at ender.shadowfire.org
with "unsubscribe ircservices" in the body, without the quotes.