aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--irc.c12
-rw-r--r--protocols/bee.c18
2 files changed, 14 insertions, 16 deletions
diff --git a/irc.c b/irc.c
index a195adb4..93b41071 100644
--- a/irc.c
+++ b/irc.c
@@ -197,18 +197,19 @@ void irc_free( irc_t * irc )
{
log_message( LOGLVL_INFO, "Destroying connection with fd %d", irc->fd );
- /*
if( irc->status & USTATUS_IDENTIFIED && set_getbool( &irc->b->set, "save_on_quit" ) )
if( storage_save( irc, NULL, TRUE ) != STORAGE_OK )
- irc_usermsg( irc, "Error while saving settings!" );
- */
+ log_message( LOGLVL_WARNING, "Error while saving settings for user %s", irc->user->nick );
irc_connection_list = g_slist_remove( irc_connection_list, irc );
- /*
while( irc->queries != NULL )
query_del( irc, irc->queries );
- */
+
+ /* This is a little bit messy: bee_free() frees all b->users which
+ calls us back to free the corresponding irc->users. So do this
+ before we clear the remaining ones ourselves. */
+ bee_free( irc->b );
while( irc->users )
irc_user_free( irc, (irc_user_t *) irc->users->data );
@@ -239,7 +240,6 @@ void irc_free( irc_t * irc )
g_free( irc->sendbuffer );
g_free( irc->readbuffer );
-
g_free( irc->password );
g_free( irc );
diff --git a/protocols/bee.c b/protocols/bee.c
index 1aaa90f0..de9550c2 100644
--- a/protocols/bee.c
+++ b/protocols/bee.c
@@ -51,21 +51,19 @@ bee_t *bee_new()
void bee_free( bee_t *b )
{
- account_t *acc = b->accounts;
-
- while( acc )
+ while( b->accounts )
{
- if( acc->ic )
- imc_logout( acc->ic, FALSE );
- else if( acc->reconnect )
- cancel_auto_reconnect( acc );
+ if( b->accounts->ic )
+ imc_logout( b->accounts->ic, FALSE );
+ else if( b->accounts->reconnect )
+ cancel_auto_reconnect( b->accounts );
- if( acc->ic == NULL )
- account_del( b, acc );
+ if( b->accounts->ic == NULL )
+ account_del( b, b->accounts );
else
/* Nasty hack, but account_del() doesn't work in this
case and we don't want infinite loops, do we? ;-) */
- acc = acc->next;
+ b->accounts = b->accounts->next;
}
while( b->set )