- Timestamp:
- 2009-12-07T21:54:19Z (14 years ago)
- Branches:
- master
- Children:
- 1c3008a
- Parents:
- aac4017 (diff), 36cf9fd (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
account.c
raac4017 r2288705 27 27 #include "bitlbee.h" 28 28 #include "account.h" 29 #include "chat.h" 29 30 30 31 account_t *account_add( irc_t *irc, struct prpl *prpl, char *user, char *pass ) … … 55 56 56 57 s = set_add( &a->set, "password", NULL, set_eval_account, a ); 57 s->flags |= ACC_SET_NOSAVE ;58 s->flags |= ACC_SET_NOSAVE | SET_NULL_OK; 58 59 59 60 s = set_add( &a->set, "username", NULL, set_eval_account, a ); … … 77 78 /* Double-check: We refuse to edit on-line accounts. */ 78 79 if( set->flags & ACC_SET_OFFLINE_ONLY && acc->ic ) 79 return NULL; 80 81 if( strcmp( set->key, "username" ) == 0 ) 80 return SET_INVALID; 81 82 if( strcmp( set->key, "server" ) == 0 ) 83 { 84 g_free( acc->server ); 85 if( value && *value ) 86 { 87 acc->server = g_strdup( value ); 88 return value; 89 } 90 else 91 { 92 acc->server = g_strdup( set->def ); 93 return g_strdup( set->def ); 94 } 95 } 96 else if( strcmp( set->key, "username" ) == 0 ) 82 97 { 83 98 g_free( acc->user ); … … 87 102 else if( strcmp( set->key, "password" ) == 0 ) 88 103 { 89 g_free( acc->pass ); 90 acc->pass = g_strdup( value ); 91 return NULL; /* password shouldn't be visible in plaintext! */ 92 } 93 else if( strcmp( set->key, "server" ) == 0 ) 94 { 95 g_free( acc->server ); 96 if( *value ) 97 { 98 acc->server = g_strdup( value ); 99 return value; 104 if( value ) 105 { 106 g_free( acc->pass ); 107 acc->pass = g_strdup( value ); 108 return NULL; /* password shouldn't be visible in plaintext! */ 100 109 } 101 110 else 102 111 { 103 acc->server = NULL; 104 return g_strdup( set->def ); 112 /* NULL can (should) be stored in the set_t 113 variable, but is otherwise not correct. */ 114 return SET_INVALID; 105 115 } 106 116 } … … 108 118 { 109 119 if( !is_bool( value ) ) 110 return NULL;120 return SET_INVALID; 111 121 112 122 acc->auto_connect = bool2int( value ); … … 114 124 } 115 125 116 return NULL;126 return SET_INVALID; 117 127 } 118 128 … … 181 191 { 182 192 account_t *a, *l = NULL; 193 struct chat *c, *nc; 183 194 184 195 if( acc->ic ) … … 193 204 else 194 205 irc->accounts = a->next; 206 207 for( c = irc->chatrooms; c; c = nc ) 208 { 209 nc = c->next; 210 if( acc == c->acc ) 211 chat_del( irc, c ); 212 } 195 213 196 214 while( a->set ) … … 254 272 255 273 /* Sure, call me evil for implementing my own fscanf here, but it's 256 dead simple and I 'm immediately at the next part to parse. */274 dead simple and I immediately know where to continue parsing. */ 257 275 258 276 if( *value == 0 ) … … 287 305 struct account_reconnect_delay p; 288 306 289 return account_reconnect_delay_parse( value, &p ) ? value : NULL;307 return account_reconnect_delay_parse( value, &p ) ? value : SET_INVALID; 290 308 } 291 309
Note: See TracChangeset
for help on using the changeset viewer.