Changeset 5c9512f
- Timestamp:
- 2006-06-30T09:17:18Z (18 years ago)
- Branches:
- master
- Children:
- 0a3c243
- Parents:
- 1719464
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
conf.c
r1719464 r5c9512f 323 323 if( g_strcasecmp( ini->section, "defaults" ) == 0 ) 324 324 { 325 set_t *s = set_find( irc, ini->key );325 set_t *s = set_find( &irc->set, ini->key ); 326 326 327 327 if( s ) -
irc.c
r1719464 r5c9512f 121 121 irc_connection_list = g_slist_append( irc_connection_list, irc ); 122 122 123 set_add( irc, "away_devoice", "true", set_eval_away_devoice);124 set_add( irc, "auto_connect", "true", set_eval_bool);125 set_add( irc, "auto_reconnect", "false", set_eval_bool);126 set_add( irc, "auto_reconnect_delay", "300", set_eval_int);127 set_add( irc, "buddy_sendbuffer", "false", set_eval_bool);128 set_add( irc, "buddy_sendbuffer_delay", "200", set_eval_int);129 set_add( irc, "charset", "iso8859-1", set_eval_charset);130 set_add( irc, "debug", "false", set_eval_bool);131 set_add( irc, "default_target", "root", NULL);132 set_add( irc, "display_namechanges", "false", set_eval_bool);133 set_add( irc, "handle_unknown", "root", NULL);134 set_add( irc, "lcnicks", "true", set_eval_bool);135 set_add( irc, "ops", "both", set_eval_ops);136 set_add( irc, "private", "true", set_eval_bool);137 set_add( irc, "query_order", "lifo", NULL);138 set_add( irc, "save_on_quit", "true", set_eval_bool);139 set_add( irc, "strip_html", "true", NULL);140 set_add( irc, "to_char", ": ", set_eval_to_char);141 set_add( irc, "typing_notice", "false", set_eval_bool);142 set_add( irc, "password", NULL, passchange);123 set_add( &irc->set, "away_devoice", "true", set_eval_away_devoice, irc ); 124 set_add( &irc->set, "auto_connect", "true", set_eval_bool, irc ); 125 set_add( &irc->set, "auto_reconnect", "false", set_eval_bool, irc ); 126 set_add( &irc->set, "auto_reconnect_delay", "300", set_eval_int, irc ); 127 set_add( &irc->set, "buddy_sendbuffer", "false", set_eval_bool, irc ); 128 set_add( &irc->set, "buddy_sendbuffer_delay", "200", set_eval_int, irc ); 129 set_add( &irc->set, "charset", "iso8859-1", set_eval_charset, irc ); 130 set_add( &irc->set, "debug", "false", set_eval_bool, irc ); 131 set_add( &irc->set, "default_target", "root", NULL, irc ); 132 set_add( &irc->set, "display_namechanges", "false", set_eval_bool, irc ); 133 set_add( &irc->set, "handle_unknown", "root", NULL, irc ); 134 set_add( &irc->set, "lcnicks", "true", set_eval_bool, irc ); 135 set_add( &irc->set, "ops", "both", set_eval_ops, irc ); 136 set_add( &irc->set, "password", NULL, passchange, irc ); 137 set_add( &irc->set, "private", "true", set_eval_bool, irc ); 138 set_add( &irc->set, "query_order", "lifo", NULL, irc ); 139 set_add( &irc->set, "save_on_quit", "true", set_eval_bool, irc ); 140 set_add( &irc->set, "strip_html", "true", NULL, irc ); 141 set_add( &irc->set, "to_char", ": ", set_eval_to_char, irc ); 142 set_add( &irc->set, "typing_notice", "false", set_eval_bool, irc ); 143 143 144 144 conf_loaddefaults( irc ); … … 212 212 log_message( LOGLVL_INFO, "Destroying connection with fd %d", irc->fd ); 213 213 214 if( irc->status & USTATUS_IDENTIFIED && set_getint( irc, "save_on_quit" ) )214 if( irc->status & USTATUS_IDENTIFIED && set_getint( &irc->set, "save_on_quit" ) ) 215 215 if( storage_save( irc, TRUE ) != STORAGE_OK ) 216 216 irc_usermsg( irc, "Error while saving settings!" ); … … 364 364 } 365 365 366 if( ( cs = set_getstr( irc, "charset" ) ) && ( g_strcasecmp( cs, "utf-8" ) != 0 ) )366 if( ( cs = set_getstr( &irc->set, "charset" ) ) && ( g_strcasecmp( cs, "utf-8" ) != 0 ) ) 367 367 { 368 368 conv[IRC_MAX_LINE] = 0; … … 584 584 585 585 strip_newlines( line ); 586 if( ( cs = set_getstr( irc, "charset" ) ) && ( g_strcasecmp( cs, "utf-8" ) != 0 ) )586 if( ( cs = set_getstr( &irc->set, "charset" ) ) && ( g_strcasecmp( cs, "utf-8" ) != 0 ) ) 587 587 { 588 588 char conv[IRC_MAX_LINE+1]; … … 666 666 if( u->gc && control ) 667 667 { 668 if( set_getint( irc, "away_devoice" ) && !u->away )668 if( set_getint( &irc->set, "away_devoice" ) && !u->away ) 669 669 s = "+"; 670 670 else … … 675 675 else if( !u->gc ) 676 676 { 677 if( strcmp( u->nick, irc->mynick ) == 0 && ( strcmp( set_getstr( irc, "ops" ), "root" ) == 0 || strcmp( set_getstr( irc, "ops" ), "both" ) == 0 ) )677 if( strcmp( u->nick, irc->mynick ) == 0 && ( strcmp( set_getstr( &irc->set, "ops" ), "root" ) == 0 || strcmp( set_getstr( &irc->set, "ops" ), "both" ) == 0 ) ) 678 678 s = "@"; 679 else if( strcmp( u->nick, irc->nick ) == 0 && ( strcmp( set_getstr( irc, "ops" ), "user" ) == 0 || strcmp( set_getstr( irc, "ops" ), "both" ) == 0 ) )679 else if( strcmp( u->nick, irc->nick ) == 0 && ( strcmp( set_getstr( &irc->set, "ops" ), "user" ) == 0 || strcmp( set_getstr( &irc->set, "ops" ), "both" ) == 0 ) ) 680 680 s = "@"; 681 681 else … … 1084 1084 if( !u || !u->gc ) return; 1085 1085 1086 if( set_getint( irc, "buddy_sendbuffer" ) && set_getint( irc, "buddy_sendbuffer_delay" ) > 0 )1086 if( set_getint( &irc->set, "buddy_sendbuffer" ) && set_getint( &irc->set, "buddy_sendbuffer_delay" ) > 0 ) 1087 1087 { 1088 1088 int delay; … … 1111 1111 strcat( u->sendbuf, "\n" ); 1112 1112 1113 delay = set_getint( irc, "buddy_sendbuffer_delay" );1113 delay = set_getint( &irc->set, "buddy_sendbuffer_delay" ); 1114 1114 if( delay <= 5 ) 1115 1115 delay *= 1000; … … 1176 1176 int len = strlen( irc->nick) + 3; 1177 1177 prefix = g_new (char, len ); 1178 g_snprintf( prefix, len, "%s%s", irc->nick, set_getstr( irc, "to_char" ) );1178 g_snprintf( prefix, len, "%s%s", irc->nick, set_getstr( &irc->set, "to_char" ) ); 1179 1179 prefix[len-1] = 0; 1180 1180 } -
irc_commands.c
r1719464 r5c9512f 230 230 { 231 231 unsigned int i; 232 char *t = set_getstr( irc, "default_target" );232 char *t = set_getstr( &irc->set, "default_target" ); 233 233 234 234 if( g_strcasecmp( t, "last" ) == 0 && irc->last_target ) -
nick.c
r1719464 r5c9512f 86 86 87 87 nick_strip( nick ); 88 if (set_getint(irc, "lcnicks"))88 if( set_getint( &irc->set, "lcnicks" ) ) 89 89 nick_lc( nick ); 90 90 } -
protocols/nogaim.c
r1719464 r5c9512f 220 220 va_end( params ); 221 221 222 if( ( g_strcasecmp( set_getstr( gc->irc, "strip_html" ), "always" ) == 0 ) ||223 ( ( gc->flags & OPT_CONN_HTML ) && set_getint( gc->irc, "strip_html" ) ) )222 if( ( g_strcasecmp( set_getstr( &gc->irc->set, "strip_html" ), "always" ) == 0 ) || 223 ( ( gc->flags & OPT_CONN_HTML ) && set_getint( &gc->irc->set, "strip_html" ) ) ) 224 224 strip_html( text ); 225 225 … … 324 324 /* Uhm... This is very sick. */ 325 325 } 326 else if( !gc->wants_to_die && set_getint( irc, "auto_reconnect" ) )327 { 328 int delay = set_getint( irc, "auto_reconnect_delay" );326 else if( !gc->wants_to_die && set_getint( &irc->set, "auto_reconnect" ) ) 327 { 328 int delay = set_getint( &irc->set, "auto_reconnect_delay" ); 329 329 330 330 serv_got_crap( gc, "Reconnecting in %d seconds..", delay ); … … 365 365 irc_t *irc = gc->irc; 366 366 367 if( set_getint( irc, "debug" ) && 0 ) /* This message is too useless */367 if( set_getint( &irc->set, "debug" ) && 0 ) /* This message is too useless */ 368 368 serv_got_crap( gc, "Receiving user add from handle: %s", handle ); 369 369 370 370 if( user_findhandle( gc, handle ) ) 371 371 { 372 if( set_getint( irc, "debug" ) )372 if( set_getint( &irc->set, "debug" ) ) 373 373 serv_got_crap( gc, "User already exists, ignoring add request: %s", handle ); 374 374 … … 458 458 u->realname = g_strdup( realname ); 459 459 460 if( ( gc->flags & OPT_LOGGED_IN ) && set_getint( gc->irc, "display_namechanges" ) )460 if( ( gc->flags & OPT_LOGGED_IN ) && set_getint( &gc->irc->set, "display_namechanges" ) ) 461 461 serv_got_crap( gc, "User `%s' changed name to `%s'", u->nick, u->realname ); 462 462 } … … 514 514 if( !u ) 515 515 { 516 if( g_strcasecmp( set_getstr( gc->irc, "handle_unknown" ), "add" ) == 0 )516 if( g_strcasecmp( set_getstr( &gc->irc->set, "handle_unknown" ), "add" ) == 0 ) 517 517 { 518 518 add_buddy( gc, NULL, handle, NULL ); … … 521 521 else 522 522 { 523 if( set_getint( gc->irc, "debug" ) || g_strcasecmp( set_getstr( gc->irc, "handle_unknown" ), "ignore" ) != 0 )523 if( set_getint( &gc->irc->set, "debug" ) || g_strcasecmp( set_getstr( &gc->irc->set, "handle_unknown" ), "ignore" ) != 0 ) 524 524 { 525 525 serv_got_crap( gc, "serv_got_update() for handle %s:", handle ); … … 580 580 581 581 /* LISPy... */ 582 if( ( set_getint( gc->irc, "away_devoice" ) ) && /* Don't do a thing when user doesn't want it */582 if( ( set_getint( &gc->irc->set, "away_devoice" ) ) && /* Don't do a thing when user doesn't want it */ 583 583 ( u->online ) && /* Don't touch offline people */ 584 584 ( ( ( u->online != oo ) && !u->away ) || /* Voice joining people */ … … 599 599 if( !u ) 600 600 { 601 char *h = set_getstr( irc, "handle_unknown" );601 char *h = set_getstr( &irc->set, "handle_unknown" ); 602 602 603 603 if( g_strcasecmp( h, "ignore" ) == 0 ) 604 604 { 605 if( set_getint( irc, "debug" ) )605 if( set_getint( &irc->set, "debug" ) ) 606 606 serv_got_crap( gc, "Ignoring message from unknown handle %s", handle ); 607 607 … … 610 610 else if( g_strncasecmp( h, "add", 3 ) == 0 ) 611 611 { 612 int private = set_getint( irc, "private" );612 int private = set_getint( &irc->set, "private" ); 613 613 614 614 if( h[3] ) … … 631 631 } 632 632 633 if( ( g_strcasecmp( set_getstr( gc->irc, "strip_html" ), "always" ) == 0 ) ||634 ( ( gc->flags & OPT_CONN_HTML ) && set_getint( gc->irc, "strip_html" ) ) )633 if( ( g_strcasecmp( set_getstr( &gc->irc->set, "strip_html" ), "always" ) == 0 ) || 634 ( ( gc->flags & OPT_CONN_HTML ) && set_getint( &gc->irc->set, "strip_html" ) ) ) 635 635 strip_html( msg ); 636 636 … … 672 672 user_t *u; 673 673 674 if( !set_getint( gc->irc, "typing_notice" ) )674 if( !set_getint( &gc->irc->set, "typing_notice" ) ) 675 675 return; 676 676 … … 694 694 GList *ir; 695 695 696 if( set_getint( gc->irc, "debug" ) )696 if( set_getint( &gc->irc->set, "debug" ) ) 697 697 serv_got_crap( gc, "You were removed from conversation %d", (int) id ); 698 698 … … 739 739 for( c = gc->conversations; c && c->id != id; c = c->next ); 740 740 741 if( ( g_strcasecmp( set_getstr( gc->irc, "strip_html" ), "always" ) == 0 ) ||742 ( ( gc->flags & OPT_CONN_HTML ) && set_getint( gc->irc, "strip_html" ) ) )741 if( ( g_strcasecmp( set_getstr( &gc->irc->set, "strip_html" ), "always" ) == 0 ) || 742 ( ( gc->flags & OPT_CONN_HTML ) && set_getint( &gc->irc->set, "strip_html" ) ) ) 743 743 strip_html( msg ); 744 744 … … 773 773 g_free( s ); 774 774 775 if( set_getint( gc->irc, "debug" ) )775 if( set_getint( &gc->irc->set, "debug" ) ) 776 776 serv_got_crap( gc, "Creating new conversation: (id=%d,handle=%s)", id, handle ); 777 777 … … 787 787 int me = 0; 788 788 789 if( set_getint( b->gc->irc, "debug" ) )789 if( set_getint( &b->gc->irc->set, "debug" ) ) 790 790 serv_got_crap( b->gc, "User %s added to conversation %d", handle, b->id ); 791 791 … … 821 821 int me = 0; 822 822 823 if( set_getint( b->gc->irc, "debug" ) )823 if( set_getint( &b->gc->irc->set, "debug" ) ) 824 824 serv_got_crap( b->gc, "User %s removed from conversation %d (%s)", handle, b->id, reason ? reason : "" ); 825 825 … … 883 883 } 884 884 885 char *set_eval_away_devoice( irc_t *irc, set_t *set, char *value ) 886 { 885 char *set_eval_away_devoice( set_t *set, char *value ) 886 { 887 irc_t *irc = set->data; 887 888 int st; 888 889 … … 898 899 /* Horror.... */ 899 900 900 if( st != set_getint( irc, "away_devoice" ) )901 if( st != set_getint( &irc->set, "away_devoice" ) ) 901 902 { 902 903 char list[80] = ""; … … 938 939 } 939 940 940 return( set_eval_bool( irc,set, value ) );941 return( set_eval_bool( set, value ) ); 941 942 } 942 943 … … 1018 1019 { 1019 1020 gc->prpl->set_away( gc, s, away ); 1020 if( set_getint( gc->irc, "debug" ) )1021 if( set_getint( &gc->irc->set, "debug" ) ) 1021 1022 serv_got_crap( gc, "Setting away state to %s", s ); 1022 1023 } -
protocols/nogaim.h
r1719464 r5c9512f 206 206 207 207 void nogaim_init(); 208 char *set_eval_away_devoice( irc_t *irc,set_t *set, char *value );208 char *set_eval_away_devoice( set_t *set, char *value ); 209 209 210 210 gboolean auto_reconnect( gpointer data, gint fd, b_input_condition cond ); -
query.c
r1719464 r5c9512f 63 63 } 64 64 65 if( g_strcasecmp( set_getstr( irc, "query_order" ), "lifo" ) == 0 || irc->queries == q )65 if( g_strcasecmp( set_getstr( &irc->set, "query_order" ), "lifo" ) == 0 || irc->queries == q ) 66 66 query_display( irc, q ); 67 67 … … 172 172 query_t *q; 173 173 174 if( g_strcasecmp( set_getstr( irc, "query_order" ), "fifo" ) == 0 )174 if( g_strcasecmp( set_getstr( &irc->set, "query_order" ), "fifo" ) == 0 ) 175 175 q = irc->queries; 176 176 else -
root_commands.c
r1719464 r5c9512f 144 144 irc_usermsg( irc, "Password accepted, settings and accounts loaded" ); 145 145 irc_umode_set( irc, "+R", 1 ); 146 if( set_getint( irc, "auto_connect" ) )146 if( set_getint( &irc->set, "auto_connect" ) ) 147 147 cmd_account( irc, account_on ); 148 148 break; … … 672 672 if( cmd[1] && cmd[2] ) 673 673 { 674 set_setstr( irc, cmd[1], cmd[2] );674 set_setstr( &irc->set, cmd[1], cmd[2] ); 675 675 676 676 if( ( strcmp( cmd[2], "=" ) ) == 0 && cmd[3] ) … … 679 679 if( cmd[1] ) /* else 'forgotten' on purpose.. Must show new value after changing */ 680 680 { 681 char *s = set_getstr( irc, cmd[1] );681 char *s = set_getstr( &irc->set, cmd[1] ); 682 682 if( s ) 683 683 irc_usermsg( irc, "%s = `%s'", cmd[1], s ); -
set.c
r1719464 r5c9512f 26 26 #include "bitlbee.h" 27 27 28 set_t *set_add( irc_t *irc, char *key, char *def, void *eval ) 29 { 30 set_t *s = set_find( irc, key ); 31 28 set_t *set_add( set_t **head, char *key, char *def, void *eval, void *data ) 29 { 30 set_t *s = set_find( head, key ); 31 32 /* Possibly the setting already exists. If it doesn't exist yet, 33 we create it. If it does, we'll just change the default. */ 32 34 if( !s ) 33 35 { 34 if( ( s = irc->set) )36 if( ( s = *head ) ) 35 37 { 36 38 while( s->next ) s = s->next; 37 s->next = g_new 39 s->next = g_new0( set_t, 1 ); 38 40 s = s->next; 39 41 } 40 42 else 41 43 { 42 s = irc->set = g_new( set_t, 1 );44 s = *head = g_new0( set_t, 1 ); 43 45 } 44 memset( s, 0, sizeof( set_t ) );45 46 s->key = g_strdup( key ); 46 47 } … … 53 54 if( def ) s->def = g_strdup( def ); 54 55 55 if( s->eval ) 56 { 57 g_free( s->eval ); 58 s->eval = NULL; 59 } 60 if( eval ) s->eval = eval; 61 62 return( s ); 63 } 64 65 set_t *set_find( irc_t *irc, char *key ) 66 { 67 set_t *s = irc->set; 56 s->eval = eval; 57 s->data = data; 58 59 return s; 60 } 61 62 set_t *set_find( set_t **head, char *key ) 63 { 64 set_t *s = *head; 68 65 69 66 while( s ) … … 74 71 } 75 72 76 return ( s );77 } 78 79 char *set_getstr( irc_t *irc, char *key )80 { 81 set_t *s = set_find( irc, key );73 return s; 74 } 75 76 char *set_getstr( set_t **head, char *key ) 77 { 78 set_t *s = set_find( head, key ); 82 79 83 80 if( !s || ( !s->value && !s->def ) ) 84 return ( NULL );85 86 return ( s->value?s->value:s->def );87 } 88 89 int set_getint( irc_t *irc, char *key )90 { 91 char *s = set_getstr( irc, key );81 return NULL; 82 83 return s->value ? s->value : s->def; 84 } 85 86 int set_getint( set_t **head, char *key ) 87 { 88 char *s = set_getstr( head, key ); 92 89 int i = 0; 93 90 94 91 if( !s ) 95 return ( 0 );92 return 0; 96 93 97 94 if( ( g_strcasecmp( s, "true" ) == 0 ) || ( g_strcasecmp( s, "yes" ) == 0 ) || ( g_strcasecmp( s, "on" ) == 0 ) ) 98 return ( 1 );95 return 1; 99 96 100 97 if( sscanf( s, "%d", &i ) != 1 ) 101 return ( 0 );102 103 return ( i );104 } 105 106 int set_setstr( irc_t *irc, char *key, char *value )107 { 108 set_t *s = set_find( irc, key );98 return 0; 99 100 return i; 101 } 102 103 int set_setstr( set_t **head, char *key, char *value ) 104 { 105 set_t *s = set_find( head, key ); 109 106 char *nv = value; 110 107 111 108 if( !s ) 112 s = set_add( irc, key, NULL, NULL );113 114 if( s->eval && !( nv = s->eval( irc,s, value ) ) )115 return ( 0 );109 s = set_add( head, key, NULL, NULL, NULL ); 110 111 if( s->eval && !( nv = s->eval( s, value ) ) ) 112 return 0; 116 113 117 114 if( s->value ) … … 121 118 } 122 119 120 /* If there's a default setting and it's equal to what we're trying to 121 set, stick with s->value = NULL. Otherwise, remember the setting. */ 123 122 if( !s->def || ( strcmp( nv, s->def ) != 0 ) ) 124 123 s->value = g_strdup( nv ); … … 127 126 g_free( nv ); 128 127 129 return ( 1 );130 } 131 132 int set_setint( irc_t *irc, char *key, int value )128 return 1; 129 } 130 131 int set_setint( set_t **head, char *key, int value ) 133 132 { 134 133 char s[24]; /* Not quite 128-bit clean eh? ;-) */ 135 134 136 sprintf( s, "%d", value );137 return ( set_setstr( irc, key, s ));138 } 139 140 void set_del( irc_t *irc, char *key )141 { 142 set_t *s = irc->set, *t = NULL;135 g_snprintf( s, sizeof( s ), "%d", value ); 136 return set_setstr( head, key, s ); 137 } 138 139 void set_del( set_t **head, char *key ) 140 { 141 set_t *s = *head, *t = NULL; 143 142 144 143 while( s ) … … 153 152 t->next = s->next; 154 153 else 155 irc->set= s->next;154 *head = s->next; 156 155 157 156 g_free( s->key ); … … 162 161 } 163 162 164 char *set_eval_int( irc_t *irc,set_t *set, char *value )165 { 166 char *s = value;167 168 for( ; *s; s ++ )163 char *set_eval_int( set_t *set, char *value ) 164 { 165 char *s; 166 167 for( s = value; *s; s ++ ) 169 168 if( *s < '0' || *s > '9' ) 170 return ( NULL );171 172 return ( value );173 } 174 175 char *set_eval_bool( irc_t *irc,set_t *set, char *value )169 return NULL; 170 171 return value; 172 } 173 174 char *set_eval_bool( set_t *set, char *value ) 176 175 { 177 176 if( ( g_strcasecmp( value, "true" ) == 0 ) || ( g_strcasecmp( value, "yes" ) == 0 ) || ( g_strcasecmp( value, "on" ) == 0 ) ) … … 179 178 if( ( g_strcasecmp( value, "false" ) == 0 ) || ( g_strcasecmp( value, "no" ) == 0 ) || ( g_strcasecmp( value, "off" ) == 0 ) ) 180 179 return( value ); 181 return( set_eval_int( irc,set, value ) );182 } 183 184 char *set_eval_to_char( irc_t *irc,set_t *set, char *value )180 return( set_eval_int( set, value ) ); 181 } 182 183 char *set_eval_to_char( set_t *set, char *value ) 185 184 { 186 185 char *s = g_new( char, 3 ); … … 191 190 sprintf( s, "%c ", *value ); 192 191 193 return( s ); 194 } 195 196 char *set_eval_ops( irc_t *irc, set_t *set, char *value ) 197 { 192 return s; 193 } 194 195 char *set_eval_ops( set_t *set, char *value ) 196 { 197 irc_t *irc = set->data; 198 198 199 if( g_strcasecmp( value, "user" ) == 0 ) 199 {200 200 irc_write( irc, ":%s!%s@%s MODE %s %s %s %s", irc->mynick, irc->mynick, irc->myhost, 201 201 irc->channel, "+o-o", irc->nick, irc->mynick ); 202 return( value );203 }204 202 else if( g_strcasecmp( value, "root" ) == 0 ) 205 {206 203 irc_write( irc, ":%s!%s@%s MODE %s %s %s %s", irc->mynick, irc->mynick, irc->myhost, 207 204 irc->channel, "-o+o", irc->nick, irc->mynick ); 208 return( value );209 }210 205 else if( g_strcasecmp( value, "both" ) == 0 ) 211 {212 206 irc_write( irc, ":%s!%s@%s MODE %s %s %s %s", irc->mynick, irc->mynick, irc->myhost, 213 207 irc->channel, "+oo", irc->nick, irc->mynick ); 214 return( value );215 }216 208 else if( g_strcasecmp( value, "none" ) == 0 ) 217 {218 209 irc_write( irc, ":%s!%s@%s MODE %s %s %s %s", irc->mynick, irc->mynick, irc->myhost, 219 210 irc->channel, "-oo", irc->nick, irc->mynick ); 220 return( value );221 }222 223 return ( NULL );224 } 225 226 char *set_eval_charset( irc_t *irc,set_t *set, char *value )211 else 212 return NULL; 213 214 return value; 215 } 216 217 char *set_eval_charset( set_t *set, char *value ) 227 218 { 228 219 GIConv cd; 229 220 230 221 if ( g_strncasecmp( value, "none", 4 ) == 0 ) 231 return ( value );222 return value; 232 223 233 224 cd = g_iconv_open( "UTF-8", value ); 234 225 if( cd == (GIConv) -1 ) 235 return ( NULL );226 return NULL; 236 227 237 228 g_iconv_close( cd ); 238 return ( value );239 } 229 return value; 230 } -
set.h
r1719464 r5c9512f 2 2 * BitlBee -- An IRC to other IM-networks gateway * 3 3 * * 4 * Copyright 2002-200 4Wilmer van der Gaast and others *4 * Copyright 2002-2006 Wilmer van der Gaast and others * 5 5 \********************************************************************/ 6 6 … … 26 26 typedef struct set 27 27 { 28 void *data; 29 28 30 char *key; 29 31 char *value; 30 32 char *def; /* Default */ 31 33 32 /* Eval: Returns NULL if the value is incorrect . Can return a33 corrected value. set_setstr() should be able to free() the34 returned string! */35 char *(*eval) ( irc_t *irc,struct set *set, char *value );34 /* Eval: Returns NULL if the value is incorrect or exactly the 35 passed value variable. When returning a corrected value, 36 set_setstr() should be able to free() the returned string! */ 37 char *(*eval) ( struct set *set, char *value ); 36 38 struct set *next; 37 39 } set_t; 38 40 39 set_t *set_add( irc_t *irc, char *key, char *def, void *eval);40 G_MODULE_EXPORT set_t *set_find( irc_t *irc, char *key );41 G_MODULE_EXPORT char *set_getstr( irc_t *irc, char *key );42 G_MODULE_EXPORT int set_getint( irc_t *irc, char *key );43 int set_setstr( irc_t *irc, char *key, char *value );44 int set_setint( irc_t *irc, char *key, int value );45 void set_del( irc_t *irc, char *key );41 set_t *set_add( set_t **head, char *key, char *def, void *eval, void *data ); 42 G_MODULE_EXPORT set_t *set_find( set_t **head, char *key ); 43 G_MODULE_EXPORT char *set_getstr( set_t **head, char *key ); 44 G_MODULE_EXPORT int set_getint( set_t **head, char *key ); 45 int set_setstr( set_t **head, char *key, char *value ); 46 int set_setint( set_t **head, char *key, int value ); 47 void set_del( set_t **head, char *key ); 46 48 47 char *set_eval_int( irc_t *irc,set_t *set, char *value );48 char *set_eval_bool( irc_t *irc,set_t *set, char *value );49 char *set_eval_int( set_t *set, char *value ); 50 char *set_eval_bool( set_t *set, char *value ); 49 51 50 char *set_eval_to_char( irc_t *irc,set_t *set, char *value );51 char *set_eval_ops( irc_t *irc,set_t *set, char *value );52 char *set_eval_charset( irc_t *irc,set_t *set, char *value );52 char *set_eval_to_char( set_t *set, char *value ); 53 char *set_eval_ops( set_t *set, char *value ); 54 char *set_eval_charset( set_t *set, char *value ); -
storage_xml.c
r1719464 r5c9512f 246 246 xd->current_setting && xd->current_account == NULL ) 247 247 { 248 set_setstr( irc, xd->current_setting, (char*) text );248 set_setstr( &irc->set, xd->current_setting, (char*) text ); 249 249 g_free( xd->current_setting ); 250 250 xd->current_setting = NULL; … … 421 421 pass_len = rc4_encode( (unsigned char*) acc->pass, strlen( acc->pass ), (unsigned char**) &pass_rc4, irc->password ); 422 422 pass_b64 = base64_encode( pass_rc4, pass_len ); 423 g_free( pass_rc4 ); 423 424 424 425 if( !xml_printf( fd, "\t<account protocol=\"%s\" handle=\"%s\" password=\"%s\" autoconnect=\"%d\"", acc->prpl->name, acc->user, pass_b64, acc->auto_connect ) ) 425 426 { 426 g_free( pass_rc4 );427 427 g_free( pass_b64 ); 428 428 goto write_error; 429 429 } 430 g_free( pass_rc4 );431 430 g_free( pass_b64 ); 432 431 -
user.c
r1719464 r5c9512f 67 67 68 68 u->user = u->realname = u->host = u->nick = g_strdup( nick ); 69 u->is_private = set_getint( irc, "private" );69 u->is_private = set_getint( &irc->set, "private" ); 70 70 71 71 key = g_strdup( nick );
Note: See TracChangeset
for help on using the changeset viewer.