summary refs log tree commit diff stats
path: root/plugins
diff options
context:
space:
mode:
authorBerke Viktor <berkeviktor@aol.com>2012-01-15 21:15:33 +0100
committerBerke Viktor <berkeviktor@aol.com>2012-01-15 21:15:33 +0100
commit306b2a87075cfce4eb13e7821763bf27614c25f4 (patch)
tree50c07c6e4642d0eaaf4b163c2ef691812dc2dc21 /plugins
parent5c30b848915c77ae8a78bc08df8483e397fe3409 (diff)
implement XSASL LIST
Diffstat (limited to 'plugins')
-rw-r--r--plugins/xsasl/xsasl.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/plugins/xsasl/xsasl.c b/plugins/xsasl/xsasl.c
index 2b2ec0c7..43689fd3 100644
--- a/plugins/xsasl/xsasl.c
+++ b/plugins/xsasl/xsasl.c
@@ -43,7 +43,7 @@ static xchat_plugin *ph;   /* plugin handle */
 static const char name[] = "X-SASL";
 static const char desc[] = "SASL authentication plugin for XChat";
 static const char version[] = "1.1";
-static const char xsasl_help[] = "X-SASL Usage:\n /XSASL ADD <login> <password> <network>, enable SASL authentication for given network\n /XSASL DEL <network>, disable SASL authentication for given network\n";
+static const char xsasl_help[] = "X-SASL Usage:\n /XSASL ADD <login> <password> <network>, enable SASL authentication for given network\n /XSASL DEL <network>, disable SASL authentication for given network\n /XSASL LIST, get the list of SASL-enabled networks\n";
 
 struct sasl_info
 {
@@ -69,6 +69,29 @@ del_info (char const* network)
 	return xchat_pluginpref_delete (ph, network);
 }
 
+static void
+print_info ()
+{
+	char list[512];
+	char* token;
+
+	if (xchat_pluginpref_list (ph, list))
+	{
+		xchat_printf (ph, "%s\tSASL-enabled networks:", name);
+		xchat_printf (ph, "%s\t----------------------", name);
+		token = strtok (list, ",");
+		while (token != NULL)
+		{
+			xchat_printf (ph, "%s\t%s", name, token);
+			token = strtok (NULL, ",");
+		}
+	}
+	else
+	{
+		xchat_printf (ph, "%s\tThere are no SASL-enabled networks currently", name);
+	}
+}
+
 static sasl_info*
 find_info (char const* network)
 {
@@ -232,6 +255,11 @@ sasl_cmd_cb (char *word[], char *word_eol[], void *userdata)
 
 		return XCHAT_EAT_ALL;
 	}
+	else if (!stricmp ("LIST", mode))
+	{
+		print_info ();
+		return XCHAT_EAT_ALL;
+	}
 	else
 	{
 		xchat_printf (ph, "%s", xsasl_help);