Changes in / [df417ca:b72caac]


Ignore:
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • bitlbee.c

    rdf417ca rb72caac  
    228228                irc->w_watch_source_id = 0;
    229229               
    230                 if( irc->status == USTATUS_SHUTDOWN )
     230                if( irc->status & USTATUS_SHUTDOWN )
    231231                        irc_free( irc );
    232232               
  • ipc.c

    rdf417ca rb72caac  
    115115static void ipc_child_cmd_wallops( irc_t *irc, char **cmd )
    116116{
    117         if( irc->status < USTATUS_LOGGED_IN )
     117        if( !( irc->status & USTATUS_LOGGED_IN ) )
    118118                return;
    119119       
     
    124124static void ipc_child_cmd_lilo( irc_t *irc, char **cmd )
    125125{
    126         if( irc->status < USTATUS_LOGGED_IN )
     126        if( !( irc->status & USTATUS_LOGGED_IN ) )
    127127                return;
    128128       
     
    133133static void ipc_child_cmd_opermsg( irc_t *irc, char **cmd )
    134134{
    135         if( irc->status < USTATUS_LOGGED_IN )
     135        if( !( irc->status & USTATUS_LOGGED_IN ) )
    136136                return;
    137137       
     
    154154static void ipc_child_cmd_kill( irc_t *irc, char **cmd )
    155155{
    156         if( irc->status < USTATUS_LOGGED_IN )
     156        if( !( irc->status & USTATUS_LOGGED_IN ) )
    157157                return;
    158158       
     
    166166static void ipc_child_cmd_hello( irc_t *irc, char **cmd )
    167167{
    168         if( irc->status < USTATUS_LOGGED_IN )
     168        if( !( irc->status & USTATUS_LOGGED_IN ) )
    169169                ipc_to_master_str( "HELLO\r\n" );
    170170        else
  • irc.c

    rdf417ca rb72caac  
    177177        }
    178178       
    179         irc->status = USTATUS_SHUTDOWN;
     179        irc->status |= USTATUS_SHUTDOWN;
    180180        if( irc->sendbuffer && !immed )
    181181        {
     
    211211        log_message( LOGLVL_INFO, "Destroying connection with fd %d", irc->fd );
    212212       
    213         if( irc->status >= USTATUS_IDENTIFIED && set_getint( irc, "save_on_quit" ) )
     213        if( irc->status & USTATUS_IDENTIFIED && set_getint( irc, "save_on_quit" ) )
    214214                if( storage_save( irc, TRUE ) != STORAGE_OK )
    215215                        irc_usermsg( irc, "Error while saving settings!" );
     
    707707        if( irc->user && irc->nick )
    708708        {
    709                 if( global.conf->authmode == AUTHMODE_CLOSED && irc->status < USTATUS_AUTHORIZED )
     709                if( global.conf->authmode == AUTHMODE_CLOSED && !( irc->status & USTATUS_AUTHORIZED ) )
    710710                {
    711711                        irc_reply( irc, 464, ":This server is password-protected." );
     
    764764                ipc_to_master_str( "CLIENT %s %s :%s\r\n", irc->host, irc->nick, irc->realname );
    765765       
    766         irc->status = USTATUS_LOGGED_IN;
     766        irc->status |= USTATUS_LOGGED_IN;
    767767}
    768768
     
    905905void irc_kill( irc_t *irc, user_t *u )
    906906{
    907         char *nick;
    908        
    909         irc_write( irc, ":%s!%s@%s QUIT :%s", u->nick, u->user, u->host, "Leaving..." );
     907        char *nick, *s;
     908        char reason[64];
     909       
     910        if( u->gc && u->gc->flags & OPT_LOGGING_OUT )
     911        {
     912                if( u->gc->user->proto_opt[0][0] )
     913                        g_snprintf( reason, sizeof( reason ), "%s %s", irc->myhost,
     914                                    u->gc->user->proto_opt[0] );
     915                else if( ( s = strchr( u->gc->username, '@' ) ) )
     916                        g_snprintf( reason, sizeof( reason ), "%s %s", irc->myhost,
     917                                    s + 1 );
     918                else
     919                        g_snprintf( reason, sizeof( reason ), "%s %s.%s", irc->myhost,
     920                                    u->gc->prpl->name, irc->myhost );
     921               
     922                /* proto_opt might contain garbage after the : */
     923                if( ( s = strchr( reason, ':' ) ) )
     924                        *s = 0;
     925        }
     926        else
     927        {
     928                strcpy( reason, "Leaving..." );
     929        }
     930       
     931        irc_write( irc, ":%s!%s@%s QUIT :%s", u->nick, u->user, u->host, reason );
    910932       
    911933        nick = g_strdup( u->nick );
     
    11651187        int rv = 0;
    11661188       
    1167         if( irc->status < USTATUS_LOGGED_IN )
     1189        if( !( irc->status & USTATUS_LOGGED_IN ) )
    11681190        {
    11691191                if( gettime() > ( irc->last_pong + IRC_LOGIN_TIMEOUT ) )
  • irc.h

    rdf417ca rb72caac  
    4242{
    4343        USTATUS_OFFLINE = 0,
    44         USTATUS_AUTHORIZED,
    45         USTATUS_LOGGED_IN,
    46         USTATUS_IDENTIFIED,
    47         USTATUS_SHUTDOWN = -1
     44        USTATUS_AUTHORIZED = 1,
     45        USTATUS_LOGGED_IN = 2,
     46        USTATUS_IDENTIFIED = 4,
     47        USTATUS_SHUTDOWN = 8
    4848} irc_status_t;
    4949
  • irc_commands.c

    rdf417ca rb72caac  
    3232        if( global.conf->auth_pass && strcmp( cmd[1], global.conf->auth_pass ) == 0 )
    3333        {
    34                 irc->status = USTATUS_AUTHORIZED;
     34                irc->status |= USTATUS_AUTHORIZED;
    3535                irc_check_login( irc );
    3636        }
     
    610610                        for( n_arg = 0; cmd[n_arg]; n_arg ++ ); n_arg --;
    611611                       
    612                         if( irc_commands[i].flags & IRC_CMD_PRE_LOGIN && irc->status >= USTATUS_LOGGED_IN )
     612                        if( irc_commands[i].flags & IRC_CMD_PRE_LOGIN && irc->status & USTATUS_LOGGED_IN )
    613613                        {
    614614                                irc_reply( irc, 462, ":Only allowed before logging in" );
    615615                        }
    616                         else if( irc_commands[i].flags & IRC_CMD_LOGGED_IN && irc->status < USTATUS_LOGGED_IN )
     616                        else if( irc_commands[i].flags & IRC_CMD_LOGGED_IN && !( irc->status & USTATUS_LOGGED_IN ) )
    617617                        {
    618618                                irc_reply( irc, 451, ":Register first" );
  • protocols/msn/msn.c

    rdf417ca rb72caac  
    6464        GSList *l;
    6565       
    66         if( md->fd >= 0 )
    67                 closesocket( md->fd );
    68        
    69         if( md->handler )
    70         {
    71                 if( md->handler->rxq ) g_free( md->handler->rxq );
    72                 if( md->handler->cmd_text ) g_free( md->handler->cmd_text );
    73                 g_free( md->handler );
    74         }
    75        
    76         while( md->switchboards )
    77                 msn_sb_destroy( md->switchboards->data );
    78        
    79         if( md->msgq )
    80         {
    81                 struct msn_message *m;
    82                
    83                 for( l = md->msgq; l; l = l->next )
    84                 {
    85                         m = l->data;
    86                
    87                         serv_got_crap( gc, "Warning: Closing down MSN connection with unsent message to %s, you'll have to resend it.", m->who );
    88                         g_free( m->who );
    89                         g_free( m->text );
    90                         g_free( m );
    91                 }
    92                 g_slist_free( md->msgq );
     66        if( md )
     67        {
     68                if( md->fd >= 0 )
     69                        closesocket( md->fd );
     70               
     71                if( md->handler )
     72                {
     73                        if( md->handler->rxq ) g_free( md->handler->rxq );
     74                        if( md->handler->cmd_text ) g_free( md->handler->cmd_text );
     75                        g_free( md->handler );
     76                }
     77               
     78                while( md->switchboards )
     79                        msn_sb_destroy( md->switchboards->data );
     80               
     81                if( md->msgq )
     82                {
     83                        struct msn_message *m;
     84                       
     85                        for( l = md->msgq; l; l = l->next )
     86                        {
     87                                m = l->data;
     88                       
     89                                serv_got_crap( gc, "Warning: Closing down MSN connection with unsent message to %s, you'll have to resend it.", m->who );
     90                                g_free( m->who );
     91                                g_free( m->text );
     92                                g_free( m );
     93                        }
     94                        g_slist_free( md->msgq );
     95                }
     96               
     97                g_free( md );
    9398        }
    9499       
     
    100105                g_free( l->data );
    101106        g_slist_free( gc->deny );
    102        
    103         g_free( md );
    104107       
    105108        msn_connections = g_slist_remove( msn_connections, gc );
  • protocols/nogaim.c

    rdf417ca rb72caac  
    294294       
    295295        serv_got_crap( gc, "Signing off.." );
    296 
     296       
    297297        b_event_remove( gc->keepalive );
     298        gc->flags |= OPT_LOGGING_OUT;
    298299        gc->keepalive = 0;
    299300        gc->prpl->close( gc );
  • protocols/nogaim.h

    rdf417ca rb72caac  
    5454#define WEBSITE "http://www.bitlbee.org/"
    5555#define IM_FLAG_AWAY 0x0020
    56 #define OPT_CONN_HTML 0x00000001
    57 #define OPT_LOGGED_IN 0x00010000
    5856#define GAIM_AWAY_CUSTOM "Custom"
     57
     58#define OPT_CONN_HTML   0x00000001
     59#define OPT_LOGGED_IN   0x00010000
     60#define OPT_LOGGING_OUT 0x00020000
    5961
    6062/* ok. now the fun begins. first we create a connection structure */
  • root_commands.c

    rdf417ca rb72caac  
    163163                       
    164164                case STORAGE_OK:
    165                         irc->status = USTATUS_IDENTIFIED;
     165                        irc->status |= USTATUS_IDENTIFIED;
    166166                        irc_umode_set( irc, "+R", 1 );
    167167                        break;
     
    187187        case STORAGE_OK:
    188188                irc_setpass( irc, NULL );
    189                 irc->status = USTATUS_LOGGED_IN;
     189                irc->status &= ~USTATUS_IDENTIFIED;
    190190                irc_umode_set( irc, "-R", 1 );
    191191                irc_usermsg( irc, "Account `%s' removed", irc->nick );
     
    201201        account_t *a;
    202202       
    203         if( global.conf->authmode == AUTHMODE_REGISTERED && irc->status < USTATUS_IDENTIFIED )
     203        if( global.conf->authmode == AUTHMODE_REGISTERED && !( irc->status & USTATUS_IDENTIFIED ) )
    204204        {
    205205                irc_usermsg( irc, "This server only accepts registered users" );
  • storage_text.c

    rdf417ca rb72caac  
    7171        user_t *ru = user_find( irc, ROOT_NICK );
    7272       
    73         if( irc->status >= USTATUS_IDENTIFIED )
     73        if( irc->status & USTATUS_IDENTIFIED )
    7474                return( 1 );
    7575       
     
    8888        /* Do this now. If the user runs with AuthMode = Registered, the
    8989           account command will not work otherwise. */
    90         irc->status = USTATUS_IDENTIFIED;
     90        irc->status |= USTATUS_IDENTIFIED;
    9191       
    9292        while( fscanf( fp, "%511[^\n]s", s ) > 0 )
Note: See TracChangeset for help on using the changeset viewer.