Changeset 9a9b520 for irc_commands.c


Ignore:
Timestamp:
2010-07-08T22:31:01Z (9 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
b556e46, f3b6764
Parents:
69b896b
Message:

Allow nick changes if they're only different in capitalisation, fixed
faulty responses in the NICK command, and fixing crash bug in nick changes
before finishing login.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • irc_commands.c

    r69b896b r9a9b520  
    7272static void irc_cmd_nick( irc_t *irc, char **cmd )
    7373{
    74         if( irc_user_by_name( irc, cmd[1] ) )
    75         {
    76                 irc_send_num( irc, 433, ":This nick is already in use" );
     74        irc_user_t *iu;
     75       
     76        if( ( iu = irc_user_by_name( irc, cmd[1] ) ) && iu != irc->user )
     77        {
     78                irc_send_num( irc, 433, "%s :This nick is already in use", cmd[1] );
    7779        }
    7880        else if( !nick_ok( cmd[1] ) )
    7981        {
    8082                /* [SH] Invalid characters. */
    81                 irc_send_num( irc, 432, ":This nick contains invalid characters" );
    82         }
    83         else if( irc->user->nick )
     83                irc_send_num( irc, 432, "%s :This nick contains invalid characters", cmd[1] );
     84        }
     85        else if( irc->status & USTATUS_LOGGED_IN )
    8486        {
    8587                if( irc->status & USTATUS_IDENTIFIED )
     
    98100        else
    99101        {
     102                g_free( irc->user->nick );
    100103                irc->user->nick = g_strdup( cmd[1] );
    101104               
Note: See TracChangeset for help on using the changeset viewer.