Changeset b74b287
- Timestamp:
- 2009-10-11T21:08:26Z (15 years ago)
- Branches:
- master
- Children:
- ec5e57d
- Parents:
- 0f7ee7e5
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/purple/purple.c
r0f7ee7e5 rb74b287 93 93 } 94 94 95 static void purple_sync_settings( account_t *acc, PurpleAccount *pa ) 96 { 97 PurplePlugin *prpl = purple_plugins_find_with_id( pa->protocol_id ); 98 PurplePluginProtocolInfo *pi = prpl->info->extra_info; 99 GList *i; 100 101 for( i = pi->protocol_options; i; i = i->next ) 102 { 103 PurpleAccountOption *o = i->data; 104 const char *name; 105 set_t *s; 106 107 name = purple_account_option_get_setting( o ); 108 s = set_find( &acc->set, name ); 109 if( s->value == NULL ) 110 continue; 111 112 switch( purple_account_option_get_type( o ) ) 113 { 114 case PURPLE_PREF_STRING: 115 purple_account_set_string( pa, name, set_getstr( &acc->set, name ) ); 116 break; 117 118 case PURPLE_PREF_INT: 119 purple_account_set_int( pa, name, set_getint( &acc->set, name ) ); 120 break; 121 122 case PURPLE_PREF_BOOLEAN: 123 purple_account_set_bool( pa, name, set_getbool( &acc->set, name ) ); 124 break; 125 126 default: 127 break; 128 } 129 } 130 } 131 95 132 static void purple_login( account_t *acc ) 96 133 { … … 103 140 purple_connections = g_slist_prepend( purple_connections, ic ); 104 141 105 pa = purple_account_new( acc->user, acc->prpl->name );142 ic->proto_data = pa = purple_account_new( acc->user, acc->prpl->name ); 106 143 purple_account_set_password( pa, acc->pass ); 107 108 ic->proto_data = pa; 144 purple_sync_settings( acc, pa ); 109 145 110 146 purple_account_set_enabled( pa, "BitlBee", TRUE ); … … 117 153 purple_account_set_enabled( pa, "BitlBee", FALSE ); 118 154 purple_connections = g_slist_remove( purple_connections, ic ); 119 purple_account _destroy( pa );155 purple_accounts_remove( pa ); 120 156 } 121 157 … … 194 230 195 231 if( ic != NULL ) 232 { 196 233 imc_logout( ic, TRUE ); 234 } 197 235 } 198 236 -
set.c
r0f7ee7e5 rb74b287 63 63 } 64 64 65 set_t *set_find( set_t **head, c har *key )65 set_t *set_find( set_t **head, const char *key ) 66 66 { 67 67 set_t *s = *head; … … 77 77 } 78 78 79 char *set_getstr( set_t **head, c har *key )79 char *set_getstr( set_t **head, const char *key ) 80 80 { 81 81 set_t *s = set_find( head, key ); … … 87 87 } 88 88 89 int set_getint( set_t **head, c har *key )89 int set_getint( set_t **head, const char *key ) 90 90 { 91 91 char *s = set_getstr( head, key ); … … 101 101 } 102 102 103 int set_getbool( set_t **head, c har *key )103 int set_getbool( set_t **head, const char *key ) 104 104 { 105 105 char *s = set_getstr( head, key ); … … 111 111 } 112 112 113 int set_setstr( set_t **head, c har *key, char *value )113 int set_setstr( set_t **head, const char *key, char *value ) 114 114 { 115 115 set_t *s = set_find( head, key ); … … 150 150 } 151 151 152 int set_setint( set_t **head, c har *key, int value )152 int set_setint( set_t **head, const char *key, int value ) 153 153 { 154 154 char s[24]; /* Not quite 128-bit clean eh? ;-) */ … … 158 158 } 159 159 160 void set_del( set_t **head, c har *key )160 void set_del( set_t **head, const char *key ) 161 161 { 162 162 set_t *s = *head, *t = NULL; … … 182 182 } 183 183 184 int set_reset( set_t **head, c har *key )184 int set_reset( set_t **head, const char *key ) 185 185 { 186 186 set_t *s; -
set.h
r0f7ee7e5 rb74b287 76 76 77 77 /* Returns the raw set_t. Might be useful sometimes. */ 78 set_t *set_find( set_t **head, c har *key );78 set_t *set_find( set_t **head, const char *key ); 79 79 80 80 /* Returns a pointer to the string value of this setting. Don't modify the 81 81 returned string, and don't free() it! */ 82 G_MODULE_EXPORT char *set_getstr( set_t **head, c har *key );82 G_MODULE_EXPORT char *set_getstr( set_t **head, const char *key ); 83 83 84 84 /* Get an integer. In previous versions set_getint() was also used to read 85 85 boolean values, but this SHOULD be done with set_getbool() now! */ 86 G_MODULE_EXPORT int set_getint( set_t **head, c har *key );87 G_MODULE_EXPORT int set_getbool( set_t **head, c har *key );86 G_MODULE_EXPORT int set_getint( set_t **head, const char *key ); 87 G_MODULE_EXPORT int set_getbool( set_t **head, const char *key ); 88 88 89 89 /* set_setstr() strdup()s the given value, so after using this function 90 90 you can free() it, if you want. */ 91 int set_setstr( set_t **head, c har *key, char *value );92 int set_setint( set_t **head, c har *key, int value );93 void set_del( set_t **head, c har *key );94 int set_reset( set_t **head, c har *key );91 int set_setstr( set_t **head, const char *key, char *value ); 92 int set_setint( set_t **head, const char *key, int value ); 93 void set_del( set_t **head, const char *key ); 94 int set_reset( set_t **head, const char *key ); 95 95 96 96 /* Two very useful generic evaluators. */
Note: See TracChangeset
for help on using the changeset viewer.