summary refs log tree commit diff stats
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/plugin.c35
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;
+}