Changes in root_commands.c [9334cc2:cd428e4]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
root_commands.c
r9334cc2 rcd428e4 368 368 } 369 369 370 acc_handle = g_strdup( cmd[2] ); 370 if( g_strncasecmp( cmd[2], "-del", 4 ) == 0 ) 371 acc_handle = g_strdup( cmd[3] ); 372 else 373 acc_handle = g_strdup( cmd[2] ); 374 371 375 if( ( tmp = strchr( acc_handle, '/' ) ) ) 372 376 { … … 374 378 set_name = tmp + 1; 375 379 } 376 a = account_get( irc, acc_handle ); 377 378 if( a == NULL ) 380 381 if( ( a = account_get( irc, acc_handle ) ) == NULL ) 379 382 { 380 383 g_free( acc_handle ); … … 400 403 } 401 404 402 set_setstr( &a->set, set_name, cmd[3] );403 404 405 if( ( strcmp( cmd[3], "=" ) ) == 0 && cmd[4] ) 405 406 irc_usermsg( irc, "Warning: Correct syntax: \002account set <variable> <value>\002 (without =)" ); 407 else if( g_strncasecmp( cmd[2], "-del", 4 ) == 0 ) 408 set_reset( &a->set, set_name ); 409 else 410 set_setstr( &a->set, set_name, cmd[3] ); 406 411 } 407 412 if( set_name ) /* else 'forgotten' on purpose.. Must show new value after changing */ … … 419 424 { 420 425 if( s->value || s->def ) 421 irc_usermsg( irc, "%s = `%s'", s->key, s->value ?s->value:s->def );426 irc_usermsg( irc, "%s = `%s'", s->key, s->value ? s->value : s->def ); 422 427 else 423 428 irc_usermsg( irc, "%s is empty", s->key ); … … 740 745 static void cmd_set( irc_t *irc, char **cmd ) 741 746 { 747 char *set_name; 748 742 749 if( cmd[1] && cmd[2] ) 743 750 { 744 set_setstr( &irc->set, cmd[1], cmd[2] );745 746 751 if( ( strcmp( cmd[2], "=" ) ) == 0 && cmd[3] ) 752 { 747 753 irc_usermsg( irc, "Warning: Correct syntax: \002set <variable> <value>\002 (without =)" ); 754 return; 755 } 756 else if( g_strncasecmp( cmd[1], "-del", 4 ) == 0 ) 757 { 758 set_reset( &irc->set, cmd[2] ); 759 set_name = cmd[2]; 760 } 761 else 762 { 763 set_setstr( &irc->set, cmd[1], cmd[2] ); 764 set_name = cmd[1]; 765 } 748 766 } 749 767 if( cmd[1] ) /* else 'forgotten' on purpose.. Must show new value after changing */ 750 768 { 751 char *s = set_getstr( &irc->set, cmd[1]);752 if( s )753 irc_usermsg( irc, "%s = `%s'", cmd[1], s );754 else 755 irc_usermsg( irc, "%s is empty", cmd[1]);769 char *s = set_getstr( &irc->set, set_name ); 770 if( s ) 771 irc_usermsg( irc, "%s = `%s'", set_name, s ); 772 else 773 irc_usermsg( irc, "%s is empty", set_name ); 756 774 } 757 775 else … … 761 779 { 762 780 if( s->value || s->def ) 763 irc_usermsg( irc, "%s = `%s'", s->key, s->value ?s->value:s->def );781 irc_usermsg( irc, "%s = `%s'", s->key, s->value ? s->value : s->def ); 764 782 else 765 783 irc_usermsg( irc, "%s is empty", s->key );
Note: See TracChangeset
for help on using the changeset viewer.