Changeset 6738a67 for root_commands.c


Ignore:
Timestamp:
2008-07-16T23:22:52Z (16 years ago)
Author:
Sven Moritz Hallberg <pesco@…>
Branches:
master
Children:
9b55485
Parents:
9730d72 (diff), 6a78c0e (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 in latest trunk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • root_commands.c

    r9730d72 r6738a67  
    205205}
    206206
     207struct cmd_account_del_data
     208{
     209        account_t *a;
     210        irc_t *irc;
     211};
     212
     213void cmd_account_del_yes( void *data )
     214{
     215        struct cmd_account_del_data *cad = data;
     216        account_t *a;
     217       
     218        for( a = cad->irc->accounts; a && a != cad->a; a = a->next );
     219       
     220        if( a == NULL )
     221        {
     222                irc_usermsg( cad->irc, "Account already deleted" );
     223        }
     224        else if( a->ic )
     225        {
     226                irc_usermsg( cad->irc, "Account is still logged in, can't delete" );
     227        }
     228        else
     229        {
     230                account_del( cad->irc, a );
     231                irc_usermsg( cad->irc, "Account deleted" );
     232        }
     233        g_free( data );
     234}
     235
     236void cmd_account_del_no( void *data )
     237{
     238        g_free( data );
     239}
     240
    207241static void cmd_account( irc_t *irc, char **cmd )
    208242{
     
    263297                else
    264298                {
    265                         account_del( irc, a );
    266                         irc_usermsg( irc, "Account deleted" );
     299                        struct cmd_account_del_data *cad;
     300                        char *msg;
     301                       
     302                        cad = g_malloc( sizeof( struct cmd_account_del_data ) );
     303                        cad->a = a;
     304                        cad->irc = irc;
     305                       
     306                        msg = g_strdup_printf( "If you remove this account (%s(%s)), BitlBee will "
     307                                               "also forget all your saved nicknames. If you want "
     308                                               "to change your username/password, use the `account "
     309                                               "set' command. Are you sure you want to delete this "
     310                                               "account?", a->prpl->name, a->user );
     311                        query_add( irc, NULL, msg, cmd_account_del_yes, cmd_account_del_no, cad );
     312                        g_free( msg );
    267313                }
    268314        }
     
    382428                        acc_handle = g_strdup( cmd[2] );
    383429               
     430                if( !acc_handle )
     431                {
     432                        irc_usermsg( irc, "Not enough parameters given (need %d)", 3 );
     433                        return;
     434                }
     435               
    384436                if( ( tmp = strchr( acc_handle, '/' ) ) )
    385437                {
     
    562614                        g_free( irc->mynick );
    563615                        irc->mynick = g_strdup( cmd[2] );
     616                       
     617                        if( strcmp( cmd[0], "set_rename" ) != 0 )
     618                                set_setstr( &irc->set, "root_nick", cmd[2] );
    564619                }
    565620                else if( u->send_handler == buddy_send_handler )
     
    570625                irc_usermsg( irc, "Nick successfully changed" );
    571626        }
     627}
     628
     629char *set_eval_root_nick( set_t *set, char *new_nick )
     630{
     631        irc_t *irc = set->data;
     632       
     633        if( strcmp( irc->mynick, new_nick ) != 0 )
     634        {
     635                char *cmd[] = { "set_rename", irc->mynick, new_nick, NULL };
     636               
     637                cmd_rename( irc, cmd );
     638        }
     639       
     640        return strcmp( irc->mynick, new_nick ) == 0 ? new_nick : NULL;
    572641}
    573642
     
    774843                else
    775844                        irc_usermsg( irc, "%s is empty", set_name );
     845
     846                if( strchr( set_name, '/' ) )
     847                        irc_usermsg( irc, "Warning: / found in setting name, you're probably looking for the `account set' command." );
    776848        }
    777849        else
Note: See TracChangeset for help on using the changeset viewer.