Changeset cd428e4
- Timestamp:
- 2007-11-17T12:20:51Z (17 years ago)
- Branches:
- master
- Children:
- 256899f
- Parents:
- 1bf1ae6
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/user-guide/commands.xml
r1bf1ae6 rcd428e4 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> 136 137 137 138 <description> … … 141 142 142 143 <para> 143 For more infomation about a setting, see <emphasis>help set <setting></emphasis>. 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>. 144 145 </para> 145 146 … … 246 247 <bitlbee-command name="set"> 247 248 <short-description>Miscellaneous settings</short-description> 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. 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. 254 258 </para> 255 259 -
root_commands.c
r1bf1ae6 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 ); -
set.c
r1bf1ae6 rcd428e4 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 170 179 char *set_eval_int( set_t *set, char *value ) 171 180 { -
set.h
r1bf1ae6 rcd428e4 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 ); 90 91 91 92 /* Two very useful generic evaluators. */
Note: See TracChangeset
for help on using the changeset viewer.