Changeset d5ccd83
- Timestamp:
- 2006-08-13T19:15:23Z (18 years ago)
- Branches:
- master
- Children:
- 08cdb93
- Parents:
- 846cec61
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
irc.c
r846cec61 rd5ccd83 213 213 log_message( LOGLVL_INFO, "Destroying connection with fd %d", irc->fd ); 214 214 215 if( irc->status & USTATUS_IDENTIFIED && set_get int( &irc->set, "save_on_quit" ) )215 if( irc->status & USTATUS_IDENTIFIED && set_getbool( &irc->set, "save_on_quit" ) ) 216 216 if( storage_save( irc, TRUE ) != STORAGE_OK ) 217 217 irc_usermsg( irc, "Error while saving settings!" ); … … 1058 1058 if( !u || !u->gc ) return; 1059 1059 1060 if( set_get int( &irc->set, "buddy_sendbuffer" ) && set_getint( &irc->set, "buddy_sendbuffer_delay" ) > 0 )1060 if( set_getbool( &irc->set, "buddy_sendbuffer" ) && set_getint( &irc->set, "buddy_sendbuffer_delay" ) > 0 ) 1061 1061 { 1062 1062 int delay; -
protocols/nogaim.c
r846cec61 rd5ccd83 208 208 209 209 if( ( g_strcasecmp( set_getstr( &gc->irc->set, "strip_html" ), "always" ) == 0 ) || 210 ( ( gc->flags & OPT_CONN_HTML ) && set_get int( &gc->irc->set, "strip_html" ) ) )210 ( ( gc->flags & OPT_CONN_HTML ) && set_getbool( &gc->irc->set, "strip_html" ) ) ) 211 211 strip_html( text ); 212 212 … … 353 353 irc_t *irc = gc->irc; 354 354 355 if( set_get int( &irc->set, "debug" ) && 0 ) /* This message is too useless */355 if( set_getbool( &irc->set, "debug" ) && 0 ) /* This message is too useless */ 356 356 serv_got_crap( gc, "Receiving user add from handle: %s", handle ); 357 357 358 358 if( user_findhandle( gc, handle ) ) 359 359 { 360 if( set_get int( &irc->set, "debug" ) )360 if( set_getbool( &irc->set, "debug" ) ) 361 361 serv_got_crap( gc, "User already exists, ignoring add request: %s", handle ); 362 362 … … 446 446 u->realname = g_strdup( realname ); 447 447 448 if( ( gc->flags & OPT_LOGGED_IN ) && set_get int( &gc->irc->set, "display_namechanges" ) )448 if( ( gc->flags & OPT_LOGGED_IN ) && set_getbool( &gc->irc->set, "display_namechanges" ) ) 449 449 serv_got_crap( gc, "User `%s' changed name to `%s'", u->nick, u->realname ); 450 450 } … … 509 509 else 510 510 { 511 if( set_get int( &gc->irc->set, "debug" ) || g_strcasecmp( set_getstr( &gc->irc->set, "handle_unknown" ), "ignore" ) != 0 )511 if( set_getbool( &gc->irc->set, "debug" ) || g_strcasecmp( set_getstr( &gc->irc->set, "handle_unknown" ), "ignore" ) != 0 ) 512 512 { 513 513 serv_got_crap( gc, "serv_got_update() for handle %s:", handle ); … … 568 568 569 569 /* LISPy... */ 570 if( ( set_get int( &gc->irc->set, "away_devoice" ) ) && /* Don't do a thing when user doesn't want it */570 if( ( set_getbool( &gc->irc->set, "away_devoice" ) ) && /* Don't do a thing when user doesn't want it */ 571 571 ( u->online ) && /* Don't touch offline people */ 572 572 ( ( ( u->online != oo ) && !u->away ) || /* Voice joining people */ … … 591 591 if( g_strcasecmp( h, "ignore" ) == 0 ) 592 592 { 593 if( set_get int( &irc->set, "debug" ) )593 if( set_getbool( &irc->set, "debug" ) ) 594 594 serv_got_crap( gc, "Ignoring message from unknown handle %s", handle ); 595 595 … … 598 598 else if( g_strncasecmp( h, "add", 3 ) == 0 ) 599 599 { 600 int private = set_get int( &irc->set, "private" );600 int private = set_getbool( &irc->set, "private" ); 601 601 602 602 if( h[3] ) … … 620 620 621 621 if( ( g_strcasecmp( set_getstr( &gc->irc->set, "strip_html" ), "always" ) == 0 ) || 622 ( ( gc->flags & OPT_CONN_HTML ) && set_get int( &gc->irc->set, "strip_html" ) ) )622 ( ( gc->flags & OPT_CONN_HTML ) && set_getbool( &gc->irc->set, "strip_html" ) ) ) 623 623 strip_html( msg ); 624 624 … … 660 660 user_t *u; 661 661 662 if( !set_get int( &gc->irc->set, "typing_notice" ) )662 if( !set_getbool( &gc->irc->set, "typing_notice" ) ) 663 663 return; 664 664 … … 682 682 GList *ir; 683 683 684 if( set_get int( &gc->irc->set, "debug" ) )684 if( set_getbool( &gc->irc->set, "debug" ) ) 685 685 serv_got_crap( gc, "You were removed from conversation %d", (int) id ); 686 686 … … 728 728 729 729 if( ( g_strcasecmp( set_getstr( &gc->irc->set, "strip_html" ), "always" ) == 0 ) || 730 ( ( gc->flags & OPT_CONN_HTML ) && set_get int( &gc->irc->set, "strip_html" ) ) )730 ( ( gc->flags & OPT_CONN_HTML ) && set_getbool( &gc->irc->set, "strip_html" ) ) ) 731 731 strip_html( msg ); 732 732 … … 761 761 g_free( s ); 762 762 763 if( set_get int( &gc->irc->set, "debug" ) )763 if( set_getbool( &gc->irc->set, "debug" ) ) 764 764 serv_got_crap( gc, "Creating new conversation: (id=%d,handle=%s)", id, handle ); 765 765 … … 775 775 int me = 0; 776 776 777 if( set_get int( &b->gc->irc->set, "debug" ) )777 if( set_getbool( &b->gc->irc->set, "debug" ) ) 778 778 serv_got_crap( b->gc, "User %s added to conversation %d", handle, b->id ); 779 779 … … 809 809 int me = 0; 810 810 811 if( set_get int( &b->gc->irc->set, "debug" ) )811 if( set_getbool( &b->gc->irc->set, "debug" ) ) 812 812 serv_got_crap( b->gc, "User %s removed from conversation %d (%s)", handle, b->id, reason ? reason : "" ); 813 813 … … 887 887 /* Horror.... */ 888 888 889 if( st != set_get int( &irc->set, "away_devoice" ) )889 if( st != set_getbool( &irc->set, "away_devoice" ) ) 890 890 { 891 891 char list[80] = ""; … … 1007 1007 { 1008 1008 gc->acc->prpl->set_away( gc, s, away ); 1009 if( set_get int( &gc->irc->set, "debug" ) )1009 if( set_getbool( &gc->irc->set, "debug" ) ) 1010 1010 serv_got_crap( gc, "Setting away state to %s", s ); 1011 1011 } -
protocols/oscar/oscar.c
r846cec61 rd5ccd83 1251 1251 channel = va_arg(ap, int); 1252 1252 userinfo = va_arg(ap, aim_userinfo_t *); 1253 1254 if (set_getint(sess->aux_data, "debug")) {1255 serv_got_crap(sess->aux_data, "channel %i called", channel);1256 }1257 1253 1258 1254 switch (channel) { -
protocols/oscar/rxhandlers.c
r846cec61 rd5ccd83 112 112 /* Following SNAC will be related */ 113 113 } 114 115 if (set_getint(sess->aux_data, "debug")) {116 serv_got_crap(sess->aux_data, "snac %x/%x received", snac.family, snac.subtype);117 }118 114 119 115 for (cur = (aim_module_t *)sess->modlistv; cur; cur = cur->next) { -
root_commands.c
r846cec61 rd5ccd83 144 144 irc_usermsg( irc, "Password accepted, settings and accounts loaded" ); 145 145 irc_umode_set( irc, "+R", 1 ); 146 if( set_get int( &irc->set, "auto_connect" ) )146 if( set_getbool( &irc->set, "auto_connect" ) ) 147 147 cmd_account( irc, account_on ); 148 148 break; -
set.h
r846cec61 rd5ccd83 24 24 */ 25 25 26 /* This used to be specific to irc_t structures, but it's more generic now 27 (so it can also be used for account_t structs). It's pretty simple, but 28 so far pretty useful. 29 30 In short, it just keeps a linked list of settings/variables and it also 31 remembers a default value for every setting. And to prevent the user 32 from setting invalid values, you can write an evaluator function for 33 every setting, which can check a new value and block it by returning 34 NULL, or replace it by returning a new value. See struct set.eval. */ 35 26 36 typedef struct set 27 37 { 28 void *data; 38 void *data; /* Here you can save a pointer to the 39 object this settings belongs to. */ 29 40 30 41 char *key; 31 42 char *value; 32 char *def; /* Default */ 43 char *def; /* Default value. If the set_setstr() function 44 notices a new value is exactly the same as 45 the default, value gets set to NULL. So when 46 you read a setting, don't forget about this! */ 33 47 34 int flags; 48 int flags; /* See account.h, for example. set.c doesn't use 49 this (yet?). */ 35 50 36 51 /* Eval: Returns NULL if the value is incorrect or exactly the … … 41 56 } set_t; 42 57 58 /* Should be pretty clear. */ 43 59 set_t *set_add( set_t **head, char *key, char *def, void *eval, void *data ); 60 61 /* Returns the raw set_t. Might be useful sometimes. */ 44 62 set_t *set_find( set_t **head, char *key ); 63 64 /* Returns a pointer to the string value of this setting. Don't modify the 65 returned string, and don't free() it! */ 45 66 G_MODULE_EXPORT char *set_getstr( set_t **head, char *key ); 67 68 /* Get an integer. Right now this also converts true/false/on/off/etc to 69 numbers, but this is for historical reasons, please use set_getbool() 70 for booleans instead. */ 46 71 G_MODULE_EXPORT int set_getint( set_t **head, char *key ); 47 72 G_MODULE_EXPORT int set_getbool( set_t **head, char *key ); 73 74 /* set_setstr() strdup()s the given value, so after using this function 75 you can free() it, if you want. */ 48 76 int set_setstr( set_t **head, char *key, char *value ); 49 77 int set_setint( set_t **head, char *key, int value ); 50 78 void set_del( set_t **head, char *key ); 51 79 80 /* Two very useful generic evaluators. */ 52 81 char *set_eval_int( set_t *set, char *value ); 53 82 char *set_eval_bool( set_t *set, char *value ); 54 83 84 /* Some not very generic evaluators that really shouldn't be here... */ 55 85 char *set_eval_to_char( set_t *set, char *value ); 56 86 char *set_eval_ops( set_t *set, char *value ); -
user.c
r846cec61 rd5ccd83 67 67 68 68 u->user = u->realname = u->host = u->nick = g_strdup( nick ); 69 u->is_private = set_get int( &irc->set, "private" );69 u->is_private = set_getbool( &irc->set, "private" ); 70 70 71 71 key = g_strdup( nick );
Note: See TracChangeset
for help on using the changeset viewer.