aboutsummaryrefslogtreecommitdiffstats
path: root/query.c
diff options
context:
space:
mode:
authorWilmer van der Gaast <wilmer@gaast.net>2010-07-24 23:16:18 +0200
committerWilmer van der Gaast <wilmer@gaast.net>2010-07-24 23:16:18 +0200
commit2945c6ff5d1848f6d8e51a0d804a2d769e6894a7 (patch)
tree595788105189dab5270fe2b7dc4e9baffa487aed /query.c
parentef14a83adbb9036c0006ad460c5e11882a3d7e13 (diff)
parent593971d9ff9f246cec5af5583f29e45fee62edfe (diff)
Merge ui-fix (which includes killerbee (i.e. file transfers and libpurple
support)). ui-fix rewrites the complete IRC core, fixing many things that were broken/hacky/limited so far. The list is too long to include here, but http://wiki.bitlbee.org/UiFix has a summary, as does doc/CHANGES and of course the full revision history.
Diffstat (limited to 'query.c')
-rw-r--r--query.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/query.c b/query.c
index e8f69572..67382b79 100644
--- a/query.c
+++ b/query.c
@@ -30,7 +30,8 @@ static void query_display( irc_t *irc, query_t *q );
static query_t *query_default( irc_t *irc );
query_t *query_add( irc_t *irc, struct im_connection *ic, char *question,
- query_callback yes, query_callback no, void *data )
+ query_callback yes, query_callback no, query_callback free,
+ void *data )
{
query_t *q = g_new0( query_t, 1 );
@@ -38,6 +39,7 @@ query_t *query_add( irc_t *irc, struct im_connection *ic, char *question,
q->question = g_strdup( question );
q->yes = yes;
q->no = no;
+ q->free = free;
q->data = data;
if( strchr( irc->umode, 'b' ) != NULL )
@@ -63,7 +65,7 @@ query_t *query_add( irc_t *irc, struct im_connection *ic, char *question,
irc->queries = q;
}
- if( g_strcasecmp( set_getstr( &irc->set, "query_order" ), "lifo" ) == 0 || irc->queries == q )
+ if( g_strcasecmp( set_getstr( &irc->b->set, "query_order" ), "lifo" ) == 0 || irc->queries == q )
query_display( irc, q );
return( q );
@@ -93,7 +95,8 @@ void query_del( irc_t *irc, query_t *q )
}
g_free( q->question );
- if( q->data ) g_free( q->data ); /* Memory leak... */
+ if( q->free && q->data )
+ q->free( q->data );
g_free( q );
}
@@ -178,7 +181,7 @@ static query_t *query_default( irc_t *irc )
{
query_t *q;
- if( g_strcasecmp( set_getstr( &irc->set, "query_order" ), "fifo" ) == 0 )
+ if( g_strcasecmp( set_getstr( &irc->b->set, "query_order" ), "fifo" ) == 0 )
q = irc->queries;
else
for( q = irc->queries; q && q->next; q = q->next );