=== modified file 'protocols/account.c'
|
|
|
27 | 27 | #include "bitlbee.h" |
28 | 28 | #include "account.h" |
29 | 29 | |
| 30 | static const char* account_protocols_local[] = { |
| 31 | "gg", NULL |
| 32 | }; |
| 33 | |
30 | 34 | static char *set_eval_nick_source( set_t *set, char *value ); |
31 | 35 | |
32 | 36 | account_t *account_add( bee_t *bee, struct prpl *prpl, char *user, char *pass ) |
… |
… |
|
342 | 346 | |
343 | 347 | void account_on( bee_t *bee, account_t *a ) |
344 | 348 | { |
| 349 | GHashTableIter nicks; |
| 350 | gpointer k, v; |
| 351 | |
345 | 352 | if( a->ic ) |
346 | 353 | { |
347 | 354 | /* Trying to enable an already-enabled account */ |
… |
… |
|
355 | 362 | |
356 | 363 | if( a->ic && !( a->ic->flags & OPT_SLOW_LOGIN ) ) |
357 | 364 | a->ic->keepalive = b_timeout_add( 120000, account_on_timeout, a->ic ); |
| 365 | |
| 366 | if( a->flags & ACC_FLAG_LOCAL ) |
| 367 | { |
| 368 | g_hash_table_iter_init(&nicks, a->nicks); |
| 369 | while( g_hash_table_iter_next( &nicks, &k, &v ) ) |
| 370 | { |
| 371 | a->prpl->add_buddy( a->ic, (char*) k, NULL ); |
| 372 | } |
| 373 | } |
358 | 374 | } |
359 | 375 | |
360 | 376 | void account_off( bee_t *bee, account_t *a ) |
… |
… |
|
457 | 473 | |
458 | 474 | return a->auto_reconnect_delay; |
459 | 475 | } |
| 476 | |
| 477 | int protocol_account_islocal( const char* protocol ) |
| 478 | { |
| 479 | const char** p = account_protocols_local; |
| 480 | do { |
| 481 | if( strcmp( *p, protocol ) == 0 ) |
| 482 | return 1; |
| 483 | } while( *( ++p ) ); |
| 484 | return 0; |
| 485 | } |
=== modified file 'protocols/account.h'
|
|
|
58 | 58 | char *set_eval_account_reconnect_delay( set_t *set, char *value ); |
59 | 59 | int account_reconnect_delay( account_t *a ); |
60 | 60 | |
| 61 | int protocol_account_islocal( const char* protocol ); |
| 62 | |
61 | 63 | typedef enum |
62 | 64 | { |
63 | 65 | ACC_SET_NOSAVE = 0x01, /* Don't save this setting (i.e. stored elsewhere). */ |
… |
… |
|
69 | 71 | { |
70 | 72 | ACC_FLAG_AWAY_MESSAGE = 0x01, /* Supports away messages instead of just states. */ |
71 | 73 | ACC_FLAG_STATUS_MESSAGE = 0x02, /* Supports status messages (without being away). */ |
| 74 | ACC_FLAG_LOCAL = 0x04, /* Contact list is local. */ |
72 | 75 | } account_flag_t; |
73 | 76 | |
74 | 77 | #endif |
=== modified file 'storage_xml.c'
|
|
|
129 | 129 | char *protocol, *handle, *server, *password = NULL, *autoconnect, *tag; |
130 | 130 | char *pass_b64 = NULL; |
131 | 131 | unsigned char *pass_cr = NULL; |
132 | | int pass_len; |
| 132 | int pass_len, local = 0; |
133 | 133 | struct prpl *prpl = NULL; |
134 | 134 | |
135 | 135 | handle = xml_attr( attr_names, attr_values, "handle" ); |
… |
… |
|
139 | 139 | tag = xml_attr( attr_names, attr_values, "tag" ); |
140 | 140 | |
141 | 141 | protocol = xml_attr( attr_names, attr_values, "protocol" ); |
142 | | if( protocol ) |
143 | | prpl = find_protocol( protocol ); |
| 142 | if( protocol ) |
| 143 | { |
| 144 | prpl = find_protocol( protocol ); |
| 145 | local = protocol_account_islocal( protocol ); |
| 146 | } |
144 | 147 | |
145 | 148 | if( !handle || !pass_b64 || !protocol ) |
146 | 149 | g_set_error( error, G_MARKUP_ERROR, G_MARKUP_ERROR_INVALID_CONTENT, |
… |
… |
|
158 | 161 | set_setstr( &xd->current_account->set, "auto_connect", autoconnect ); |
159 | 162 | if( tag ) |
160 | 163 | set_setstr( &xd->current_account->set, "tag", tag ); |
| 164 | if( local ) |
| 165 | xd->current_account->flags |= ACC_FLAG_LOCAL; |
161 | 166 | } |
162 | 167 | else |
163 | 168 | { |