Changeset 783e9b7 for root_commands.c


Ignore:
Timestamp:
2008-05-21T10:28:34Z (16 years ago)
Author:
Jelmer Vernooij <jelmer@…>
Branches:
master
Children:
b6cd9e9, c4a1036
Parents:
51bbec0 (diff), 9299891 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge trunk.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • root_commands.c

    r51bbec0 r783e9b7  
    204204}
    205205
    206 void cmd_account_del_yes( gpointer w, void *data )
    207 {
    208         account_t *a = data;
    209         irc_t *irc = a->irc;
    210        
    211         if( a->ic )
    212         {
    213                 irc_usermsg( irc, "Account is still logged in, can't delete" );
    214         }
    215         else
    216         {
    217                 account_del( irc, a );
    218                 irc_usermsg( irc, "Account deleted" );
    219         }
    220 }
    221 
    222 void cmd_account_del_no( gpointer w, void *data )
    223 {
     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 )
     236{
     237        g_free( data );
    224238}
    225239
     
    278292                else
    279293                {
     294                        struct cmd_account_del_data *cad;
    280295                        char *msg;
     296                       
     297                        cad = g_malloc( sizeof( struct cmd_account_del_data ) );
     298                        cad->a = a;
     299                        cad->irc = irc;
    281300                       
    282301                        msg = g_strdup_printf( "If you remove this account (%s(%s)), BitlBee will "
     
    285304                                               "set' command. Are you sure you want to delete this "
    286305                                               "account?", a->prpl->name, a->user );
    287                         query_add( irc, NULL, msg, cmd_account_del_yes, cmd_account_del_no, a );
     306                        query_add( irc, NULL, msg, cmd_account_del_yes, cmd_account_del_no, cad );
    288307                        g_free( msg );
    289308                }
     
    404423                        acc_handle = g_strdup( cmd[2] );
    405424               
     425                if( !acc_handle )
     426                {
     427                        irc_usermsg( irc, "Not enough parameters given (need %d)", 3 );
     428                        return;
     429                }
     430               
    406431                if( ( tmp = strchr( acc_handle, '/' ) ) )
    407432                {
     
    584609                        g_free( irc->mynick );
    585610                        irc->mynick = g_strdup( cmd[2] );
     611                       
     612                        if( strcmp( cmd[0], "set_rename" ) != 0 )
     613                                set_setstr( &irc->set, "root_nick", cmd[2] );
    586614                }
    587615                else if( u->send_handler == buddy_send_handler )
     
    592620                irc_usermsg( irc, "Nick successfully changed" );
    593621        }
     622}
     623
     624char *set_eval_root_nick( set_t *set, char *new_nick )
     625{
     626        irc_t *irc = set->data;
     627       
     628        if( strcmp( irc->mynick, new_nick ) != 0 )
     629        {
     630                char *cmd[] = { "set_rename", irc->mynick, new_nick, NULL };
     631               
     632                cmd_rename( irc, cmd );
     633        }
     634       
     635        return strcmp( irc->mynick, new_nick ) == 0 ? new_nick : NULL;
    594636}
    595637
Note: See TracChangeset for help on using the changeset viewer.