Changes in / [256899f:ef5c185]
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/user-guide/commands.xml
r256899f ref5c185 134 134 <syntax>account set <account id>/<setting></syntax> 135 135 <syntax>account set <account id>/<setting> <value></syntax> 136 <syntax>account set -del <account id>/<setting></syntax>137 136 138 137 <description> … … 142 141 143 142 <para> 144 For more infomation about a setting, see <emphasis>help set <setting></emphasis>. For details about the syntax of this command, see <emphasis>help set</emphasis>.143 For more infomation about a setting, see <emphasis>help set <setting></emphasis>. 145 144 </para> 146 145 … … 247 246 <bitlbee-command name="set"> 248 247 <short-description>Miscellaneous settings</short-description> 249 <syntax>set</syntax> 250 <syntax>set <variable></syntax> 251 <syntax>set <variable> <value></syntax> 252 <syntax>set -del <variable></syntax> 253 254 <description> 255 256 <para> 257 Without any arguments, this command lists all the set variables. You can also specify a single argument, a variable name, to get that variable's value. To change this value, specify the new value as the second argument. With <emphasis>-del</emphasis> you can reset a setting to its default value. 248 <syntax>set [<variable> [<value>]]</syntax> 249 250 <description> 251 252 <para> 253 Without any arguments, this command lists all the set variables. You can also specify a single argument, a variable name, to get that variable's value. To change this value, specify the new value as the second argument. 258 254 </para> 259 255 -
root_commands.c
r256899f ref5c185 368 368 } 369 369 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 370 acc_handle = g_strdup( cmd[2] ); 375 371 if( ( tmp = strchr( acc_handle, '/' ) ) ) 376 372 { … … 378 374 set_name = tmp + 1; 379 375 } 380 381 if( ( a = account_get( irc, acc_handle ) ) == NULL ) 376 a = account_get( irc, acc_handle ); 377 378 if( a == NULL ) 382 379 { 383 380 g_free( acc_handle ); … … 403 400 } 404 401 402 set_setstr( &a->set, set_name, cmd[3] ); 403 405 404 if( ( strcmp( cmd[3], "=" ) ) == 0 && cmd[4] ) 406 405 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 else410 set_setstr( &a->set, set_name, cmd[3] );411 406 } 412 407 if( set_name ) /* else 'forgotten' on purpose.. Must show new value after changing */ … … 424 419 { 425 420 if( s->value || s->def ) 426 irc_usermsg( irc, "%s = `%s'", s->key, s->value ? s->value :s->def );421 irc_usermsg( irc, "%s = `%s'", s->key, s->value?s->value:s->def ); 427 422 else 428 423 irc_usermsg( irc, "%s is empty", s->key ); … … 745 740 static void cmd_set( irc_t *irc, char **cmd ) 746 741 { 747 char *set_name;748 749 742 if( cmd[1] && cmd[2] ) 750 743 { 744 set_setstr( &irc->set, cmd[1], cmd[2] ); 745 751 746 if( ( strcmp( cmd[2], "=" ) ) == 0 && cmd[3] ) 752 {753 747 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 } 748 } 749 if( cmd[1] ) /* else 'forgotten' on purpose.. Must show new value after changing */ 750 { 751 char *s = set_getstr( &irc->set, cmd[1] ); 752 if( s ) 753 irc_usermsg( irc, "%s = `%s'", cmd[1], s ); 761 754 else 762 { 763 set_setstr( &irc->set, cmd[1], cmd[2] ); 764 set_name = cmd[1]; 765 } 766 } 767 if( cmd[1] ) /* else 'forgotten' on purpose.. Must show new value after changing */ 768 { 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 ); 755 irc_usermsg( irc, "%s is empty", cmd[1] ); 774 756 } 775 757 else … … 779 761 { 780 762 if( s->value || s->def ) 781 irc_usermsg( irc, "%s = `%s'", s->key, s->value ? s->value :s->def );763 irc_usermsg( irc, "%s = `%s'", s->key, s->value?s->value:s->def ); 782 764 else 783 765 irc_usermsg( irc, "%s is empty", s->key ); -
set.c
r256899f ref5c185 168 168 } 169 169 170 void set_reset( set_t **head, char *key )171 {172 set_t *s;173 174 s = set_find( head, key );175 if( s )176 set_setstr( head, key, s->def );177 }178 179 170 char *set_eval_int( set_t *set, char *value ) 180 171 { -
set.h
r256899f ref5c185 88 88 int set_setint( set_t **head, char *key, int value ); 89 89 void set_del( set_t **head, char *key ); 90 void set_reset( set_t **head, char *key );91 90 92 91 /* Two very useful generic evaluators. */
Note: See TracChangeset
for help on using the changeset viewer.