From e5d8d21fd20516be53f873d269b469be109eca91 Mon Sep 17 00:00:00 2001 From: Wilmer van der Gaast Date: Wed, 25 Nov 2009 00:45:27 +0000 Subject: Added in-memory help info, which I wanted to implement for ages already. Sadly the way I'm using it now doesn't work yet since nogaim_init() is called before help_init(). I'll fix that later. (Have to do that anyway to at least make ForkDaemon mode work..) --- help.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) (limited to 'help.c') diff --git a/help.c b/help.c index 587b9940..c43d0459 100644 --- a/help.c +++ b/help.c @@ -1,7 +1,7 @@ /********************************************************************\ * BitlBee -- An IRC to other IM-networks gateway * * * - * Copyright 2002-2005 Wilmer van der Gaast and others * + * Copyright 2002-2009 Wilmer van der Gaast and others * \********************************************************************/ /* Help file control */ @@ -168,3 +168,27 @@ char *help_get( help_t **help, char *title ) return NULL; } + +int help_add_mem( help_t **help, const char *title, const char *content ) +{ + help_t *h, *l = NULL; + + for( h = *help; h; h = h->next ) + { + if( g_strcasecmp( h->title, title ) == 0 ) + return 0; + + l = h; + } + + if( l ) + h = l->next = g_new0( struct help, 1 ); + else + *help = h = g_new0( struct help, 1 ); + h->fd = -1; + h->title = g_strdup( title ); + h->length = strlen( content ); + h->offset.mem_offset = g_strdup( content ); + + return 1; +} -- cgit v1.2.3