diff options
author | Berke Viktor <berkeviktor@aol.com> | 2012-01-15 21:15:14 +0100 |
---|---|---|
committer | Berke Viktor <berkeviktor@aol.com> | 2012-01-15 21:15:14 +0100 |
commit | 5c30b848915c77ae8a78bc08df8483e397fe3409 (patch) | |
tree | 73385091e263118d1e47f836c7b32436192aa140 /src | |
parent | 44e404838683b9256f60ccd8e3370a39e27c6b58 (diff) |
implement xchat_pluginpref_list
Diffstat (limited to 'src')
-rw-r--r-- | src/common/plugin.c | 35 |
1 files 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; +} |