Changeset 5ebff60 for protocols/bee.c
- Timestamp:
- 2015-02-20T22:50:54Z (6 years ago)
- Branches:
- master
- Children:
- 0b9daac, 3d45471, 7733b8c
- Parents:
- af359b4
- git-author:
- Indent <please@…> (19-02-15 05:47:20)
- git-committer:
- dequis <dx@…> (20-02-15 22:50:54)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
protocols/bee.c
raf359b4 r5ebff60 1 1 /********************************************************************\ 2 2 * BitlBee -- An IRC to other IM-networks gateway * 3 3 * * … … 27 27 #include "bitlbee.h" 28 28 29 static char *set_eval_away_status( set_t *set, char *value);29 static char *set_eval_away_status(set_t *set, char *value); 30 30 31 31 bee_t *bee_new() 32 32 { 33 bee_t *b = g_new0( bee_t, 1);33 bee_t *b = g_new0(bee_t, 1); 34 34 set_t *s; 35 36 s = set_add( &b->set, "auto_connect", "true", set_eval_bool, b);37 s = set_add( &b->set, "auto_reconnect", "true", set_eval_bool, b);38 s = set_add( &b->set, "auto_reconnect_delay", "5*3<900", set_eval_account_reconnect_delay, b);39 s = set_add( &b->set, "away", NULL, set_eval_away_status, b);35 36 s = set_add(&b->set, "auto_connect", "true", set_eval_bool, b); 37 s = set_add(&b->set, "auto_reconnect", "true", set_eval_bool, b); 38 s = set_add(&b->set, "auto_reconnect_delay", "5*3<900", set_eval_account_reconnect_delay, b); 39 s = set_add(&b->set, "away", NULL, set_eval_away_status, b); 40 40 s->flags |= SET_NULL_OK | SET_HIDDEN; 41 s = set_add( &b->set, "debug", "false", set_eval_bool, b);42 s = set_add( &b->set, "mobile_is_away", "false", set_eval_bool, b);43 s = set_add( &b->set, "save_on_quit", "true", set_eval_bool, b);44 s = set_add( &b->set, "status", NULL, set_eval_away_status, b);41 s = set_add(&b->set, "debug", "false", set_eval_bool, b); 42 s = set_add(&b->set, "mobile_is_away", "false", set_eval_bool, b); 43 s = set_add(&b->set, "save_on_quit", "true", set_eval_bool, b); 44 s = set_add(&b->set, "status", NULL, set_eval_away_status, b); 45 45 s->flags |= SET_NULL_OK; 46 s = set_add( &b->set, "strip_html", "true", NULL, b);47 48 b->user = g_malloc( 1);49 46 s = set_add(&b->set, "strip_html", "true", NULL, b); 47 48 b->user = g_malloc(1); 49 50 50 return b; 51 51 } 52 52 53 void bee_free( bee_t *b)53 void bee_free(bee_t *b) 54 54 { 55 while ( b->accounts )56 {57 if( b->accounts->ic )58 imc_logout( b->accounts->ic, FALSE );59 else if( b->accounts->reconnect )60 cancel_auto_reconnect( b->accounts );61 62 if ( b->accounts->ic == NULL )63 account_del( b, b->accounts);64 else55 while (b->accounts) { 56 if (b->accounts->ic) { 57 imc_logout(b->accounts->ic, FALSE); 58 } else if (b->accounts->reconnect) { 59 cancel_auto_reconnect(b->accounts); 60 } 61 62 if (b->accounts->ic == NULL) { 63 account_del(b, b->accounts); 64 } else { 65 65 /* Nasty hack, but account_del() doesn't work in this 66 66 case and we don't want infinite loops, do we? ;-) */ 67 67 b->accounts = b->accounts->next; 68 } 68 69 } 69 70 while( b->set ) 71 set_del( &b->set, b->set->key ); 72 73 bee_group_free( b ); 74 75 g_free( b->user ); 76 g_free( b ); 70 71 while (b->set) { 72 set_del(&b->set, b->set->key); 73 } 74 75 bee_group_free(b); 76 77 g_free(b->user); 78 g_free(b); 77 79 } 78 80 79 static char *set_eval_away_status( set_t *set, char *value)81 static char *set_eval_away_status(set_t *set, char *value) 80 82 { 81 83 bee_t *bee = set->data; 82 84 account_t *a; 83 84 g_free( set->value ); 85 set->value = g_strdup( value ); 86 87 for( a = bee->accounts; a; a = a->next ) 88 { 85 86 g_free(set->value); 87 set->value = g_strdup(value); 88 89 for (a = bee->accounts; a; a = a->next) { 89 90 struct im_connection *ic = a->ic; 90 91 if( ic && ic->flags & OPT_LOGGED_IN ) 92 imc_away_send_update( ic ); 91 92 if (ic && ic->flags & OPT_LOGGED_IN) { 93 imc_away_send_update(ic); 94 } 93 95 } 94 96 95 97 return value; 96 98 }
Note: See TracChangeset
for help on using the changeset viewer.