[ebaebfe] | 1 | #include "bitlbee.h" |
---|
| 2 | |
---|
| 3 | bee_t *bee_new() |
---|
| 4 | { |
---|
| 5 | bee_t *b = g_new0( bee_t, 1 ); |
---|
| 6 | set_t *s; |
---|
| 7 | |
---|
| 8 | s = set_add( &b->set, "away", NULL, NULL/*set_eval_away_status*/, b ); |
---|
| 9 | s->flags |= SET_NULL_OK; |
---|
| 10 | s = set_add( &b->set, "auto_connect", "true", set_eval_bool, b ); |
---|
| 11 | s = set_add( &b->set, "auto_reconnect", "true", set_eval_bool, b ); |
---|
| 12 | s = set_add( &b->set, "auto_reconnect_delay", "5*3<900", NULL/*set_eval_account_reconnect_delay*/, b ); |
---|
| 13 | s = set_add( &b->set, "debug", "false", set_eval_bool, b ); |
---|
| 14 | s = set_add( &b->set, "password", NULL, NULL/*set_eval_password*/, b ); |
---|
| 15 | s->flags |= SET_NULL_OK; |
---|
| 16 | s = set_add( &b->set, "save_on_quit", "true", set_eval_bool, b ); |
---|
| 17 | s = set_add( &b->set, "status", NULL, NULL/*set_eval_away_status*/, b ); |
---|
| 18 | s->flags |= SET_NULL_OK; |
---|
| 19 | s = set_add( &b->set, "strip_html", "true", NULL, b ); |
---|
| 20 | |
---|
| 21 | return b; |
---|
| 22 | } |
---|
| 23 | |
---|
| 24 | void bee_free( bee_t *b ) |
---|
| 25 | { |
---|
[81e04e1] | 26 | account_t *acc = b->accounts; |
---|
| 27 | |
---|
| 28 | while( acc ) |
---|
[ebaebfe] | 29 | { |
---|
| 30 | if( acc->ic ) |
---|
| 31 | imc_logout( acc->ic, FALSE ); |
---|
| 32 | else if( acc->reconnect ) |
---|
| 33 | cancel_auto_reconnect( acc ); |
---|
| 34 | |
---|
| 35 | if( acc->ic == NULL ) |
---|
[81e04e1] | 36 | account_del( b, acc ); |
---|
[ebaebfe] | 37 | else |
---|
| 38 | /* Nasty hack, but account_del() doesn't work in this |
---|
| 39 | case and we don't want infinite loops, do we? ;-) */ |
---|
[81e04e1] | 40 | acc = acc->next; |
---|
[ebaebfe] | 41 | } |
---|
| 42 | |
---|
| 43 | while( b->set ) |
---|
| 44 | set_del( &b->set, b->set->key ); |
---|
[81e04e1] | 45 | |
---|
| 46 | g_free( b ); |
---|
[ebaebfe] | 47 | } |
---|