Changeset f35aee7 for root_commands.c


Ignore:
Timestamp:
2008-04-05T12:36:13Z (16 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Branches:
master
Children:
1195cec
Parents:
9143aeb
Message:

Fixed #386.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • root_commands.c

    r9143aeb rf35aee7  
    204204}
    205205
    206 void cmd_account_del_yes( gpointer w, void *data )
    207 {
    208         account_t **aptr = data;
    209         irc_t *irc = (*aptr)->irc;
    210        
    211         if( (*aptr)->ic )
    212         {
    213                 irc_usermsg( irc, "Account is still logged in, can't delete" );
    214         }
    215         else
    216         {
    217                 account_del( irc, (*aptr) );
    218                 irc_usermsg( irc, "Account deleted" );
    219         }
    220         g_free( aptr );
    221 }
    222 
    223 void cmd_account_del_no( gpointer w, void *data )
     206struct cmd_account_del_data
     207{
     208        account_t *a;
     209        irc_t *irc;
     210};
     211
     212void cmd_account_del_yes( void *data )
     213{
     214        struct cmd_account_del_data *cad = data;
     215        account_t *a;
     216       
     217        for( a = cad->irc->accounts; a && a != cad->a; a = a->next );
     218       
     219        if( a == NULL )
     220        {
     221                irc_usermsg( cad->irc, "Account already deleted" );
     222        }
     223        else if( a->ic )
     224        {
     225                irc_usermsg( cad->irc, "Account is still logged in, can't delete" );
     226        }
     227        else
     228        {
     229                account_del( cad->irc, a );
     230                irc_usermsg( cad->irc, "Account deleted" );
     231        }
     232        g_free( data );
     233}
     234
     235void cmd_account_del_no( void *data )
    224236{
    225237        g_free( data );
     
    280292                else
    281293                {
    282                         account_t **aptr;
     294                        struct cmd_account_del_data *cad;
    283295                        char *msg;
    284296                       
    285                         aptr = g_malloc( sizeof( aptr ) );
    286                         *aptr = a;
     297                        cad = g_malloc( sizeof( struct cmd_account_del_data ) );
     298                        cad->a = a;
     299                        cad->irc = irc;
    287300                       
    288301                        msg = g_strdup_printf( "If you remove this account (%s(%s)), BitlBee will "
     
    291304                                               "set' command. Are you sure you want to delete this "
    292305                                               "account?", a->prpl->name, a->user );
    293                         query_add( irc, NULL, msg, cmd_account_del_yes, cmd_account_del_no, aptr );
     306                        query_add( irc, NULL, msg, cmd_account_del_yes, cmd_account_del_no, cad );
    294307                        g_free( msg );
    295308                }
Note: See TracChangeset for help on using the changeset viewer.