Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • irc.c

    r574af7e r3af70b0  
    179179        }
    180180       
    181         irc->status = USTATUS_SHUTDOWN;
     181        irc->status |= USTATUS_SHUTDOWN;
    182182        if( irc->sendbuffer && !immed )
    183183        {
     
    213213        log_message( LOGLVL_INFO, "Destroying connection with fd %d", irc->fd );
    214214       
    215         if( irc->status >= USTATUS_IDENTIFIED && set_getint( irc, "save_on_quit" ) )
     215        if( irc->status & USTATUS_IDENTIFIED && set_getint( irc, "save_on_quit" ) )
    216216                if( storage_save( irc, TRUE ) != STORAGE_OK )
    217217                        irc_usermsg( irc, "Error while saving settings!" );
     
    701701        if( irc->user && irc->nick )
    702702        {
    703                 if( global.conf->authmode == AUTHMODE_CLOSED && irc->status < USTATUS_AUTHORIZED )
     703                if( global.conf->authmode == AUTHMODE_CLOSED && !( irc->status & USTATUS_AUTHORIZED ) )
    704704                {
    705705                        irc_reply( irc, 464, ":This server is password-protected." );
     
    758758                ipc_to_master_str( "CLIENT %s %s :%s\r\n", irc->host, irc->nick, irc->realname );
    759759       
    760         irc->status = USTATUS_LOGGED_IN;
     760        irc->status |= USTATUS_LOGGED_IN;
    761761}
    762762
     
    899899void irc_kill( irc_t *irc, user_t *u )
    900900{
    901         char *nick;
    902        
    903         irc_write( irc, ":%s!%s@%s QUIT :%s", u->nick, u->user, u->host, "Leaving..." );
     901        char *nick, *s;
     902        char reason[64];
     903       
     904        if( u->gc && u->gc->flags & OPT_LOGGING_OUT )
     905        {
     906                if( u->gc->user->proto_opt[0][0] )
     907                        g_snprintf( reason, sizeof( reason ), "%s %s", irc->myhost,
     908                                    u->gc->user->proto_opt[0] );
     909                else if( ( s = strchr( u->gc->username, '@' ) ) )
     910                        g_snprintf( reason, sizeof( reason ), "%s %s", irc->myhost,
     911                                    s + 1 );
     912                else
     913                        g_snprintf( reason, sizeof( reason ), "%s %s.%s", irc->myhost,
     914                                    u->gc->prpl->name, irc->myhost );
     915               
     916                /* proto_opt might contain garbage after the : */
     917                if( ( s = strchr( reason, ':' ) ) )
     918                        *s = 0;
     919        }
     920        else
     921        {
     922                strcpy( reason, "Leaving..." );
     923        }
     924       
     925        irc_write( irc, ":%s!%s@%s QUIT :%s", u->nick, u->user, u->host, reason );
    904926       
    905927        nick = g_strdup( u->nick );
     
    11591181        int rv = 0;
    11601182       
    1161         if( irc->status < USTATUS_LOGGED_IN )
     1183        if( !( irc->status & USTATUS_LOGGED_IN ) )
    11621184        {
    11631185                if( gettime() > ( irc->last_pong + IRC_LOGIN_TIMEOUT ) )
Note: See TracChangeset for help on using the changeset viewer.