aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--help.c26
-rw-r--r--help.h1
-rw-r--r--protocols/purple/purple.c11
3 files changed, 37 insertions, 1 deletions
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;
+}
diff --git a/help.h b/help.h
index 5421220c..e689a93d 100644
--- a/help.h
+++ b/help.h
@@ -45,5 +45,6 @@ typedef struct help
G_GNUC_MALLOC help_t *help_init( help_t **help, const char *helpfile );
void help_free( help_t **help );
char *help_get( help_t **help, char *title );
+int help_add_mem( help_t **help, const char *title, const char *content_ );
#endif
diff --git a/protocols/purple/purple.c b/protocols/purple/purple.c
index 33b19a67..50770187 100644
--- a/protocols/purple/purple.c
+++ b/protocols/purple/purple.c
@@ -22,6 +22,7 @@
\***************************************************************************/
#include "bitlbee.h"
+#include "help.h"
#include <stdarg.h>
@@ -474,6 +475,8 @@ static void *prplcb_request_action( const char *title, const char *primary, cons
prplcb_request_action_yes, prplcb_request_action_no, pqad );
g_free( q );
+
+ return pqad;
}
static PurpleRequestUiOps bee_request_uiops =
@@ -534,6 +537,7 @@ void purple_initmodule()
{
struct prpl funcs;
GList *prots;
+ GString *help;
if( B_EV_IO_READ != PURPLE_INPUT_READ ||
B_EV_IO_WRITE != PURPLE_INPUT_WRITE )
@@ -573,6 +577,8 @@ void purple_initmodule()
funcs.send_typing = purple_send_typing;
funcs.handle_cmp = g_strcasecmp;
+ help = g_string_new("BitlBee libpurple module supports the following IM protocols:\n");
+
for( prots = purple_plugins_get_protocols(); prots; prots = prots->next )
{
PurplePlugin *prot = prots->data;
@@ -584,6 +590,8 @@ void purple_initmodule()
ret->name += 5;
register_protocol( ret );
+ g_string_append_printf( help, "\n* %s (%s)", ret->name, prot->info->name );
+
if( g_strcasecmp( prot->info->id, "prpl-aim" ) == 0 )
{
ret = g_memdup( &funcs, sizeof( funcs ) );
@@ -592,4 +600,7 @@ void purple_initmodule()
register_protocol( ret );
}
}
+
+ help_add_mem( &global.help, "purple", help->str );
+ g_string_free( help, TRUE );
}