From 5c30b848915c77ae8a78bc08df8483e397fe3409 Mon Sep 17 00:00:00 2001 From: Berke Viktor Date: Sun, 15 Jan 2012 21:15:14 +0100 Subject: implement xchat_pluginpref_list --- src/common/plugin.c | 35 ++++++++++++++++++++++++++++++++--- 1 file changed, 32 insertions(+), 3 deletions(-) diff --git a/src/common/plugin.c b/src/common/plugin.c index cff8d49b..d4f7edc0 100644 --- a/src/common/plugin.c +++ b/src/common/plugin.c @@ -1791,7 +1791,36 @@ xchat_pluginpref_delete (xchat_plugin *pl, const char *var) } int -xchat_pluginpref_list (char* dest) +xchat_pluginpref_list (xchat_plugin *pl, char* dest) { - return 0; -} \ No newline at end of file + FILE *fpIn; + char confname[64]; + char buffer[512]; /* the same as in cfg_put_str */ + char buffer2[512]; + char *token; + + token = g_strdup (pl->name); + canonalize_key (token); + sprintf (confname, "plugin_%s.conf", token); + g_free (token); + + fpIn = xchat_fopen_file (confname, "r", 0); + + if (fpIn == NULL) /* no existing config file, no parsing */ + { + return 0; + } + else /* existing config file, get list of settings */ + { + while (fscanf (fpIn, " %[^\n]", &buffer) != EOF) /* read whole lines including whitespaces */ + { + token = strtok (buffer, "="); + strncat (dest, token, strlen (token) - 1); + strcat (dest, ","); + } + + fclose (fpIn); + } + + return 1; +} -- cgit 1.4.1