Changeset 758


Ignore:
Timestamp:
07/07/06 04:14:44 (6 years ago)
Author:
wd
Message:

Use client_change_nick for unregistered users too. Change it to support
that behavior correctly.

Location:
branches/ithildin-1.1/modules/ircd
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/ithildin-1.1/modules/ircd/client.c

    r728 r758  
    139139 * however, as that is left up to the caller. */ 
    140140void client_change_nick(client_t *cli, char *to) { 
    141     int casechng; 
     141    int casechng = !istrcmp(ircd.maps.nick, cli->nick, to); 
    142142     
    143143    /* check to see if this is just a case change.  if it is, istrcmp will 
    144144     * return 0.  if it's a case change, we don't do anything except set the 
    145145     * new nickname in the client structure. */ 
    146     casechng = !istrcmp(ircd.maps.nick, cli->nick, to); 
    147     if (!casechng) { 
     146    if (*cli->nick != '\0' && !casechng) { 
    148147        hash_delete(ircd.hashes.client, cli); 
    149         client_add_history(cli); 
    150     } 
     148 
     149        /* History entries for unregistered clients are extremely useless, 
     150         * and detrimental sometimes. */ 
     151        if (CLIENT_REGISTERED(cli)) 
     152            client_add_history(cli); 
     153    } 
     154 
    151155    strncpy(cli->nick, to, NICKLEN); 
     156 
    152157    if (!casechng) { 
    153158        hash_insert(ircd.hashes.client, cli); 
    154         hook_event(ircd.events.client_nick, cli); 
     159 
     160        /* We only hook client_nick for registered clients, there is little 
     161         * value in hooking it for nonregistered folks. */ 
     162        if (CLIENT_REGISTERED(cli)) 
     163            hook_event(ircd.events.client_nick, cli); 
    155164    } 
    156165} 
  • branches/ithildin-1.1/modules/ircd/commands/nick.c

    r757 r758  
    106106            sendto_one(cli, RPL_FMT(cli, changeok), argv[1]); 
    107107        else if (changeok < 0) { 
    108             strcpy(cli->nick, argv[1]); 
    109             /* add the client to the hash immediately to prevent collisions. */ 
    110             hash_insert(ircd.hashes.client, cli); 
     108            client_change_nick(cli, argv[1]); 
    111109            /* if the username has been filled in then assume the USER command 
    112110             * was called as well. */ 
     
    158156     * a channel, sendto_common_channels ensures they'll get the message */ 
    159157    sendto_common_channels(cli, NULL, "NICK", ":%s", argv[1]); 
    160     sendto_serv_butone(sptr, cli, NULL, NULL, "NICK", "%s :%d", argv[1], 
    161             cli->ts); 
     158    sendto_serv_butone(sptr, cli, NULL, NULL, "NICK", "%s :%d", 
     159            argv[1], cli->ts); 
    162160    client_change_nick(cli, argv[1]); 
    163161 
Note: See TracChangeset for help on using the changeset viewer.