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 | { |
---|
26 | account_t *acc = b->accounts; |
---|
27 | |
---|
28 | while( acc ) |
---|
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 ) |
---|
36 | account_del( b, acc ); |
---|
37 | else |
---|
38 | /* Nasty hack, but account_del() doesn't work in this |
---|
39 | case and we don't want infinite loops, do we? ;-) */ |
---|
40 | acc = acc->next; |
---|
41 | } |
---|
42 | |
---|
43 | while( b->set ) |
---|
44 | set_del( &b->set, b->set->key ); |
---|
45 | |
---|
46 | g_free( b ); |
---|
47 | } |
---|