diff options
author | Wilmer van der Gaast <wilmer@gaast.net> | 2008-08-31 15:54:39 +0100 |
---|---|---|
committer | Wilmer van der Gaast <wilmer@gaast.net> | 2008-08-31 15:54:39 +0100 |
commit | d995c9b5de1bff5e3eb5de47b7ffbd3e92e2ac3d (patch) | |
tree | 8c630131f1851da9fbf3d20fffb771f13b8c2848 /chat.c | |
parent | 39f93f0ce1c0a179b51f5ff6474d57509e9e0d17 (diff) |
Added cleanup code.
Diffstat (limited to 'chat.c')
-rw-r--r-- | chat.c | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -125,6 +125,31 @@ struct chat *chat_get( irc_t *irc, char *id ) return ret; } +int chat_del( irc_t *irc, struct chat *chat ) +{ + struct chat *c, *l = NULL; + + for( c = irc->chatrooms; c; c = (l=c)->next ) + if( c == chat ) + break; + + if( c == NULL ) + return 0; + else if( l == NULL ) + irc->chatrooms = c->next; + else + l->next = c->next; + + while( c->set ) + set_del( &c->set, c->set->key ); + + g_free( c->handle ); + g_free( c->channel ); + g_free( c ); + + return 1; +} + int chat_chancmp( char *a, char *b ) { if( !chat_chanok( a ) || !chat_chanok( b ) ) |